< prev index next >

src/hotspot/share/opto/vectornode.hpp

Print this page

  49     init_class_id(Class_Vector);
  50     init_req(1, n1);
  51     init_req(2, n2);
  52     init_req(3, n3);
  53   }
  54 
  55   VectorNode(Node *n0, Node* n1, Node* n2, Node* n3, const TypeVect* vt) : TypeNode(vt, 5) {
  56     init_class_id(Class_Vector);
  57     init_req(1, n0);
  58     init_req(2, n1);
  59     init_req(3, n2);
  60     init_req(4, n3);
  61   }
  62 
  63   const TypeVect* vect_type() const { return type()->is_vect(); }
  64   uint length() const { return vect_type()->length(); } // Vector length
  65   uint length_in_bytes() const { return vect_type()->length_in_bytes(); }
  66 
  67   virtual int Opcode() const;
  68 
  69   virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(vect_type()->length_in_bytes()); }


  70 
  71   static VectorNode* scalar2vector(Node* s, uint vlen, const Type* opd_t);
  72   static VectorNode* shift_count(int opc, Node* cnt, uint vlen, BasicType bt);
  73   static VectorNode* make(int opc, Node* n1, Node* n2, uint vlen, BasicType bt);
  74   static VectorNode* make(int vopc, Node* n1, Node* n2, const TypeVect* vt);
  75   static VectorNode* make(int opc, Node* n1, Node* n2, Node* n3, uint vlen, BasicType bt);
  76   static VectorNode* make(int vopc, Node* n1, Node* n2, Node* n3, const TypeVect* vt);

  77 
  78   static bool is_shift_opcode(int opc);



  79   static bool is_rotate_opcode(int opc);
  80 
  81   static int  opcode(int opc, BasicType bt);
  82   static int replicate_opcode(BasicType bt);
  83   static bool implemented(int opc, uint vlen, BasicType bt);
  84   static bool is_shift(Node* n);
  85   static bool is_vshift_cnt(Node* n);
  86   static bool is_type_transition_short_to_int(Node* n);
  87   static bool is_type_transition_to_int(Node* n);
  88   static bool is_muladds2i(Node* n);
  89   static bool is_roundopD(Node* n);
  90   static bool is_scalar_rotate(Node* n);
  91   static bool is_vector_rotate_supported(int opc, uint vlen, BasicType bt);
  92   static bool is_invariant_vector(Node* n);
  93   static bool is_all_ones_vector(Node* n);
  94   static bool is_vector_bitwise_not_pattern(Node* n);
  95   static Node* degenerate_vector_rotate(Node* n1, Node* n2, bool is_rotate_left, int vlen,
  96                                         BasicType bt, PhaseGVN* phase);
  97 
  98   // [Start, end) half-open range defining which operands are vectors

 781   uint element_size(void) { return type2aelembytes(vect_type()->element_basic_type()); }
 782 
 783   // Needed for proper cloning.
 784   virtual uint size_of() const { return sizeof(*this); }
 785 };
 786 
 787 //------------------------------StoreVectorScatterNode------------------------------
 788 // Store Vector into memory via index map
 789 
 790  class StoreVectorScatterNode : public StoreVectorNode {
 791   public:
 792    StoreVectorScatterNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val, Node* indices)
 793      : StoreVectorNode(c, mem, adr, at, val) {
 794      init_class_id(Class_StoreVectorScatter);
 795      assert(indices->bottom_type()->is_vect(), "indices must be in vector");
 796      add_req(indices);
 797      assert(req() == MemNode::ValueIn + 2, "match_edge expects that last input is in MemNode::ValueIn+1");
 798    }
 799    virtual int Opcode() const;
 800    virtual uint match_edge(uint idx) const { return idx == MemNode::Address ||
 801                                                      idx == MemNode::ValueIn ||
 802                                                      idx == MemNode::ValueIn + 1; }
 803 };
 804 
 805 //------------------------------StoreVectorMaskedNode--------------------------------
 806 // Store Vector to memory under the influence of a predicate register(mask).
 807 class StoreVectorMaskedNode : public StoreVectorNode {
 808  public:
 809   StoreVectorMaskedNode(Node* c, Node* mem, Node* dst, Node* src, const TypePtr* at, Node* mask)
 810    : StoreVectorNode(c, mem, dst, at, src) {
 811     assert(mask->bottom_type()->is_vectmask(), "sanity");
 812     init_class_id(Class_StoreVector);
 813     set_mismatched_access();
 814     add_req(mask);
 815   }
 816 
 817   virtual int Opcode() const;
 818 
 819   virtual uint match_edge(uint idx) const {
 820     return idx > 1;
 821   }
 822   Node* Ideal(PhaseGVN* phase, bool can_reshape);
 823 };
 824 
 825 //------------------------------LoadVectorMaskedNode--------------------------------
 826 // Load Vector from memory under the influence of a predicate register(mask).
 827 class LoadVectorMaskedNode : public LoadVectorNode {
 828  public:
 829   LoadVectorMaskedNode(Node* c, Node* mem, Node* src, const TypePtr* at, const TypeVect* vt, Node* mask)
 830    : LoadVectorNode(c, mem, src, at, vt) {
 831     assert(mask->bottom_type()->is_vectmask(), "sanity");
 832     init_class_id(Class_LoadVector);
 833     set_mismatched_access();
 834     add_req(mask);
 835   }
 836 
 837   virtual int Opcode() const;
 838 
 839   virtual uint match_edge(uint idx) const {
 840     return idx > 1;
 841   }
 842   Node* Ideal(PhaseGVN* phase, bool can_reshape);
 843 };
 844 







































 845 
 846 //------------------------------VectorCmpMaskedNode--------------------------------
 847 // Vector Comparison under the influence of a predicate register(mask).
 848 class VectorCmpMaskedNode : public TypeNode {
 849   public:
 850    VectorCmpMaskedNode(Node* src1, Node* src2, Node* mask, const Type* ty): TypeNode(ty, 4)  {
 851      init_req(1, src1);
 852      init_req(2, src2);
 853      init_req(3, mask);
 854    }
 855 
 856   virtual int Opcode() const;
 857 };
 858 
 859 
 860 class VectorMaskGenNode : public TypeNode {
 861  public:
 862   VectorMaskGenNode(Node* length, const Type* ty, BasicType ety): TypeNode(ty, 2), _elemType(ety) {
 863     init_req(1, length);
 864   }
 865 
 866   virtual int Opcode() const;
 867   BasicType get_elem_type()  { return _elemType;}
 868   virtual  uint  size_of() const { return sizeof(VectorMaskGenNode); }
 869   virtual uint  ideal_reg() const {
 870     return Op_RegVectMask;
 871   }
 872 
 873   private:
 874    BasicType _elemType;
 875 };
 876 
 877 class VectorMaskOpNode : public TypeNode {
 878  public:
 879   VectorMaskOpNode(Node* mask, const Type* ty, int mopc):
 880     TypeNode(ty, 2), _mopc(mopc) {
 881     assert(mask->bottom_type()->is_vect()->element_basic_type() == T_BOOLEAN, "");
 882     init_req(1, mask);
 883   }
 884 
 885   virtual int Opcode() const;
 886   virtual  uint  size_of() const { return sizeof(VectorMaskOpNode); }
 887   virtual uint  ideal_reg() const { return Op_RegI; }
 888   int get_mask_Opcode() const { return _mopc;}
 889   static Node* make(Node* mask, const Type* ty, int mopc);
 890 
 891   private:
 892     int _mopc;
 893 };
 894 
 895 class VectorMaskTrueCountNode : public VectorMaskOpNode {
 896  public:
 897   VectorMaskTrueCountNode(Node* mask, const Type* ty):
 898     VectorMaskOpNode(mask, ty, Op_VectorMaskTrueCount) {}
 899   virtual int Opcode() const;
 900 };
 901 
 902 class VectorMaskFirstTrueNode : public VectorMaskOpNode {
 903  public:
 904   VectorMaskFirstTrueNode(Node* mask, const Type* ty):
 905     VectorMaskOpNode(mask, ty, Op_VectorMaskFirstTrue) {}
 906   virtual int Opcode() const;
 907 };
 908 
 909 class VectorMaskLastTrueNode : public VectorMaskOpNode {
 910  public:
 911   VectorMaskLastTrueNode(Node* mask, const Type* ty):
 912     VectorMaskOpNode(mask, ty, Op_VectorMaskLastTrue) {}
 913   virtual int Opcode() const;
 914 };
 915 




































 916 //=========================Promote_Scalar_to_Vector============================
 917 
 918 //------------------------------ReplicateBNode---------------------------------
 919 // Replicate byte scalar to be vector
 920 class ReplicateBNode : public VectorNode {
 921  public:
 922   ReplicateBNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
 923   virtual int Opcode() const;
 924 };
 925 
 926 //------------------------------ReplicateSNode---------------------------------
 927 // Replicate short scalar to be vector
 928 class ReplicateSNode : public VectorNode {
 929  public:
 930   ReplicateSNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
 931   virtual int Opcode() const;
 932 };
 933 
 934 //------------------------------ReplicateINode---------------------------------
 935 // Replicate int scalar to be vector

