changeset 57560:2877992dadf9

8236364: TEMP vector registers could be incorrectly assigned upper bank xmm registers after Generic Operands (JDK-8234391) Reviewed-by: kvn, vlivanov
author sviswanathan
date Tue, 24 Dec 2019 16:49:37 +0300
parents cf32454b65f0
children d54ce919da90
files src/hotspot/cpu/aarch64/aarch64.ad src/hotspot/cpu/arm/arm.ad src/hotspot/cpu/ppc/ppc.ad src/hotspot/cpu/s390/s390.ad src/hotspot/cpu/sparc/sparc.ad src/hotspot/cpu/x86/x86.ad src/hotspot/share/opto/matcher.cpp src/hotspot/share/opto/matcher.hpp
diffstat 8 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/cpu/aarch64/aarch64.ad	Tue Dec 24 04:47:44 2019 -0500
+++ b/src/hotspot/cpu/aarch64/aarch64.ad	Tue Dec 24 16:49:37 2019 +0300
@@ -2297,7 +2297,7 @@
 // No support for generic vector operands.
 const bool Matcher::supports_generic_vector_operands  = false;
 
-MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg) {
+MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
   ShouldNotReachHere(); // generic vector operands not supported
   return NULL;
 }
--- a/src/hotspot/cpu/arm/arm.ad	Tue Dec 24 04:47:44 2019 -0500
+++ b/src/hotspot/cpu/arm/arm.ad	Tue Dec 24 16:49:37 2019 +0300
@@ -1080,7 +1080,7 @@
 // No support for generic vector operands.
 const bool Matcher::supports_generic_vector_operands  = false;
 
-MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg) {
+MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
   ShouldNotReachHere(); // generic vector operands not supported
   return NULL;
 }
--- a/src/hotspot/cpu/ppc/ppc.ad	Tue Dec 24 04:47:44 2019 -0500
+++ b/src/hotspot/cpu/ppc/ppc.ad	Tue Dec 24 16:49:37 2019 +0300
@@ -2429,7 +2429,7 @@
 // No support for generic vector operands.
 const bool Matcher::supports_generic_vector_operands  = false;
 
-MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg) {
+MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
   ShouldNotReachHere(); // generic vector operands not supported
   return NULL;
 }
--- a/src/hotspot/cpu/s390/s390.ad	Tue Dec 24 04:47:44 2019 -0500
+++ b/src/hotspot/cpu/s390/s390.ad	Tue Dec 24 16:49:37 2019 +0300
@@ -1661,7 +1661,7 @@
 // No support for generic vector operands.
 const bool Matcher::supports_generic_vector_operands  = false;
 
-MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg) {
+MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
   ShouldNotReachHere(); // generic vector operands not supported
   return NULL;
 }
--- a/src/hotspot/cpu/sparc/sparc.ad	Tue Dec 24 04:47:44 2019 -0500
+++ b/src/hotspot/cpu/sparc/sparc.ad	Tue Dec 24 16:49:37 2019 +0300
@@ -1818,7 +1818,7 @@
 // No support for generic vector operands.
 const bool Matcher::supports_generic_vector_operands  = false;
 
-MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg) {
+MachOper* Matcher::specialize_generic_vector_operand(MachOper* original_opnd, uint ideal_reg, bool is_temp) {
   ShouldNotReachHere(); // generic vector operands not supported
   return NULL;
 }
--- a/src/hotspot/cpu/x86/x86.ad	Tue Dec 24 04:47:44 2019 -0500
+++ b/src/hotspot/cpu/x86/x86.ad	Tue Dec 24 16:49:37 2019 +0300
@@ -1438,9 +1438,14 @@
 // x86 supports generic vector operands: vec and legVec.
 const bool Matcher::supports_generic_vector_operands = true;
 
-MachOper* Matcher::specialize_generic_vector_operand(MachOper* generic_opnd, uint ideal_reg) {
+MachOper* Matcher::specialize_generic_vector_operand(MachOper* generic_opnd, uint ideal_reg, bool is_temp) {
   assert(Matcher::is_generic_vector(generic_opnd), "not generic");
   bool legacy = (generic_opnd->opcode() == LEGVEC);
+  if (!VM_Version::supports_avx512vlbwdq() && // KNL
+      is_temp && !legacy && (ideal_reg == Op_VecZ)) {
+    // Conservatively specialize 512bit vec TEMP operands to legVecZ (zmm0-15) on KNL.
+    return new legVecZOper();
+  }
   if (legacy) {
     switch (ideal_reg) {
       case Op_VecS: return new legVecSOper();
--- a/src/hotspot/share/opto/matcher.cpp	Tue Dec 24 04:47:44 2019 -0500
+++ b/src/hotspot/share/opto/matcher.cpp	Tue Dec 24 16:49:37 2019 +0300
@@ -2539,7 +2539,7 @@
     int size_in_bytes = 4 * type2size[t->basic_type()];
     ideal_reg = Matcher::vector_ideal_reg(size_in_bytes);
   }
-  return Matcher::specialize_generic_vector_operand(original_opnd, ideal_reg);
+  return Matcher::specialize_generic_vector_operand(original_opnd, ideal_reg, false);
 }
 
 // Compute concrete vector operand for a generic TEMP vector mach node based on its user info.
@@ -2551,7 +2551,7 @@
     tmp->_opnds[0] = use->_opnds[0]->clone();
   } else {
     uint ideal_vreg = vector_ideal_reg(C->max_vector_size());
-    tmp->_opnds[0] = specialize_generic_vector_operand(tmp->_opnds[0], ideal_vreg);
+    tmp->_opnds[0] = specialize_generic_vector_operand(tmp->_opnds[0], ideal_vreg, true);
   }
 }
 
--- a/src/hotspot/share/opto/matcher.hpp	Tue Dec 24 04:47:44 2019 -0500
+++ b/src/hotspot/share/opto/matcher.hpp	Tue Dec 24 16:49:37 2019 +0300
@@ -519,7 +519,7 @@
   MachOper* specialize_vector_operand(MachNode* m, uint idx);
   MachOper* specialize_vector_operand_helper(MachNode* m, MachOper* generic_opnd);
 
-  static MachOper* specialize_generic_vector_operand(MachOper* generic_opnd, uint ideal_reg);
+  static MachOper* specialize_generic_vector_operand(MachOper* generic_opnd, uint ideal_reg, bool is_temp);
 
   static bool is_generic_reg2reg_move(MachNode* m);
   static bool is_generic_vector(MachOper* opnd);