hotspot/src/share/vm/opto/vectornode.cpp
changeset 33105 294e48b4f704
parent 32723 56534fb3d71a
child 33155 73bf16b22e89
equal deleted inserted replaced
33104:a7c0f60a1294 33105:294e48b4f704
   253 // Return the vector version of a scalar operation node.
   253 // Return the vector version of a scalar operation node.
   254 VectorNode* VectorNode::make(int opc, Node* n1, Node* n2, uint vlen, BasicType bt) {
   254 VectorNode* VectorNode::make(int opc, Node* n1, Node* n2, uint vlen, BasicType bt) {
   255   const TypeVect* vt = TypeVect::make(bt, vlen);
   255   const TypeVect* vt = TypeVect::make(bt, vlen);
   256   int vopc = VectorNode::opcode(opc, bt);
   256   int vopc = VectorNode::opcode(opc, bt);
   257   // This method should not be called for unimplemented vectors.
   257   // This method should not be called for unimplemented vectors.
   258   guarantee(vopc > 0, err_msg_res("Vector for '%s' is not implemented", NodeClassNames[opc]));
   258   guarantee(vopc > 0, "Vector for '%s' is not implemented", NodeClassNames[opc]);
   259   switch (vopc) {
   259   switch (vopc) {
   260   case Op_AddVB: return new AddVBNode(n1, n2, vt);
   260   case Op_AddVB: return new AddVBNode(n1, n2, vt);
   261   case Op_AddVS: return new AddVSNode(n1, n2, vt);
   261   case Op_AddVS: return new AddVSNode(n1, n2, vt);
   262   case Op_AddVI: return new AddVINode(n1, n2, vt);
   262   case Op_AddVI: return new AddVINode(n1, n2, vt);
   263   case Op_AddVL: return new AddVLNode(n1, n2, vt);
   263   case Op_AddVL: return new AddVLNode(n1, n2, vt);
   300 
   300 
   301   case Op_AndV: return new AndVNode(n1, n2, vt);
   301   case Op_AndV: return new AndVNode(n1, n2, vt);
   302   case Op_OrV:  return new OrVNode (n1, n2, vt);
   302   case Op_OrV:  return new OrVNode (n1, n2, vt);
   303   case Op_XorV: return new XorVNode(n1, n2, vt);
   303   case Op_XorV: return new XorVNode(n1, n2, vt);
   304   }
   304   }
   305   fatal(err_msg_res("Missed vector creation for '%s'", NodeClassNames[vopc]));
   305   fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
   306   return NULL;
   306   return NULL;
   307 
   307 
   308 }
   308 }
   309 
   309 
   310 // Scalar promotion
   310 // Scalar promotion
   326   case T_FLOAT:
   326   case T_FLOAT:
   327     return new ReplicateFNode(s, vt);
   327     return new ReplicateFNode(s, vt);
   328   case T_DOUBLE:
   328   case T_DOUBLE:
   329     return new ReplicateDNode(s, vt);
   329     return new ReplicateDNode(s, vt);
   330   }
   330   }
   331   fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt)));
   331   fatal("Type '%s' is not supported for vectors", type2name(bt));
   332   return NULL;
   332   return NULL;
   333 }
   333 }
   334 
   334 
   335 VectorNode* VectorNode::shift_count(Node* shift, Node* cnt, uint vlen, BasicType bt) {
   335 VectorNode* VectorNode::shift_count(Node* shift, Node* cnt, uint vlen, BasicType bt) {
   336   assert(VectorNode::is_shift(shift) && !cnt->is_Con(), "only variable shift count");
   336   assert(VectorNode::is_shift(shift) && !cnt->is_Con(), "only variable shift count");
   344   case Op_RShiftL:
   344   case Op_RShiftL:
   345   case Op_URShiftI:
   345   case Op_URShiftI:
   346   case Op_URShiftL:
   346   case Op_URShiftL:
   347     return new RShiftCntVNode(cnt, vt);
   347     return new RShiftCntVNode(cnt, vt);
   348   }
   348   }
   349   fatal(err_msg_res("Missed vector creation for '%s'", NodeClassNames[shift->Opcode()]));
   349   fatal("Missed vector creation for '%s'", NodeClassNames[shift->Opcode()]);
   350   return NULL;
   350   return NULL;
   351 }
   351 }
   352 
   352 
   353 // Return initial Pack node. Additional operands added with add_opd() calls.
   353 // Return initial Pack node. Additional operands added with add_opd() calls.
   354 PackNode* PackNode::make(Node* s, uint vlen, BasicType bt) {
   354 PackNode* PackNode::make(Node* s, uint vlen, BasicType bt) {
   367   case T_FLOAT:
   367   case T_FLOAT:
   368     return new PackFNode(s, vt);
   368     return new PackFNode(s, vt);
   369   case T_DOUBLE:
   369   case T_DOUBLE:
   370     return new PackDNode(s, vt);
   370     return new PackDNode(s, vt);
   371   }
   371   }
   372   fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt)));
   372   fatal("Type '%s' is not supported for vectors", type2name(bt));
   373   return NULL;
   373   return NULL;
   374 }
   374 }
   375 
   375 
   376 // Create a binary tree form for Packs. [lo, hi) (half-open) range
   376 // Create a binary tree form for Packs. [lo, hi) (half-open) range
   377 PackNode* PackNode::binary_tree_pack(int lo, int hi) {
   377 PackNode* PackNode::binary_tree_pack(int lo, int hi) {
   403     case T_FLOAT:
   403     case T_FLOAT:
   404       return new PackDNode(n1, n2, TypeVect::make(T_DOUBLE, 2));
   404       return new PackDNode(n1, n2, TypeVect::make(T_DOUBLE, 2));
   405     case T_DOUBLE:
   405     case T_DOUBLE:
   406       return new Pack2DNode(n1, n2, TypeVect::make(T_DOUBLE, 2));
   406       return new Pack2DNode(n1, n2, TypeVect::make(T_DOUBLE, 2));
   407     }
   407     }
   408     fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt)));
   408     fatal("Type '%s' is not supported for vectors", type2name(bt));
   409   }
   409   }
   410   return NULL;
   410   return NULL;
   411 }
   411 }
   412 
   412 
   413 // Return the vector version of a scalar load node.
   413 // Return the vector version of a scalar load node.
   446   case T_FLOAT:
   446   case T_FLOAT:
   447     return new ExtractFNode(v, pos);
   447     return new ExtractFNode(v, pos);
   448   case T_DOUBLE:
   448   case T_DOUBLE:
   449     return new ExtractDNode(v, pos);
   449     return new ExtractDNode(v, pos);
   450   }
   450   }
   451   fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt)));
   451   fatal("Type '%s' is not supported for vectors", type2name(bt));
   452   return NULL;
   452   return NULL;
   453 }
   453 }
   454 
   454 
   455 int ReductionNode::opcode(int opc, BasicType bt) {
   455 int ReductionNode::opcode(int opc, BasicType bt) {
   456   int vopc = opc;
   456   int vopc = opc;
   498 ReductionNode* ReductionNode::make(int opc, Node *ctrl, Node* n1, Node* n2, BasicType bt) {
   498 ReductionNode* ReductionNode::make(int opc, Node *ctrl, Node* n1, Node* n2, BasicType bt) {
   499 
   499 
   500   int vopc = opcode(opc, bt);
   500   int vopc = opcode(opc, bt);
   501 
   501 
   502   // This method should not be called for unimplemented vectors.
   502   // This method should not be called for unimplemented vectors.
   503   guarantee(vopc != opc, err_msg_res("Vector for '%s' is not implemented", NodeClassNames[opc]));
   503   guarantee(vopc != opc, "Vector for '%s' is not implemented", NodeClassNames[opc]);
   504 
   504 
   505   switch (vopc) {
   505   switch (vopc) {
   506   case Op_AddReductionVI: return new AddReductionVINode(ctrl, n1, n2);
   506   case Op_AddReductionVI: return new AddReductionVINode(ctrl, n1, n2);
   507   case Op_AddReductionVL: return new AddReductionVLNode(ctrl, n1, n2);
   507   case Op_AddReductionVL: return new AddReductionVLNode(ctrl, n1, n2);
   508   case Op_AddReductionVF: return new AddReductionVFNode(ctrl, n1, n2);
   508   case Op_AddReductionVF: return new AddReductionVFNode(ctrl, n1, n2);
   510   case Op_MulReductionVI: return new MulReductionVINode(ctrl, n1, n2);
   510   case Op_MulReductionVI: return new MulReductionVINode(ctrl, n1, n2);
   511   case Op_MulReductionVL: return new MulReductionVLNode(ctrl, n1, n2);
   511   case Op_MulReductionVL: return new MulReductionVLNode(ctrl, n1, n2);
   512   case Op_MulReductionVF: return new MulReductionVFNode(ctrl, n1, n2);
   512   case Op_MulReductionVF: return new MulReductionVFNode(ctrl, n1, n2);
   513   case Op_MulReductionVD: return new MulReductionVDNode(ctrl, n1, n2);
   513   case Op_MulReductionVD: return new MulReductionVDNode(ctrl, n1, n2);
   514   }
   514   }
   515   fatal(err_msg_res("Missed vector creation for '%s'", NodeClassNames[vopc]));
   515   fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
   516   return NULL;
   516   return NULL;
   517 }
   517 }
   518 
   518 
   519 bool ReductionNode::implemented(int opc, uint vlen, BasicType bt) {
   519 bool ReductionNode::implemented(int opc, uint vlen, BasicType bt) {
   520   if (is_java_primitive(bt) &&
   520   if (is_java_primitive(bt) &&