1167 };
1168 
1169 //------------------------------MacroLogicVNode-------------------------------
1170 // Vector logical operations packing node.
1171 class MacroLogicVNode : public VectorNode {
1172 private:
1173   MacroLogicVNode(Node* in1, Node* in2, Node* in3, Node* fn, const TypeVect* vt)
1174   : VectorNode(in1, in2, in3, fn, vt) {}
1175 
1176 public:
1177   virtual int Opcode() const;
1178 
1179   static MacroLogicVNode* make(PhaseGVN& igvn, Node* in1, Node* in2, Node* in3, uint truth_table, const TypeVect* vt);
1180 };
1181 
1182 class VectorMaskCmpNode : public VectorNode {
1183  private:
1184   BoolTest::mask _predicate;
1185 
1186  protected:
1187   uint size_of() const { return sizeof(*this); }
1188 
1189  public:
1190   VectorMaskCmpNode(BoolTest::mask predicate, Node* in1, Node* in2, ConINode* predicate_node, const TypeVect* vt) :
1191       VectorNode(in1, in2, predicate_node, vt),
1192       _predicate(predicate) {
1193     assert(in1->bottom_type()->is_vect()->element_basic_type() == in2->bottom_type()->is_vect()->element_basic_type(),
1194            "VectorMaskCmp inputs must have same type for elements");
1195     assert(in1->bottom_type()->is_vect()->length() == in2->bottom_type()->is_vect()->length(),
1196            "VectorMaskCmp inputs must have same number of elements");

1197     init_class_id(Class_VectorMaskCmp);
1198   }
1199 
1200   virtual int Opcode() const;
1201   virtual uint hash() const { return VectorNode::hash() + _predicate; }
1202   virtual bool cmp( const Node &n ) const {
1203     return VectorNode::cmp(n) && _predicate == ((VectorMaskCmpNode&)n)._predicate;
1204   }
1205   BoolTest::mask get_predicate() { return _predicate; }
1206 #ifndef PRODUCT
1207   virtual void dump_spec(outputStream *st) const;
1208 #endif // !PRODUCT
1209 };
1210 
1211 // Used to wrap other vector nodes in order to add masking functionality.
1212 class VectorMaskWrapperNode : public VectorNode {
1213  public:
1214   VectorMaskWrapperNode(Node* vector, Node* mask)
1215     : VectorNode(vector, mask, vector->bottom_type()->is_vect()) {
1216     assert(mask->is_VectorMaskCmp(), "VectorMaskWrapper requires that second argument be a mask");

1288   virtual int Opcode() const;
1289   virtual Node* Identity(PhaseGVN* phase);
1290 };
1291 
1292 class VectorStoreMaskNode : public VectorNode {
1293  protected:
1294   VectorStoreMaskNode(Node* in1, ConINode* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {}
1295 
1296  public:
1297   virtual int Opcode() const;
1298   virtual Node* Identity(PhaseGVN* phase);
1299 
1300   static VectorStoreMaskNode* make(PhaseGVN& gvn, Node* in, BasicType in_type, uint num_elem);
1301 };
1302 
1303 class VectorMaskCastNode : public VectorNode {
1304  public:
1305   VectorMaskCastNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) {
1306     const TypeVect* in_vt = in->bottom_type()->is_vect();
1307     assert(in_vt->length() == vt->length(), "vector length must match");
1308     assert(type2aelembytes(in_vt->element_basic_type()) == type2aelembytes(vt->element_basic_type()), "element size must match");
1309   }
1310 
1311   virtual int Opcode() const;
1312 };
1313 
1314 // This is intended for use as a simple reinterpret node that has no cast.
1315 class VectorReinterpretNode : public VectorNode {
1316  private:
1317   const TypeVect* _src_vt;

1318  protected:
1319   uint size_of() const { return sizeof(*this); }
1320  public:
1321   VectorReinterpretNode(Node* in, const TypeVect* src_vt, const TypeVect* dst_vt)
1322       : VectorNode(in, dst_vt), _src_vt(src_vt) { }





1323 

1324   virtual uint hash() const { return VectorNode::hash() + _src_vt->hash(); }
1325   virtual bool cmp( const Node &n ) const {
1326     return VectorNode::cmp(n) && !Type::cmp(_src_vt,((VectorReinterpretNode&)n)._src_vt);
1327   }
1328   virtual Node* Identity(PhaseGVN* phase);
1329 
1330   virtual int Opcode() const;
1331 };
1332 
1333 class VectorCastNode : public VectorNode {
1334  public:
1335   VectorCastNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) {}
1336   virtual int Opcode() const;
1337 
1338   static VectorCastNode* make(int vopc, Node* n1, BasicType bt, uint vlen);
1339   static int  opcode(BasicType bt);
1340   static bool implemented(BasicType bt, uint vlen);
1341 
1342   virtual Node* Identity(PhaseGVN* phase);
1343 };

