< prev index next >

src/hotspot/share/opto/vectornode.cpp

Print this page

 145     return (bt == T_LONG ? Op_NegVL : 0);
 146   case Op_NegF:
 147     return (bt == T_FLOAT ? Op_NegVF : 0);
 148   case Op_NegD:
 149     return (bt == T_DOUBLE ? Op_NegVD : 0);
 150   case Op_RoundDoubleMode:
 151     return (bt == T_DOUBLE ? Op_RoundDoubleModeV : 0);
 152   case Op_RotateLeft:
 153     return (is_integral_type(bt) ? Op_RotateLeftV : 0);
 154   case Op_RotateRight:
 155     return (is_integral_type(bt) ? Op_RotateRightV : 0);
 156   case Op_SqrtF:
 157     return (bt == T_FLOAT ? Op_SqrtVF : 0);
 158   case Op_SqrtD:
 159     return (bt == T_DOUBLE ? Op_SqrtVD : 0);
 160   case Op_RoundF:
 161     return (bt == T_INT ? Op_RoundVF : 0);
 162   case Op_RoundD:
 163     return (bt == T_LONG ? Op_RoundVD : 0);
 164   case Op_PopCountI:
 165     // Unimplemented for subword types since bit count changes
 166     // depending on size of lane (and sign bit).
 167     return (bt == T_INT ? Op_PopCountVI : 0);
 168   case Op_PopCountL:
 169     return Op_PopCountVL;













 170   case Op_LShiftI:
 171     switch (bt) {
 172     case T_BOOLEAN:
 173     case T_BYTE:   return Op_LShiftVB;
 174     case T_CHAR:
 175     case T_SHORT:  return Op_LShiftVS;
 176     case T_INT:    return Op_LShiftVI;
 177     default:       return 0;
 178     }
 179   case Op_LShiftL:
 180     return (bt == T_LONG ? Op_LShiftVL : 0);
 181   case Op_RShiftI:
 182     switch (bt) {
 183     case T_BOOLEAN:return Op_URShiftVB; // boolean is unsigned value
 184     case T_CHAR:   return Op_URShiftVS; // char is unsigned value
 185     case T_BYTE:   return Op_RShiftVB;
 186     case T_SHORT:  return Op_RShiftVS;
 187     case T_INT:    return Op_RShiftVI;
 188     default:       return 0;
 189     }

 228   case Op_LoadD:
 229     return Op_LoadVector;
 230 
 231   case Op_StoreB:
 232   case Op_StoreC:
 233   case Op_StoreI:
 234   case Op_StoreL:
 235   case Op_StoreF:
 236   case Op_StoreD:
 237     return Op_StoreVector;
 238   case Op_MulAddS2I:
 239     return Op_MulAddVS2VI;
 240   case Op_ConvI2F:
 241     return Op_VectorCastI2X;
 242   case Op_ConvL2D:
 243     return Op_VectorCastL2X;
 244   case Op_ConvF2I:
 245     return Op_VectorCastF2X;
 246   case Op_ConvD2L:
 247     return Op_VectorCastD2X;






 248 
 249   default:
 250     return 0; // Unimplemented
 251   }
 252 }
 253 
 254 int VectorNode::replicate_opcode(BasicType bt) {
 255   switch(bt) {
 256     case T_BOOLEAN:
 257     case T_BYTE:
 258       return Op_ReplicateB;
 259     case T_SHORT:
 260     case T_CHAR:
 261       return Op_ReplicateS;
 262     case T_INT:
 263       return Op_ReplicateI;
 264     case T_LONG:
 265       return Op_ReplicateL;
 266     case T_FLOAT:
 267       return Op_ReplicateF;

 296 
 297 bool VectorNode::is_type_transition_short_to_int(Node* n) {
 298   switch (n->Opcode()) {
 299   case Op_MulAddS2I:
 300     return true;
 301   }
 302   return false;
 303 }
 304 
 305 bool VectorNode::is_type_transition_to_int(Node* n) {
 306   return is_type_transition_short_to_int(n);
 307 }
 308 
 309 bool VectorNode::is_muladds2i(Node* n) {
 310   if (n->Opcode() == Op_MulAddS2I) {
 311     return true;
 312   }
 313   return false;
 314 }
 315 
 316 bool VectorNode::is_vpopcnt_long(Node* n) {
 317   if (n->Opcode() == Op_PopCountL) {
 318     return true;





 319   }
 320   return false;
 321 }
 322 
 323 
 324 
 325 
 326 bool VectorNode::is_roundopD(Node* n) {
 327   if (n->Opcode() == Op_RoundDoubleMode) {
 328     return true;
 329   }
 330   return false;
 331 }
 332 
 333 bool VectorNode::is_vector_rotate_supported(int vopc, uint vlen, BasicType bt) {
 334   assert(VectorNode::is_vector_rotate(vopc), "wrong opcode");
 335 
 336   // If target defines vector rotation patterns then no
 337   // need for degeneration.
 338   if (Matcher::match_rule_supported_vector(vopc, vlen, bt)) {
 339     return true;
 340   }
 341 
 342   // If target does not support variable shift operations then no point
 343   // in creating a rotate vector node since it will not be disintegratable.
 344   // Adding a pessimistic check to avoid complex pattern matching which
 345   // may not be full proof.

 569   case Op_MulVD: return new MulVDNode(n1, n2, vt);
 570 
 571   case Op_DivVF: return new DivVFNode(n1, n2, vt);
 572   case Op_DivVD: return new DivVDNode(n1, n2, vt);
 573 
 574   case Op_MinV: return new MinVNode(n1, n2, vt);
 575   case Op_MaxV: return new MaxVNode(n1, n2, vt);
 576 
 577   case Op_AbsVF: return new AbsVFNode(n1, vt);
 578   case Op_AbsVD: return new AbsVDNode(n1, vt);
 579   case Op_AbsVB: return new AbsVBNode(n1, vt);
 580   case Op_AbsVS: return new AbsVSNode(n1, vt);
 581   case Op_AbsVI: return new AbsVINode(n1, vt);
 582   case Op_AbsVL: return new AbsVLNode(n1, vt);
 583 
 584   case Op_NegVI: return new NegVINode(n1, vt);
 585   case Op_NegVL: return new NegVLNode(n1, vt);
 586   case Op_NegVF: return new NegVFNode(n1, vt);
 587   case Op_NegVD: return new NegVDNode(n1, vt);
 588 



 589   case Op_SqrtVF: return new SqrtVFNode(n1, vt);
 590   case Op_SqrtVD: return new SqrtVDNode(n1, vt);
 591 
 592   case Op_RoundVF: return new RoundVFNode(n1, vt);
 593   case Op_RoundVD: return new RoundVDNode(n1, vt);
 594 
 595   case Op_PopCountVI: return new PopCountVINode(n1, vt);
 596   case Op_PopCountVL: return new PopCountVLNode(n1, vt);
 597   case Op_RotateLeftV: return new RotateLeftVNode(n1, n2, vt);
 598   case Op_RotateRightV: return new RotateRightVNode(n1, n2, vt);
 599 
 600   case Op_LShiftVB: return new LShiftVBNode(n1, n2, vt, is_var_shift);
 601   case Op_LShiftVS: return new LShiftVSNode(n1, n2, vt, is_var_shift);
 602   case Op_LShiftVI: return new LShiftVINode(n1, n2, vt, is_var_shift);
 603   case Op_LShiftVL: return new LShiftVLNode(n1, n2, vt, is_var_shift);
 604 
 605   case Op_RShiftVB: return new RShiftVBNode(n1, n2, vt, is_var_shift);
 606   case Op_RShiftVS: return new RShiftVSNode(n1, n2, vt, is_var_shift);
 607   case Op_RShiftVI: return new RShiftVINode(n1, n2, vt, is_var_shift);
 608   case Op_RShiftVL: return new RShiftVLNode(n1, n2, vt, is_var_shift);
 609 
 610   case Op_URShiftVB: return new URShiftVBNode(n1, n2, vt, is_var_shift);
 611   case Op_URShiftVS: return new URShiftVSNode(n1, n2, vt, is_var_shift);
 612   case Op_URShiftVI: return new URShiftVINode(n1, n2, vt, is_var_shift);
 613   case Op_URShiftVL: return new URShiftVLNode(n1, n2, vt, is_var_shift);
 614 
 615   case Op_AndV: return new AndVNode(n1, n2, vt);
 616   case Op_OrV:  return new OrVNode (n1, n2, vt);
 617   case Op_XorV: return new XorVNode(n1, n2, vt);
 618 
 619   case Op_RoundDoubleModeV: return new RoundDoubleModeVNode(n1, n2, vt);
 620 
 621   case Op_MulAddVS2VI: return new MulAddVS2VINode(n1, n2, vt);






 622   default:
 623     fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
 624     return NULL;
 625   }
 626 }
 627 
 628 // Return the vector version of a scalar binary operation node.
 629 VectorNode* VectorNode::make(int opc, Node* n1, Node* n2, uint vlen, BasicType bt, bool is_var_shift) {
 630   const TypeVect* vt = TypeVect::make(bt, vlen);
 631   int vopc = VectorNode::opcode(opc, bt);
 632   // This method should not be called for unimplemented vectors.
 633   guarantee(vopc > 0, "Vector for '%s' is not implemented", NodeClassNames[opc]);
 634   return make(vopc, n1, n2, vt, false, is_var_shift);
 635 }
 636 
 637 // Make a vector node for ternary operation
 638 VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, Node* n3, const TypeVect* vt) {
 639   // This method should not be called for unimplemented vectors.
 640   guarantee(vopc > 0, "vopc must be > 0");
 641   switch (vopc) {

 145     return (bt == T_LONG ? Op_NegVL : 0);
 146   case Op_NegF:
 147     return (bt == T_FLOAT ? Op_NegVF : 0);
 148   case Op_NegD:
 149     return (bt == T_DOUBLE ? Op_NegVD : 0);
 150   case Op_RoundDoubleMode:
 151     return (bt == T_DOUBLE ? Op_RoundDoubleModeV : 0);
 152   case Op_RotateLeft:
 153     return (is_integral_type(bt) ? Op_RotateLeftV : 0);
 154   case Op_RotateRight:
 155     return (is_integral_type(bt) ? Op_RotateRightV : 0);
 156   case Op_SqrtF:
 157     return (bt == T_FLOAT ? Op_SqrtVF : 0);
 158   case Op_SqrtD:
 159     return (bt == T_DOUBLE ? Op_SqrtVD : 0);
 160   case Op_RoundF:
 161     return (bt == T_INT ? Op_RoundVF : 0);
 162   case Op_RoundD:
 163     return (bt == T_LONG ? Op_RoundVD : 0);
 164   case Op_PopCountI:
 165     return Op_PopCountVI;


 166   case Op_PopCountL:
 167     return Op_PopCountVL;
 168   case Op_ReverseI:
 169   case Op_ReverseL:
 170     return (is_integral_type(bt) ? Op_ReverseV : 0);
 171   case Op_ReverseBytesS:
 172   case Op_ReverseBytesI:
 173   case Op_ReverseBytesL:
 174     return (is_integral_type(bt) ? Op_ReverseBytesV : 0);
 175   case Op_CompressBits:
 176     // Not implemented. Returning 0 temporarily
 177     return 0;
 178   case Op_ExpandBits:
 179     // Not implemented. Returning 0 temporarily
 180     return 0;
 181   case Op_LShiftI:
 182     switch (bt) {
 183     case T_BOOLEAN:
 184     case T_BYTE:   return Op_LShiftVB;
 185     case T_CHAR:
 186     case T_SHORT:  return Op_LShiftVS;
 187     case T_INT:    return Op_LShiftVI;
 188     default:       return 0;
 189     }
 190   case Op_LShiftL:
 191     return (bt == T_LONG ? Op_LShiftVL : 0);
 192   case Op_RShiftI:
 193     switch (bt) {
 194     case T_BOOLEAN:return Op_URShiftVB; // boolean is unsigned value
 195     case T_CHAR:   return Op_URShiftVS; // char is unsigned value
 196     case T_BYTE:   return Op_RShiftVB;
 197     case T_SHORT:  return Op_RShiftVS;
 198     case T_INT:    return Op_RShiftVI;
 199     default:       return 0;
 200     }

 239   case Op_LoadD:
 240     return Op_LoadVector;
 241 
 242   case Op_StoreB:
 243   case Op_StoreC:
 244   case Op_StoreI:
 245   case Op_StoreL:
 246   case Op_StoreF:
 247   case Op_StoreD:
 248     return Op_StoreVector;
 249   case Op_MulAddS2I:
 250     return Op_MulAddVS2VI;
 251   case Op_ConvI2F:
 252     return Op_VectorCastI2X;
 253   case Op_ConvL2D:
 254     return Op_VectorCastL2X;
 255   case Op_ConvF2I:
 256     return Op_VectorCastF2X;
 257   case Op_ConvD2L:
 258     return Op_VectorCastD2X;
 259   case Op_CountLeadingZerosI:
 260   case Op_CountLeadingZerosL:
 261     return Op_CountLeadingZerosV;
 262   case Op_CountTrailingZerosI:
 263   case Op_CountTrailingZerosL:
 264     return Op_CountTrailingZerosV;
 265 
 266   default:
 267     return 0; // Unimplemented
 268   }
 269 }
 270 
 271 int VectorNode::replicate_opcode(BasicType bt) {
 272   switch(bt) {
 273     case T_BOOLEAN:
 274     case T_BYTE:
 275       return Op_ReplicateB;
 276     case T_SHORT:
 277     case T_CHAR:
 278       return Op_ReplicateS;
 279     case T_INT:
 280       return Op_ReplicateI;
 281     case T_LONG:
 282       return Op_ReplicateL;
 283     case T_FLOAT:
 284       return Op_ReplicateF;

 313 
 314 bool VectorNode::is_type_transition_short_to_int(Node* n) {
 315   switch (n->Opcode()) {
 316   case Op_MulAddS2I:
 317     return true;
 318   }
 319   return false;
 320 }
 321 
 322 bool VectorNode::is_type_transition_to_int(Node* n) {
 323   return is_type_transition_short_to_int(n);
 324 }
 325 
 326 bool VectorNode::is_muladds2i(Node* n) {
 327   if (n->Opcode() == Op_MulAddS2I) {
 328     return true;
 329   }
 330   return false;
 331 }
 332 
 333 bool VectorNode::is_type_transition_long_to_int(Node* n) {
 334   switch(n->Opcode()) {
 335     case Op_PopCountL:
 336     case Op_CountLeadingZerosL:
 337     case Op_CountTrailingZerosL:
 338        return true;
 339     default:
 340        return false;
 341   }

 342 }
 343 



 344 bool VectorNode::is_roundopD(Node* n) {
 345   if (n->Opcode() == Op_RoundDoubleMode) {
 346     return true;
 347   }
 348   return false;
 349 }
 350 
 351 bool VectorNode::is_vector_rotate_supported(int vopc, uint vlen, BasicType bt) {
 352   assert(VectorNode::is_vector_rotate(vopc), "wrong opcode");
 353 
 354   // If target defines vector rotation patterns then no
 355   // need for degeneration.
 356   if (Matcher::match_rule_supported_vector(vopc, vlen, bt)) {
 357     return true;
 358   }
 359 
 360   // If target does not support variable shift operations then no point
 361   // in creating a rotate vector node since it will not be disintegratable.
 362   // Adding a pessimistic check to avoid complex pattern matching which
 363   // may not be full proof.

 587   case Op_MulVD: return new MulVDNode(n1, n2, vt);
 588 
 589   case Op_DivVF: return new DivVFNode(n1, n2, vt);
 590   case Op_DivVD: return new DivVDNode(n1, n2, vt);
 591 
 592   case Op_MinV: return new MinVNode(n1, n2, vt);
 593   case Op_MaxV: return new MaxVNode(n1, n2, vt);
 594 
 595   case Op_AbsVF: return new AbsVFNode(n1, vt);
 596   case Op_AbsVD: return new AbsVDNode(n1, vt);
 597   case Op_AbsVB: return new AbsVBNode(n1, vt);
 598   case Op_AbsVS: return new AbsVSNode(n1, vt);
 599   case Op_AbsVI: return new AbsVINode(n1, vt);
 600   case Op_AbsVL: return new AbsVLNode(n1, vt);
 601 
 602   case Op_NegVI: return new NegVINode(n1, vt);
 603   case Op_NegVL: return new NegVLNode(n1, vt);
 604   case Op_NegVF: return new NegVFNode(n1, vt);
 605   case Op_NegVD: return new NegVDNode(n1, vt);
 606 
 607   case Op_ReverseV: return new ReverseVNode(n1, vt);
 608   case Op_ReverseBytesV: return new ReverseBytesVNode(n1, vt);
 609 
 610   case Op_SqrtVF: return new SqrtVFNode(n1, vt);
 611   case Op_SqrtVD: return new SqrtVDNode(n1, vt);
 612 
 613   case Op_RoundVF: return new RoundVFNode(n1, vt);
 614   case Op_RoundVD: return new RoundVDNode(n1, vt);
 615 
 616   case Op_PopCountVI: return new PopCountVINode(n1, vt);
 617   case Op_PopCountVL: return new PopCountVLNode(n1, vt);
 618   case Op_RotateLeftV: return new RotateLeftVNode(n1, n2, vt);
 619   case Op_RotateRightV: return new RotateRightVNode(n1, n2, vt);
 620 
 621   case Op_LShiftVB: return new LShiftVBNode(n1, n2, vt, is_var_shift);
 622   case Op_LShiftVS: return new LShiftVSNode(n1, n2, vt, is_var_shift);
 623   case Op_LShiftVI: return new LShiftVINode(n1, n2, vt, is_var_shift);
 624   case Op_LShiftVL: return new LShiftVLNode(n1, n2, vt, is_var_shift);
 625 
 626   case Op_RShiftVB: return new RShiftVBNode(n1, n2, vt, is_var_shift);
 627   case Op_RShiftVS: return new RShiftVSNode(n1, n2, vt, is_var_shift);
 628   case Op_RShiftVI: return new RShiftVINode(n1, n2, vt, is_var_shift);
 629   case Op_RShiftVL: return new RShiftVLNode(n1, n2, vt, is_var_shift);
 630 
 631   case Op_URShiftVB: return new URShiftVBNode(n1, n2, vt, is_var_shift);
 632   case Op_URShiftVS: return new URShiftVSNode(n1, n2, vt, is_var_shift);
 633   case Op_URShiftVI: return new URShiftVINode(n1, n2, vt, is_var_shift);
 634   case Op_URShiftVL: return new URShiftVLNode(n1, n2, vt, is_var_shift);
 635 
 636   case Op_AndV: return new AndVNode(n1, n2, vt);
 637   case Op_OrV:  return new OrVNode (n1, n2, vt);
 638   case Op_XorV: return new XorVNode(n1, n2, vt);
 639 
 640   case Op_RoundDoubleModeV: return new RoundDoubleModeVNode(n1, n2, vt);
 641 
 642   case Op_MulAddVS2VI: return new MulAddVS2VINode(n1, n2, vt);
 643 
 644   case Op_ExpandV: return new ExpandVNode(n1, n2, vt);
 645   case Op_CompressV: return new CompressVNode(n1, n2, vt);
 646   case Op_CompressM: assert(n1 == NULL, ""); return new CompressMNode(n2, vt);
 647   case Op_CountLeadingZerosV: return new CountLeadingZerosVNode(n1, vt);
 648   case Op_CountTrailingZerosV: return new CountTrailingZerosVNode(n1, vt);
 649   default:
 650     fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
 651     return NULL;
 652   }
 653 }
 654 
 655 // Return the vector version of a scalar binary operation node.
 656 VectorNode* VectorNode::make(int opc, Node* n1, Node* n2, uint vlen, BasicType bt, bool is_var_shift) {
 657   const TypeVect* vt = TypeVect::make(bt, vlen);
 658   int vopc = VectorNode::opcode(opc, bt);
 659   // This method should not be called for unimplemented vectors.
 660   guarantee(vopc > 0, "Vector for '%s' is not implemented", NodeClassNames[opc]);
 661   return make(vopc, n1, n2, vt, false, is_var_shift);
 662 }
 663 
 664 // Make a vector node for ternary operation
 665 VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, Node* n3, const TypeVect* vt) {
 666   // This method should not be called for unimplemented vectors.
 667   guarantee(vopc > 0, "vopc must be > 0");
 668   switch (vopc) {
< prev index next >