changeset 3678:0702f188baeb

7200233: C2: can't use expand rules for vector instruction rules Summary: Added missed _bottom_type set in ArchDesc::defineExpand() and missed vector nodes in MatchRule::is_vector(). Reviewed-by: twisti, roland, dlong
author kvn
date Tue, 25 Sep 2012 10:41:15 -0700
parents 1a9b9cfcef41
children 06f52c4d0e18
files src/share/vm/adlc/formssel.cpp src/share/vm/adlc/output_c.cpp src/share/vm/runtime/vmStructs.cpp
diffstat 3 files changed, 36 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/adlc/formssel.cpp	Thu Mar 29 16:43:21 2012 +0200
+++ b/src/share/vm/adlc/formssel.cpp	Tue Sep 25 10:41:15 2012 -0700
@@ -4043,18 +4043,27 @@
 }
 
 bool MatchRule::is_vector() const {
-  if( _rChild ) {
+  static const char *vector_list[] = {
+    "AddVB","AddVS","AddVI","AddVL","AddVF","AddVD",
+    "SubVB","SubVS","SubVI","SubVL","SubVF","SubVD",
+    "MulVS","MulVI","MulVF","MulVD",
+    "DivVF","DivVD",
+    "AndV" ,"XorV" ,"OrV",
+    "LShiftVB","LShiftVS","LShiftVI","LShiftVL",
+    "RShiftVB","RShiftVS","RShiftVI","RShiftVL",
+    "URShiftVB","URShiftVS","URShiftVI","URShiftVL",
+    "ReplicateB","ReplicateS","ReplicateI","ReplicateL","ReplicateF","ReplicateD",
+    "LoadVector","StoreVector",
+    // Next are not supported currently.
+    "PackB","PackS","PackI","PackL","PackF","PackD","Pack2L","Pack2D",
+    "ExtractB","ExtractUB","ExtractC","ExtractS","ExtractI","ExtractL","ExtractF","ExtractD"
+  };
+  int cnt = sizeof(vector_list)/sizeof(char*);
+  if (_rChild) {
     const char  *opType = _rChild->_opType;
-    if( strcmp(opType,"ReplicateB")==0 ||
-        strcmp(opType,"ReplicateS")==0 ||
-        strcmp(opType,"ReplicateI")==0 ||
-        strcmp(opType,"ReplicateL")==0 ||
-        strcmp(opType,"ReplicateF")==0 ||
-        strcmp(opType,"ReplicateD")==0 ||
-        strcmp(opType,"LoadVector")==0 ||
-        strcmp(opType,"StoreVector")==0 ||
-        0 /* 0 to line up columns nicely */ )
-      return true;
+    for (int i=0; i<cnt; i++)
+      if (strcmp(opType,vector_list[i]) == 0)
+        return true;
   }
   return false;
 }
--- a/src/share/vm/adlc/output_c.cpp	Thu Mar 29 16:43:21 2012 +0200
+++ b/src/share/vm/adlc/output_c.cpp	Tue Sep 25 10:41:15 2012 -0700
@@ -1606,6 +1606,12 @@
         fprintf(fp, "  ((MachFastLockNode*)n%d)->_counters = _counters;\n",cnt);
       }
 
+      // Fill in the bottom_type where requested
+      if (node->captures_bottom_type(_globalNames) &&
+          new_inst->captures_bottom_type(_globalNames)) {
+        fprintf(fp, "  ((MachTypeNode*)n%d)->_bottom_type = bottom_type();\n", cnt);
+      }
+
       const char *resultOper = new_inst->reduce_result();
       fprintf(fp,"  n%d->set_opnd_array(0, state->MachOperGenerator( %s, C ));\n",
               cnt, machOperEnum(resultOper));
--- a/src/share/vm/runtime/vmStructs.cpp	Thu Mar 29 16:43:21 2012 +0200
+++ b/src/share/vm/runtime/vmStructs.cpp	Tue Sep 25 10:41:15 2012 -0700
@@ -1905,6 +1905,8 @@
   declare_c2_type(SubVLNode, VectorNode)                                  \
   declare_c2_type(SubVFNode, VectorNode)                                  \
   declare_c2_type(SubVDNode, VectorNode)                                  \
+  declare_c2_type(MulVSNode, VectorNode)                                  \
+  declare_c2_type(MulVINode, VectorNode)                                  \
   declare_c2_type(MulVFNode, VectorNode)                                  \
   declare_c2_type(MulVDNode, VectorNode)                                  \
   declare_c2_type(DivVFNode, VectorNode)                                  \
@@ -1912,9 +1914,15 @@
   declare_c2_type(LShiftVBNode, VectorNode)                               \
   declare_c2_type(LShiftVSNode, VectorNode)                               \
   declare_c2_type(LShiftVINode, VectorNode)                               \
+  declare_c2_type(LShiftVLNode, VectorNode)                               \
   declare_c2_type(RShiftVBNode, VectorNode)                               \
   declare_c2_type(RShiftVSNode, VectorNode)                               \
   declare_c2_type(RShiftVINode, VectorNode)                               \
+  declare_c2_type(RShiftVLNode, VectorNode)                               \
+  declare_c2_type(URShiftVBNode, VectorNode)                              \
+  declare_c2_type(URShiftVSNode, VectorNode)                              \
+  declare_c2_type(URShiftVINode, VectorNode)                              \
+  declare_c2_type(URShiftVLNode, VectorNode)                              \
   declare_c2_type(AndVNode, VectorNode)                                   \
   declare_c2_type(OrVNode, VectorNode)                                    \
   declare_c2_type(XorVNode, VectorNode)                                   \
@@ -1937,6 +1945,8 @@
   declare_c2_type(Pack2DNode, PackNode)                                   \
   declare_c2_type(ExtractNode, Node)                                      \
   declare_c2_type(ExtractBNode, ExtractNode)                              \
+  declare_c2_type(ExtractUBNode, ExtractNode)                             \
+  declare_c2_type(ExtractCNode, ExtractNode)                              \
   declare_c2_type(ExtractSNode, ExtractNode)                              \
   declare_c2_type(ExtractINode, ExtractNode)                              \
   declare_c2_type(ExtractLNode, ExtractNode)                              \