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


< prev index next >