1436     : CallStaticJavaNode(C, VectorBoxNode::vec_box_type(vbox_type), NULL, NULL) {
1437     init_flags(Flag_is_macro);
1438     C->add_macro_node(this);
1439   }
1440 
1441   virtual int Opcode() const;
1442 #ifndef PRODUCT
1443   virtual void dump_spec(outputStream *st) const;
1444 #endif // !PRODUCT
1445 };
1446 
1447 class VectorUnboxNode : public VectorNode {
1448  private:
1449   bool _shuffle_to_vector;
1450  protected:
1451   uint size_of() const { return sizeof(*this); }
1452  public:
1453   VectorUnboxNode(Compile* C, const TypeVect* vec_type, Node* obj, Node* mem, bool shuffle_to_vector)
1454     : VectorNode(mem, obj, vec_type) {
1455     _shuffle_to_vector = shuffle_to_vector;

1456     init_flags(Flag_is_macro);
1457     C->add_macro_node(this);
1458   }
1459 
1460   virtual int Opcode() const;
1461   Node* obj() const { return in(2); }
1462   Node* mem() const { return in(1); }
1463   virtual Node* Identity(PhaseGVN* phase);
1464   Node* Ideal(PhaseGVN* phase, bool can_reshape);
1465   bool is_shuffle_to_vector() { return _shuffle_to_vector; }
1466 };
1467 
1468 class RotateRightVNode : public VectorNode {
1469 public:
1470   RotateRightVNode(Node* in1, Node* in2, const TypeVect* vt)
1471   : VectorNode(in1, in2, vt) {}
1472 
1473   virtual int Opcode() const;
1474   Node* Ideal(PhaseGVN* phase, bool can_reshape);
1475 };
1476 
1477 class RotateLeftVNode : public VectorNode {
1478 public:
1479   RotateLeftVNode(Node* in1, Node* in2, const TypeVect* vt)
1480   : VectorNode(in1, in2, vt) {}
1481 
1482   virtual int Opcode() const;
1483   Node* Ideal(PhaseGVN* phase, bool can_reshape);
1484 };
1485 
1486 #endif // SHARE_OPTO_VECTORNODE_HPP

  49     init_class_id(Class_Vector);
  50     init_req(1, n1);
  51     init_req(2, n2);
  52     init_req(3, n3);
  53   }
  54 
  55   VectorNode(Node *n0, Node* n1, Node* n2, Node* n3, const TypeVect* vt) : TypeNode(vt, 5) {
  56     init_class_id(Class_Vector);
  57     init_req(1, n0);
  58     init_req(2, n1);
  59     init_req(3, n2);
  60     init_req(4, n3);
  61   }
  62 
  63   const TypeVect* vect_type() const { return type()->is_vect(); }
  64   uint length() const { return vect_type()->length(); } // Vector length
  65   uint length_in_bytes() const { return vect_type()->length_in_bytes(); }
  66 
  67   virtual int Opcode() const;
  68 
  69   virtual uint ideal_reg() const {
  70     return type()->ideal_reg();
  71   }
  72 
  73   static VectorNode* scalar2vector(Node* s, uint vlen, const Type* opd_t, bool is_mask = false);
  74   static VectorNode* shift_count(int opc, Node* cnt, uint vlen, BasicType bt);
  75   static VectorNode* make(int opc, Node* n1, Node* n2, uint vlen, BasicType bt);
  76   static VectorNode* make(int vopc, Node* n1, Node* n2, const TypeVect* vt, bool is_mask = false);
  77   static VectorNode* make(int opc, Node* n1, Node* n2, Node* n3, uint vlen, BasicType bt);
  78   static VectorNode* make(int vopc, Node* n1, Node* n2, Node* n3, const TypeVect* vt);
  79   static VectorNode* make_mask_node(int vopc, Node* n1, Node* n2, uint vlen, BasicType bt);
  80 
  81   static bool is_shift_opcode(int opc);
  82 
  83   static bool is_vshift_cnt_opcode(int opc);
  84 
  85   static bool is_rotate_opcode(int opc);
  86 
  87   static int  opcode(int opc, BasicType bt);
  88   static int replicate_opcode(BasicType bt);
  89   static bool implemented(int opc, uint vlen, BasicType bt);
  90   static bool is_shift(Node* n);
  91   static bool is_vshift_cnt(Node* n);
  92   static bool is_type_transition_short_to_int(Node* n);
  93   static bool is_type_transition_to_int(Node* n);
  94   static bool is_muladds2i(Node* n);
  95   static bool is_roundopD(Node* n);
  96   static bool is_scalar_rotate(Node* n);
  97   static bool is_vector_rotate_supported(int opc, uint vlen, BasicType bt);
  98   static bool is_invariant_vector(Node* n);
  99   static bool is_all_ones_vector(Node* n);
 100   static bool is_vector_bitwise_not_pattern(Node* n);
 101   static Node* degenerate_vector_rotate(Node* n1, Node* n2, bool is_rotate_left, int vlen,
 102                                         BasicType bt, PhaseGVN* phase);
 103 
 104   // [Start, end) half-open range defining which operands are vectors

 787   uint element_size(void) { return type2aelembytes(vect_type()->element_basic_type()); }
 788 
 789   // Needed for proper cloning.
 790   virtual uint size_of() const { return sizeof(*this); }
 791 };
 792 
 793 //------------------------------StoreVectorScatterNode------------------------------
 794 // Store Vector into memory via index map
 795 
 796  class StoreVectorScatterNode : public StoreVectorNode {
 797   public:
 798    StoreVectorScatterNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val, Node* indices)
 799      : StoreVectorNode(c, mem, adr, at, val) {
 800      init_class_id(Class_StoreVectorScatter);
 801      assert(indices->bottom_type()->is_vect(), "indices must be in vector");
 802      add_req(indices);
 803      assert(req() == MemNode::ValueIn + 2, "match_edge expects that last input is in MemNode::ValueIn+1");
 804    }
 805    virtual int Opcode() const;
 806    virtual uint match_edge(uint idx) const { return idx == MemNode::Address ||
 807                                                     idx == MemNode::ValueIn ||
 808                                                     idx == MemNode::ValueIn + 1; }
 809 };
 810 
 811 //------------------------------StoreVectorMaskedNode--------------------------------
 812 // Store Vector to memory under the influence of a predicate register(mask).
 813 class StoreVectorMaskedNode : public StoreVectorNode {
 814  public:
 815   StoreVectorMaskedNode(Node* c, Node* mem, Node* dst, Node* src, const TypePtr* at, Node* mask)
 816    : StoreVectorNode(c, mem, dst, at, src) {
 817     assert(mask->bottom_type()->isa_vectmask(), "sanity");
 818     init_class_id(Class_StoreVector);
 819     set_mismatched_access();
 820     add_req(mask);
 821   }
 822 
 823   virtual int Opcode() const;
 824 
 825   virtual uint match_edge(uint idx) const {
 826     return idx > 1;
 827   }
 828   Node* Ideal(PhaseGVN* phase, bool can_reshape);
 829 };
 830 
 831 //------------------------------LoadVectorMaskedNode--------------------------------
 832 // Load Vector from memory under the influence of a predicate register(mask).
 833 class LoadVectorMaskedNode : public LoadVectorNode {
 834  public:
 835   LoadVectorMaskedNode(Node* c, Node* mem, Node* src, const TypePtr* at, const TypeVect* vt, Node* mask)
 836    : LoadVectorNode(c, mem, src, at, vt) {
 837     assert(mask->bottom_type()->isa_vectmask(), "sanity");
 838     init_class_id(Class_LoadVector);
 839     set_mismatched_access();
 840     add_req(mask);
 841   }
 842 
 843   virtual int Opcode() const;
 844 
 845   virtual uint match_edge(uint idx) const {
 846     return idx > 1;
 847   }
 848   Node* Ideal(PhaseGVN* phase, bool can_reshape);
 849 };
 850 
 851 //-------------------------------LoadVectorGatherMaskedNode---------------------------------
 852 // Load Vector from memory via index map under the influence of a predicate register(mask).
 853 class LoadVectorGatherMaskedNode : public LoadVectorNode {
 854  public:
 855   LoadVectorGatherMaskedNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeVect* vt, Node* indices, Node* mask)
 856     : LoadVectorNode(c, mem, adr, at, vt) {
 857     init_class_id(Class_LoadVector);
 858     assert(indices->bottom_type()->is_vect(), "indices must be in vector");
 859     assert(mask->bottom_type()->isa_vectmask(), "sanity");
 860     add_req(indices);
 861     add_req(mask);
 862     assert(req() == MemNode::ValueIn + 2, "match_edge expects that last input is in MemNode::ValueIn+1");
 863   }
 864 
 865   virtual int Opcode() const;
 866   virtual uint match_edge(uint idx) const { return idx == MemNode::Address ||
 867                                                    idx == MemNode::ValueIn ||
 868                                                    idx == MemNode::ValueIn + 1; }
 869 };
 870 
 871 //------------------------------StoreVectorScatterMaskedNode--------------------------------
 872 // Store Vector into memory via index map under the influence of a predicate register(mask).
 873 class StoreVectorScatterMaskedNode : public StoreVectorNode {
 874   public:
 875    StoreVectorScatterMaskedNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val, Node* indices, Node* mask)
 876      : StoreVectorNode(c, mem, adr, at, val) {
 877      init_class_id(Class_StoreVector);
 878      assert(indices->bottom_type()->is_vect(), "indices must be in vector");
 879      assert(mask->bottom_type()->isa_vectmask(), "sanity");
 880      add_req(indices);
 881      add_req(mask);
 882      assert(req() == MemNode::ValueIn + 3, "match_edge expects that last input is in MemNode::ValueIn+2");
 883    }
 884    virtual int Opcode() const;
 885    virtual uint match_edge(uint idx) const { return idx == MemNode::Address ||
 886                                                     idx == MemNode::ValueIn ||
 887                                                     idx == MemNode::ValueIn + 1 ||
 888                                                     idx == MemNode::ValueIn + 2; }
 889 };
 890 
 891 //------------------------------VectorCmpMaskedNode--------------------------------
 892 // Vector Comparison under the influence of a predicate register(mask).
 893 class VectorCmpMaskedNode : public TypeNode {
 894   public:
 895    VectorCmpMaskedNode(Node* src1, Node* src2, Node* mask, const Type* ty): TypeNode(ty, 4)  {
 896      init_req(1, src1);
 897      init_req(2, src2);
 898      init_req(3, mask);
 899    }
 900 
 901   virtual int Opcode() const;
 902 };
 903 

 904 class VectorMaskGenNode : public TypeNode {
 905  public:
 906   VectorMaskGenNode(Node* length, const Type* ty, BasicType ety): TypeNode(ty, 2), _elemType(ety) {
 907     init_req(1, length);
 908   }
 909 
 910   virtual int Opcode() const;
 911   BasicType get_elem_type()  { return _elemType;}
 912   virtual  uint  size_of() const { return sizeof(VectorMaskGenNode); }
 913   virtual uint  ideal_reg() const {
 914     return Op_RegVectMask;
 915   }
 916 
 917   private:
 918    BasicType _elemType;
 919 };
 920 
 921 class VectorMaskOpNode : public TypeNode {
 922  public:
 923   VectorMaskOpNode(Node* mask, const Type* ty, int mopc):
 924     TypeNode(ty, 2), _mopc(mopc) {
 925     assert(Matcher::has_predicated_vectors() || mask->bottom_type()->is_vect()->element_basic_type() == T_BOOLEAN, "");
 926     init_req(1, mask);
 927   }
 928 
 929   virtual int Opcode() const;
 930   virtual  uint  size_of() const { return sizeof(VectorMaskOpNode); }
 931   virtual uint  ideal_reg() const { return Op_RegI; }
 932   int get_mask_Opcode() const { return _mopc;}
 933   static Node* make(Node* mask, const Type* ty, int mopc);
 934 
 935   private:
 936     int _mopc;
 937 };
 938 
 939 class VectorMaskTrueCountNode : public VectorMaskOpNode {
 940  public:
 941   VectorMaskTrueCountNode(Node* mask, const Type* ty):
 942     VectorMaskOpNode(mask, ty, Op_VectorMaskTrueCount) {}
 943   virtual int Opcode() const;
 944 };
 945 
 946 class VectorMaskFirstTrueNode : public VectorMaskOpNode {
 947  public:
 948   VectorMaskFirstTrueNode(Node* mask, const Type* ty):
 949     VectorMaskOpNode(mask, ty, Op_VectorMaskFirstTrue) {}
 950   virtual int Opcode() const;
 951 };
 952 
 953 class VectorMaskLastTrueNode : public VectorMaskOpNode {
 954  public:
 955   VectorMaskLastTrueNode(Node* mask, const Type* ty):
 956     VectorMaskOpNode(mask, ty, Op_VectorMaskLastTrue) {}
 957   virtual int Opcode() const;
 958 };
 959 
 960 class VectorMaskToLongNode : public VectorMaskOpNode {
 961  public:
 962   VectorMaskToLongNode(Node* mask, const Type* ty):
 963     VectorMaskOpNode(mask, ty, Op_VectorMaskToLong) {}
 964   virtual int Opcode() const;
 965   virtual uint  ideal_reg() const { return Op_RegL; }
 966 };
 967 
 968 //-------------------------- Vector mask broadcast -----------------------------------
 969 class MaskAllNode : public VectorNode {
 970  public:
 971   MaskAllNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) {}
 972   virtual int Opcode() const;
 973 };
 974 
 975 //--------------------------- Vector mask logical and --------------------------------
 976 class AndVMaskNode : public VectorNode {
 977  public:
 978   AndVMaskNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {}
 979   virtual int Opcode() const;
 980 };
 981 
 982 //--------------------------- Vector mask logical or ---------------------------------
 983 class OrVMaskNode : public VectorNode {
 984  public:
 985   OrVMaskNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {}
 986   virtual int Opcode() const;
 987 };
 988 
 989 //--------------------------- Vector mask logical xor --------------------------------
 990 class XorVMaskNode : public VectorNode {
 991  public:
 992   XorVMaskNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {}
 993   virtual int Opcode() const;
 994 };
 995 
 996 //=========================Promote_Scalar_to_Vector============================
 997 
 998 //------------------------------ReplicateBNode---------------------------------
 999 // Replicate byte scalar to be vector
