< prev index next >

src/hotspot/share/opto/superword.cpp

Print this page




1192     return false;
1193   }
1194 
1195   // FIXME - co_locate_pack fails on Stores in different mem-slices, so
1196   // only pack memops that are in the same alias set until that's fixed.
1197   if (_phase->C->get_alias_index(s1->as_Mem()->adr_type()) !=
1198       _phase->C->get_alias_index(s2->as_Mem()->adr_type()))
1199     return false;
1200   SWPointer p1(s1->as_Mem(), this, NULL, false);
1201   SWPointer p2(s2->as_Mem(), this, NULL, false);
1202   if (p1.base() != p2.base() || !p1.comparable(p2)) return false;
1203   int diff = p2.offset_in_bytes() - p1.offset_in_bytes();
1204   return diff == data_size(s1);
1205 }
1206 
1207 //------------------------------isomorphic---------------------------
1208 // Are s1 and s2 similar?
1209 bool SuperWord::isomorphic(Node* s1, Node* s2) {
1210   if (s1->Opcode() != s2->Opcode()) return false;
1211   if (s1->req() != s2->req()) return false;
1212   if (s1->in(0) != s2->in(0)) return false;
1213   if (!same_velt_type(s1, s2)) return false;




1214   return true;

































1215 }
1216 
1217 //------------------------------independent---------------------------
1218 // Is there no data path from s1 to s2 or s2 to s1?
1219 bool SuperWord::independent(Node* s1, Node* s2) {
1220   //  assert(s1->Opcode() == s2->Opcode(), "check isomorphic first");
1221   int d1 = depth(s1);
1222   int d2 = depth(s2);
1223   if (d1 == d2) return s1 != s2;
1224   Node* deep    = d1 > d2 ? s1 : s2;
1225   Node* shallow = d1 > d2 ? s2 : s1;
1226 
1227   visited_clear();
1228 
1229   return independent_path(shallow, deep);
1230 }
1231 
1232 //--------------------------have_similar_inputs-----------------------
1233 // For a node pair (s1, s2) which is isomorphic and independent,
1234 // do s1 and s2 have similar input edges?




1192     return false;
1193   }
1194 
1195   // FIXME - co_locate_pack fails on Stores in different mem-slices, so
1196   // only pack memops that are in the same alias set until that's fixed.
1197   if (_phase->C->get_alias_index(s1->as_Mem()->adr_type()) !=
1198       _phase->C->get_alias_index(s2->as_Mem()->adr_type()))
1199     return false;
1200   SWPointer p1(s1->as_Mem(), this, NULL, false);
1201   SWPointer p2(s2->as_Mem(), this, NULL, false);
1202   if (p1.base() != p2.base() || !p1.comparable(p2)) return false;
1203   int diff = p2.offset_in_bytes() - p1.offset_in_bytes();
1204   return diff == data_size(s1);
1205 }
1206 
1207 //------------------------------isomorphic---------------------------
1208 // Are s1 and s2 similar?
1209 bool SuperWord::isomorphic(Node* s1, Node* s2) {
1210   if (s1->Opcode() != s2->Opcode()) return false;
1211   if (s1->req() != s2->req()) return false;

1212   if (!same_velt_type(s1, s2)) return false;
1213   Node* s1_ctrl = s1->in(0);
1214   Node* s2_ctrl = s2->in(0);
1215   // If the control nodes are equivalent, no further checks are required to test for isomorphism.
1216   if (s1_ctrl == s2_ctrl) {
1217     return true;
1218   } else {
1219     bool s1_ctrl_inv = ((s1_ctrl == NULL) ? true : lpt()->is_invariant(s1_ctrl));
1220     bool s2_ctrl_inv = ((s2_ctrl == NULL) ? true : lpt()->is_invariant(s2_ctrl));
1221     // If the control nodes are not invariant for the loop, fail isomorphism test.
1222     if (!s1_ctrl_inv || !s2_ctrl_inv) {
1223       return false;
1224     }
1225     if (s1_ctrl->is_Proj()) {
1226       s1_ctrl = s1_ctrl->in(0);
1227       assert(lpt()->is_invariant(s1_ctrl), "must be invariant");
1228     }
1229     if (s2_ctrl->is_Proj()) {
1230       s2_ctrl = s2_ctrl->in(0);
1231       assert(lpt()->is_invariant(s2_ctrl), "must be invariant");
1232     }
1233     if (!s1_ctrl->is_RangeCheck() || !s2_ctrl->is_RangeCheck()) {
1234       return false;
1235     }
1236     // Control nodes are invariant. However, we have no way of checking whether they resolve
1237     // in an equivalent manner. But, we know that invariant range checks are guaranteed to
1238     // throw before the loop (if they would have thrown). Thus, the loop would not have been reached.
1239     // Therefore, if the control nodes for both are range checks, we accept them to be isomorphic.
1240     for (DUIterator_Fast imax, i = s1->fast_outs(imax); i < imax; i++) {
1241       Node* t1 = s1->fast_out(i);
1242       for (DUIterator_Fast imax, i = s2->fast_outs(imax); i < imax; i++) {
1243         Node* t2 = s2->fast_out(i);
1244         if (VectorNode::is_muladds2i(t1) && VectorNode::is_muladds2i(t2)) {
1245           return true;
1246         }
1247       }
1248     }
1249   }
1250   return false;
1251 }
1252 
1253 //------------------------------independent---------------------------
1254 // Is there no data path from s1 to s2 or s2 to s1?
1255 bool SuperWord::independent(Node* s1, Node* s2) {
1256   //  assert(s1->Opcode() == s2->Opcode(), "check isomorphic first");
1257   int d1 = depth(s1);
1258   int d2 = depth(s2);
1259   if (d1 == d2) return s1 != s2;
1260   Node* deep    = d1 > d2 ? s1 : s2;
1261   Node* shallow = d1 > d2 ? s2 : s1;
1262 
1263   visited_clear();
1264 
1265   return independent_path(shallow, deep);
1266 }
1267 
1268 //--------------------------have_similar_inputs-----------------------
1269 // For a node pair (s1, s2) which is isomorphic and independent,
1270 // do s1 and s2 have similar input edges?


< prev index next >