-
Enhancement
-
Resolution: Unresolved
-
P4
-
20, 21, 22
The attached Test2.java does not vectorize, as we can see:
./java -Xbatch -XX:CompileCommand=compileonly,Test2::test -XX:+TraceNewVectors -XX:+TraceSuperWord -XX:+Verbose -XX:+TraceLoopOpts -XX:UseAVX=2 Test2.java
See the attached "swap.png", we can see that there was a edge swapping. This means that the left and right operations are shuffled, and therefore the vector input/outputs do not align any more.
If I comment out the commute operation during IGVN, then it does vectorize:
diff --git a/src/hotspot/share/opto/addnode.cpp b/src/hotspot/share/opto/addnode.cpp
index cf8f58d8e23..820fa5f9c84 100644
--- a/src/hotspot/share/opto/addnode.cpp
+++ b/src/hotspot/share/opto/addnode.cpp
@@ -118,11 +118,11 @@ static bool commute(PhaseGVN* phase, Node* add) {
return true;
}
- // Otherwise, sort inputs (commutativity) to help value numbering.
- if( in1->_idx > in2->_idx ) {
- add->swap_edges(1, 2);
- return true;
- }
+ // // Otherwise, sort inputs (commutativity) to help value numbering.
+ // if( in1->_idx > in2->_idx ) {
+ // add->swap_edges(1, 2);
+ // return true;
+ // }
return false;
}
./java -Xbatch -XX:CompileCommand=compileonly,Test2::test -XX:+TraceNewVectors -XX:+TraceSuperWord -XX:+Verbose -XX:+TraceLoopOpts -XX:UseAVX=2 Test2.java
See the attached "swap.png", we can see that there was a edge swapping. This means that the left and right operations are shuffled, and therefore the vector input/outputs do not align any more.
If I comment out the commute operation during IGVN, then it does vectorize:
diff --git a/src/hotspot/share/opto/addnode.cpp b/src/hotspot/share/opto/addnode.cpp
index cf8f58d8e23..820fa5f9c84 100644
--- a/src/hotspot/share/opto/addnode.cpp
+++ b/src/hotspot/share/opto/addnode.cpp
@@ -118,11 +118,11 @@ static bool commute(PhaseGVN* phase, Node* add) {
return true;
}
- // Otherwise, sort inputs (commutativity) to help value numbering.
- if( in1->_idx > in2->_idx ) {
- add->swap_edges(1, 2);
- return true;
- }
+ // // Otherwise, sort inputs (commutativity) to help value numbering.
+ // if( in1->_idx > in2->_idx ) {
+ // add->swap_edges(1, 2);
+ // return true;
+ // }
return false;
}