src/share/vm/opto/superword.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7160610 Sdiff src/share/vm/opto

src/share/vm/opto/superword.cpp

Print this page




1204 Node* SuperWord::vector_opd(Node_List* p, int opd_idx) {
1205   Node* p0 = p->at(0);
1206   uint vlen = p->size();
1207   Node* opd = p0->in(opd_idx);
1208 
1209   bool same_opd = true;
1210   for (uint i = 1; i < vlen; i++) {
1211     Node* pi = p->at(i);
1212     Node* in = pi->in(opd_idx);
1213     if (opd != in) {
1214       same_opd = false;
1215       break;
1216     }
1217   }
1218 
1219   if (same_opd) {
1220     if (opd->is_Vector() || opd->is_VectorLoad()) {
1221       return opd; // input is matching vector
1222     }
1223     assert(!opd->is_VectorStore(), "such vector is not expected here");
1224     // Convert scalar input to vector. Use p0's type because it's container
1225     // maybe smaller than the operand's container.
1226     const Type* opd_t = velt_type(!in_bb(opd) ? p0 : opd);
1227     const Type* p0_t  = velt_type(p0);
1228     if (p0_t->higher_equal(opd_t)) opd_t = p0_t;
1229     VectorNode* vn    = VectorNode::scalar2vector(_phase->C, opd, vlen, opd_t);
1230 
1231     _phase->_igvn.register_new_node_with_optimizer(vn);
1232     _phase->set_ctrl(vn, _phase->get_ctrl(opd));
1233     return vn;
1234   }
1235 
1236   // Insert pack operation
1237   const Type* opd_t = velt_type(!in_bb(opd) ? p0 : opd);
1238   PackNode* pk = PackNode::make(_phase->C, opd, opd_t);

1239 
1240   for (uint i = 1; i < vlen; i++) {
1241     Node* pi = p->at(i);
1242     Node* in = pi->in(opd_idx);
1243     assert(my_pack(in) == NULL, "Should already have been unpacked");
1244     assert(opd_t == velt_type(!in_bb(in) ? pi : in), "all same type");
1245     pk->add_opd(in);
1246   }
1247   _phase->_igvn.register_new_node_with_optimizer(pk);
1248   _phase->set_ctrl(pk, _phase->get_ctrl(opd));
1249   return pk;
1250 }
1251 
1252 //------------------------------insert_extracts---------------------------
1253 // If a use of pack p is not a vector use, then replace the
1254 // use with an extract operation.
1255 void SuperWord::insert_extracts(Node_List* p) {
1256   if (p->at(0)->is_Store()) return;
1257   assert(_n_idx_list.is_empty(), "empty (node,index) list");
1258 
1259   // Inspect each use of each pack member.  For each use that is
1260   // not a vector use, replace the use with an extract operation.
1261 
1262   for (uint i = 0; i < p->size(); i++) {
1263     Node* def = p->at(i);
1264     for (DUIterator_Fast jmax, j = def->fast_outs(jmax); j < jmax; j++) {




1204 Node* SuperWord::vector_opd(Node_List* p, int opd_idx) {
1205   Node* p0 = p->at(0);
1206   uint vlen = p->size();
1207   Node* opd = p0->in(opd_idx);
1208 
1209   bool same_opd = true;
1210   for (uint i = 1; i < vlen; i++) {
1211     Node* pi = p->at(i);
1212     Node* in = pi->in(opd_idx);
1213     if (opd != in) {
1214       same_opd = false;
1215       break;
1216     }
1217   }
1218 
1219   if (same_opd) {
1220     if (opd->is_Vector() || opd->is_VectorLoad()) {
1221       return opd; // input is matching vector
1222     }
1223     assert(!opd->is_VectorStore(), "such vector is not expected here");
1224     // Convert scalar input to vector with the same number of elements as
1225     // p0's vector. Use p0's type because size of operand's container in
1226     // vector should match p0's size regardless operand's size.
1227     const Type* p0_t = velt_type(p0);
1228     VectorNode* vn = VectorNode::scalar2vector(_phase->C, opd, vlen, p0_t);

1229 
1230     _phase->_igvn.register_new_node_with_optimizer(vn);
1231     _phase->set_ctrl(vn, _phase->get_ctrl(opd));
1232     return vn;
1233   }
1234 
1235   // Insert pack operation
1236   const Type* p0_t = velt_type(p0);
1237   PackNode* pk = PackNode::make(_phase->C, opd, p0_t);
1238   DEBUG_ONLY( const BasicType opd_bt = opd->bottom_type()->basic_type(); )
1239 
1240   for (uint i = 1; i < vlen; i++) {
1241     Node* pi = p->at(i);
1242     Node* in = pi->in(opd_idx);
1243     assert(my_pack(in) == NULL, "Should already have been unpacked");
1244     assert(opd_bt == in->bottom_type()->basic_type(), "all same type");
1245     pk->add_opd(in);
1246   }
1247   _phase->_igvn.register_new_node_with_optimizer(pk);
1248   _phase->set_ctrl(pk, _phase->get_ctrl(opd));
1249   return pk;
1250 }
1251 
1252 //------------------------------insert_extracts---------------------------
1253 // If a use of pack p is not a vector use, then replace the
1254 // use with an extract operation.
1255 void SuperWord::insert_extracts(Node_List* p) {
1256   if (p->at(0)->is_Store()) return;
1257   assert(_n_idx_list.is_empty(), "empty (node,index) list");
1258 
1259   // Inspect each use of each pack member.  For each use that is
1260   // not a vector use, replace the use with an extract operation.
1261 
1262   for (uint i = 0; i < p->size(); i++) {
1263     Node* def = p->at(i);
1264     for (DUIterator_Fast jmax, j = def->fast_outs(jmax); j < jmax; j++) {


src/share/vm/opto/superword.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File