1000 class ReplicateBNode : public VectorNode {
1001  public:
1002   ReplicateBNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
1003   virtual int Opcode() const;
1004 };
1005 
1006 //------------------------------ReplicateSNode---------------------------------
1007 // Replicate short scalar to be vector
1008 class ReplicateSNode : public VectorNode {
1009  public:
1010   ReplicateSNode(Node* in1, const TypeVect* vt) : VectorNode(in1, vt) {}
1011   virtual int Opcode() const;
1012 };
1013 
1014 //------------------------------ReplicateINode---------------------------------
1015 // Replicate int scalar to be vector

1247 };
1248 
1249 //------------------------------MacroLogicVNode-------------------------------
1250 // Vector logical operations packing node.
1251 class MacroLogicVNode : public VectorNode {
1252 private:
1253   MacroLogicVNode(Node* in1, Node* in2, Node* in3, Node* fn, const TypeVect* vt)
1254   : VectorNode(in1, in2, in3, fn, vt) {}
1255 
1256 public:
1257   virtual int Opcode() const;
1258 
1259   static MacroLogicVNode* make(PhaseGVN& igvn, Node* in1, Node* in2, Node* in3, uint truth_table, const TypeVect* vt);
1260 };
1261 
1262 class VectorMaskCmpNode : public VectorNode {
1263  private:
1264   BoolTest::mask _predicate;
1265 
1266  protected:
1267   virtual  uint size_of() const { return sizeof(VectorMaskCmpNode); }
1268 
1269  public:
1270   VectorMaskCmpNode(BoolTest::mask predicate, Node* in1, Node* in2, ConINode* predicate_node, const TypeVect* vt) :
1271       VectorNode(in1, in2, predicate_node, vt),
1272       _predicate(predicate) {
1273     assert(in1->bottom_type()->is_vect()->element_basic_type() == in2->bottom_type()->is_vect()->element_basic_type(),
1274            "VectorMaskCmp inputs must have same type for elements");
1275     assert(in1->bottom_type()->is_vect()->length() == in2->bottom_type()->is_vect()->length(),
1276            "VectorMaskCmp inputs must have same number of elements");
1277     assert((BoolTest::mask)predicate_node->get_int() == predicate, "Unmatched predicates");
1278     init_class_id(Class_VectorMaskCmp);
1279   }
1280 
1281   virtual int Opcode() const;
1282   virtual uint hash() const { return VectorNode::hash() + _predicate; }
1283   virtual bool cmp( const Node &n ) const {
1284     return VectorNode::cmp(n) && _predicate == ((VectorMaskCmpNode&)n)._predicate;
1285   }
1286   BoolTest::mask get_predicate() { return _predicate; }
1287 #ifndef PRODUCT
1288   virtual void dump_spec(outputStream *st) const;
1289 #endif // !PRODUCT
1290 };
1291 
1292 // Used to wrap other vector nodes in order to add masking functionality.
1293 class VectorMaskWrapperNode : public VectorNode {
1294  public:
1295   VectorMaskWrapperNode(Node* vector, Node* mask)
1296     : VectorNode(vector, mask, vector->bottom_type()->is_vect()) {
1297     assert(mask->is_VectorMaskCmp(), "VectorMaskWrapper requires that second argument be a mask");

1369   virtual int Opcode() const;
1370   virtual Node* Identity(PhaseGVN* phase);
1371 };
1372 
1373 class VectorStoreMaskNode : public VectorNode {
1374  protected:
1375   VectorStoreMaskNode(Node* in1, ConINode* in2, const TypeVect* vt) : VectorNode(in1, in2, vt) {}
1376 
1377  public:
1378   virtual int Opcode() const;
1379   virtual Node* Identity(PhaseGVN* phase);
1380 
1381   static VectorStoreMaskNode* make(PhaseGVN& gvn, Node* in, BasicType in_type, uint num_elem);
1382 };
1383 
1384 class VectorMaskCastNode : public VectorNode {
1385  public:
1386   VectorMaskCastNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) {
1387     const TypeVect* in_vt = in->bottom_type()->is_vect();
1388     assert(in_vt->length() == vt->length(), "vector length must match");

1389   }
1390 
1391   virtual int Opcode() const;
1392 };
1393 
1394 // This is intended for use as a simple reinterpret node that has no cast.
1395 class VectorReinterpretNode : public VectorNode {
1396  private:
1397   const TypeVect* _src_vt;
1398 
1399  protected:
1400   uint size_of() const { return sizeof(VectorReinterpretNode); }
1401  public:
1402   VectorReinterpretNode(Node* in, const TypeVect* src_vt, const TypeVect* dst_vt)
1403      : VectorNode(in, dst_vt), _src_vt(src_vt) {
1404      assert((!dst_vt->isa_vectmask() && !src_vt->isa_vectmask()) ||
1405             (type2aelembytes(src_vt->element_basic_type()) >= type2aelembytes(dst_vt->element_basic_type())),
1406             "unsupported mask widening reinterpretation");
1407      init_class_id(Class_VectorReinterpret);
1408   }
1409 
1410   const TypeVect* src_type() { return _src_vt; }
1411   virtual uint hash() const { return VectorNode::hash() + _src_vt->hash(); }
1412   virtual bool cmp( const Node &n ) const {
1413     return VectorNode::cmp(n) && !Type::cmp(_src_vt,((VectorReinterpretNode&)n)._src_vt);
1414   }
1415   virtual Node* Identity(PhaseGVN* phase);
1416 
1417   virtual int Opcode() const;
1418 };
1419 
1420 class VectorCastNode : public VectorNode {
1421  public:
1422   VectorCastNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) {}
1423   virtual int Opcode() const;
1424 
1425   static VectorCastNode* make(int vopc, Node* n1, BasicType bt, uint vlen);
1426   static int  opcode(BasicType bt);
1427   static bool implemented(BasicType bt, uint vlen);
1428 
1429   virtual Node* Identity(PhaseGVN* phase);
1430 };

