8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX))
authormhorie
Thu, 05 Oct 2017 12:56:42 +0200
changeset 47594 fd0db78ac8d4
parent 47593 2d56326b98f0
child 47595 bb0c5c1a2785
child 47596 6d5b8aa2f568
8188802: PPC64: Failure on assert(lrgmask.is_aligned_sets(RegMask::SlotsPerVecX)) Reviewed-by: mdoerr
src/hotspot/cpu/ppc/globals_ppc.hpp
src/hotspot/cpu/ppc/ppc.ad
src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
src/hotspot/cpu/ppc/vm_version_ppc.cpp
--- a/src/hotspot/cpu/ppc/globals_ppc.hpp	Thu Oct 05 10:55:34 2017 +0200
+++ b/src/hotspot/cpu/ppc/globals_ppc.hpp	Thu Oct 05 12:56:42 2017 +0200
@@ -103,6 +103,9 @@
           "CPU Version: x for PowerX. Currently recognizes Power5 to "      \
           "Power8. Default is 0. Newer CPUs will be recognized as Power8.") \
                                                                             \
+  product(bool, SuperwordUseVSX, false,                                     \
+          "Use Power8 VSX instructions for superword optimization.")        \
+                                                                            \
   /* Reoptimize code-sequences of calls at runtime, e.g. replace an */      \
   /* indirect call by a direct call.                                */      \
   product(bool, ReoptimizeCallSequences, true,                              \
--- a/src/hotspot/cpu/ppc/ppc.ad	Thu Oct 05 10:55:34 2017 +0200
+++ b/src/hotspot/cpu/ppc/ppc.ad	Thu Oct 05 12:56:42 2017 +0200
@@ -452,17 +452,6 @@
 );
 
 alloc_class chunk3 (
-  // special registers
-  // These registers are not allocated, but used for nodes generated by postalloc expand.
-  SR_XER,
-  SR_LR,
-  SR_CTR,
-  SR_VRSAVE,
-  SR_SPEFSCR,
-  SR_PPR
-);
-
-alloc_class chunk4 (
   VSR0,
   VSR1,
   VSR2,
@@ -529,6 +518,17 @@
   VSR63
 );
 
+alloc_class chunk4 (
+  // special registers
+  // These registers are not allocated, but used for nodes generated by postalloc expand.
+  SR_XER,
+  SR_LR,
+  SR_CTR,
+  SR_VRSAVE,
+  SR_SPEFSCR,
+  SR_PPR
+);
+
 //-------Architecture Description Register Classes-----------------------
 
 // Several register classes are automatically defined based upon
@@ -1675,7 +1675,7 @@
   if (reg < 64+64) return rc_float;
 
   // Between float regs & stack are the flags regs.
-  assert(OptoReg::is_stack(reg), "blow up if spilling flags");
+  assert(OptoReg::is_stack(reg) || reg < 64+64+64, "blow up if spilling flags");
 
   return rc_stack;
 }
@@ -2221,7 +2221,7 @@
 
 // Vector width in bytes.
 const int Matcher::vector_width_in_bytes(BasicType bt) {
-  if (VM_Version::has_vsx()) {
+  if (SuperwordUseVSX) {
     assert(MaxVectorSize == 16, "");
     return 16;
   } else {
@@ -2232,7 +2232,7 @@
 
 // Vector ideal reg.
 const uint Matcher::vector_ideal_reg(int size) {
-  if (VM_Version::has_vsx()) {
+  if (SuperwordUseVSX) {
     assert(MaxVectorSize == 16 && size == 16, "");
     return Op_VecX;
   } else {
@@ -2258,10 +2258,7 @@
 
 // PPC doesn't support misaligned vectors store/load.
 const bool Matcher::misaligned_vectors_ok() {
-  if (VM_Version::has_vsx())
-    return !AlignVector; // can be changed by flag
-  else
-    return false;
+  return !AlignVector; // can be changed by flag
 }
 
 // PPC AES support not yet implemented
--- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp	Thu Oct 05 10:55:34 2017 +0200
+++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp	Thu Oct 05 12:56:42 2017 +0200
@@ -480,11 +480,7 @@
 // Is vector's size (in bytes) bigger than a size saved by default?
 bool SharedRuntime::is_wide_vector(int size) {
   // Note, MaxVectorSize == 8/16 on PPC64.
-  if (VM_Version::has_vsx()) {
-    assert(size <= 16, "%d bytes vectors are not supported", size);
-  } else {
-    assert(size <= 8, "%d bytes vectors are not supported", size);
-  }
+  assert(size <= (SuperwordUseVSX ? 16 : 8), "%d bytes vectors are not supported", size);
   return size > 8;
 }
 
--- a/src/hotspot/cpu/ppc/vm_version_ppc.cpp	Thu Oct 05 10:55:34 2017 +0200
+++ b/src/hotspot/cpu/ppc/vm_version_ppc.cpp	Thu Oct 05 12:56:42 2017 +0200
@@ -107,10 +107,17 @@
   // TODO: PPC port PdScheduling::power6SectorSize = 0x20;
   }
 
-  if (VM_Version::has_vsx())
-    MaxVectorSize = 16;
-  else
-    MaxVectorSize = 8;
+  if (PowerArchitecturePPC64 >= 8) {
+    if (FLAG_IS_DEFAULT(SuperwordUseVSX)) {
+      FLAG_SET_ERGO(bool, SuperwordUseVSX, true);
+    }
+  } else {
+    if (SuperwordUseVSX) {
+      warning("SuperwordUseVSX specified, but needs at least Power8.");
+      FLAG_SET_DEFAULT(SuperwordUseVSX, false);
+    }
+  }
+  MaxVectorSize = SuperwordUseVSX ? 16 : 8;
 #endif
 
   // Create and print feature-string.