< prev index next >

src/hotspot/share/opto/superword.cpp

Print this page

        

@@ -1443,11 +1443,11 @@
 
   for (DUIterator_Fast imax, i = s1->fast_outs(imax); i < imax; i++) {
     Node* t1 = s1->fast_out(i);
 
     // Only allow operand swap on commuting operations
-    if (!t1->is_Add() && !t1->is_Mul()) {
+    if (!t1->is_Add() && !t1->is_Mul() && !VectorNode::is_muladds2i(t1)) {
       break;
     }
 
     // Now find t1's packset
     Node_List* p2 = NULL;

@@ -1498,13 +1498,27 @@
     for (i2++; i2 < ct; i2++) if (u2->in(i2) == d2) break;
     if (i1 != i2) {
       if ((i1 == (3-i2)) && (u2->is_Add() || u2->is_Mul())) {
         // Further analysis relies on operands position matching.
         u2->swap_edges(i1, i2);
+      } else if (VectorNode::is_muladds2i(u2) && u1 != u2) {
+        if (i1 == 5 - i2) { // ((i1 == 3 && i2 == 2) || (i1 == 2 && i2 == 3) || (i1 == 1 && i2 == 4) || (i1 == 4 && i2 == 1))
+          u2->swap_edges(1, 2);
+          u2->swap_edges(3, 4);
+        }
+        if (i1 == 3 - i2 || i1 == 7 - i2) { // ((i1 == 1 && i2 == 2) || (i1 == 2 && i2 == 1) || (i1 == 3 && i2 == 4) || (i1 == 4 && i2 == 3))
+          u2->swap_edges(2, 3);
+          u2->swap_edges(1, 4);
+        }
+        return false; // Just swap the edges, the muladds2i nodes get packed in follow_use_defs
       } else {
         return false;
       }
+    } else if (i1 == i2 && VectorNode::is_muladds2i(u2) && u1 != u2) {
+      u2->swap_edges(1, 3);
+      u2->swap_edges(2, 4);
+      return false; // Just swap the edges, the muladds2i nodes get packed in follow_use_defs
     }
   } while (i1 < ct);
   return true;
 }
 
< prev index next >