1523     : CallStaticJavaNode(C, VectorBoxNode::vec_box_type(vbox_type), NULL, NULL) {
1524     init_flags(Flag_is_macro);
1525     C->add_macro_node(this);
1526   }
1527 
1528   virtual int Opcode() const;
1529 #ifndef PRODUCT
1530   virtual void dump_spec(outputStream *st) const;
1531 #endif // !PRODUCT
1532 };
1533 
1534 class VectorUnboxNode : public VectorNode {
1535  private:
1536   bool _shuffle_to_vector;
1537  protected:
1538   uint size_of() const { return sizeof(*this); }
1539  public:
1540   VectorUnboxNode(Compile* C, const TypeVect* vec_type, Node* obj, Node* mem, bool shuffle_to_vector)
1541     : VectorNode(mem, obj, vec_type) {
1542     _shuffle_to_vector = shuffle_to_vector;
1543     init_class_id(Class_VectorUnbox);
1544     init_flags(Flag_is_macro);
1545     C->add_macro_node(this);
1546   }
1547 
1548   virtual int Opcode() const;
1549   Node* obj() const { return in(2); }
1550   Node* mem() const { return in(1); }
1551   virtual Node* Identity(PhaseGVN* phase);
1552   Node* Ideal(PhaseGVN* phase, bool can_reshape);
1553   bool is_shuffle_to_vector() { return _shuffle_to_vector; }
1554 };
1555 
1556 class RotateRightVNode : public VectorNode {
1557 public:
1558   RotateRightVNode(Node* in1, Node* in2, const TypeVect* vt)
1559   : VectorNode(in1, in2, vt) {}
1560 
1561   virtual int Opcode() const;
1562   Node* Ideal(PhaseGVN* phase, bool can_reshape);
1563 };
1564 
1565 class RotateLeftVNode : public VectorNode {
1566 public:
1567   RotateLeftVNode(Node* in1, Node* in2, const TypeVect* vt)
1568   : VectorNode(in1, in2, vt) {}
1569 
1570   virtual int Opcode() const;
1571   Node* Ideal(PhaseGVN* phase, bool can_reshape);
1572 };

1573 #endif // SHARE_OPTO_VECTORNODE_HPP
< prev index next >