< prev index next >
src/share/vm/opto/superword.cpp
Print this page
rev 13112 : 8181633: Vectorization fails for some multiplication with constant cases
Reviewed-by: duke
Contributed-by: yang.zhang@linaro.org
*** 1068,1078 ****
if (Matcher::max_vector_size(bt1) < 2) {
return false; // No vectors for this type
}
if (isomorphic(s1, s2)) {
! if (independent(s1, s2) || reduction(s1, s2)) {
if (!exists_at(s1, 0) && !exists_at(s2, 1)) {
if (!s1->is_Mem() || are_adjacent_refs(s1, s2)) {
int s1_align = alignment(s1);
int s2_align = alignment(s2);
if (s1_align == top_align || s1_align == align) {
--- 1068,1078 ----
if (Matcher::max_vector_size(bt1) < 2) {
return false; // No vectors for this type
}
if (isomorphic(s1, s2)) {
! if ((independent(s1, s2) && have_similar_inputs(s1, s2)) || reduction(s1, s2)) {
if (!exists_at(s1, 0) && !exists_at(s2, 1)) {
if (!s1->is_Mem() || are_adjacent_refs(s1, s2)) {
int s1_align = alignment(s1);
int s2_align = alignment(s2);
if (s1_align == top_align || s1_align == align) {
*** 1146,1155 ****
--- 1146,1169 ----
visited_clear();
return independent_path(shallow, deep);
}
+ //--------------------------have_similar_inputs-----------------------
+ // For a node pair (s1, s2) which is isomorphic and independent,
+ // do s1 and s2 have similar input edges?
+ bool SuperWord::have_similar_inputs(Node* s1, Node* s2) {
+ // assert(isomorphic(s1, s2) == true, "check isomorphic");
+ // assert(independent(s1, s2) == true, "check independent");
+ if (s1->req() > 1 && !s1->is_Store() && !s1->is_Load()) {
+ for (uint i = 1; i < s1->req(); i++) {
+ if (s1->in(i)->Opcode() != s2->in(i)->Opcode()) return false;
+ }
+ }
+ return true;
+ }
+
//------------------------------reduction---------------------------
// Is there a data path between s1 and s2 and the nodes reductions?
bool SuperWord::reduction(Node* s1, Node* s2) {
bool retValue = false;
int d1 = depth(s1);
< prev index next >