76 static VectorNode* make(int opc, Node* n1, Node* n2, uint vlen, BasicType bt, bool is_var_shift = false);
77 static VectorNode* make(int vopc, Node* n1, Node* n2, const TypeVect* vt, bool is_mask = false, bool is_var_shift = false);
78 static VectorNode* make(int opc, Node* n1, Node* n2, Node* n3, uint vlen, BasicType bt);
79 static VectorNode* make(int vopc, Node* n1, Node* n2, Node* n3, const TypeVect* vt);
80 static VectorNode* make_mask_node(int vopc, Node* n1, Node* n2, uint vlen, BasicType bt);
81
82 static bool is_shift_opcode(int opc);
83
84 static bool is_vshift_cnt_opcode(int opc);
85
86 static bool is_rotate_opcode(int opc);
87
88 static int opcode(int opc, BasicType bt);
89 static int replicate_opcode(BasicType bt);
90 static bool implemented(int opc, uint vlen, BasicType bt);
91 static bool is_shift(Node* n);
92 static bool is_vshift_cnt(Node* n);
93 static bool is_type_transition_short_to_int(Node* n);
94 static bool is_type_transition_to_int(Node* n);
95 static bool is_muladds2i(Node* n);
96 static bool is_vpopcnt_long(Node* n);
97 static bool is_roundopD(Node* n);
98 static bool is_scalar_rotate(Node* n);
99 static bool is_vector_rotate_supported(int opc, uint vlen, BasicType bt);
100 static bool is_vector_integral_negate_supported(int opc, uint vlen, BasicType bt, bool use_predicate);
101 static bool is_invariant_vector(Node* n);
102 static bool is_all_ones_vector(Node* n);
103 static bool is_vector_bitwise_not_pattern(Node* n);
104 static Node* degenerate_vector_rotate(Node* n1, Node* n2, bool is_rotate_left, int vlen,
105 BasicType bt, PhaseGVN* phase);
106
107 // [Start, end) half-open range defining which operands are vectors
108 static void vector_operands(Node* n, uint* start, uint* end);
109
110 static bool is_vector_shift(int opc);
111 static bool is_vector_shift_count(int opc);
112 static bool is_vector_rotate(int opc);
113 static bool is_vector_integral_negate(int opc);
114
115 static bool is_vector_shift(Node* n) {
116 return is_vector_shift(n->Opcode());
751 XorVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
752 virtual int Opcode() const;
753 };
754
755 //------------------------------MinReductionVNode--------------------------------------
756 // Vector min byte, short, int, long, float, double as a reduction
757 class MinReductionVNode : public ReductionNode {
758 public:
759 MinReductionVNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {}
760 virtual int Opcode() const;
761 };
762
763 //------------------------------MaxReductionVNode--------------------------------------
764 // Vector min byte, short, int, long, float, double as a reduction
765 class MaxReductionVNode : public ReductionNode {
766 public:
767 MaxReductionVNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {}
768 virtual int Opcode() const;
769 };
770
771 //================================= M E M O R Y ===============================
772
773 //------------------------------LoadVectorNode---------------------------------
774 // Load Vector from memory
775 class LoadVectorNode : public LoadNode {
776 public:
777 LoadVectorNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeVect* vt, ControlDependency control_dependency = LoadNode::DependsOnlyOnTest)
778 : LoadNode(c, mem, adr, at, vt, MemNode::unordered, control_dependency) {
779 init_class_id(Class_LoadVector);
780 set_mismatched_access();
781 }
782
783 const TypeVect* vect_type() const { return type()->is_vect(); }
784 uint length() const { return vect_type()->length(); } // Vector length
785
786 virtual int Opcode() const;
787
788 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(memory_size()); }
789 virtual BasicType memory_type() const { return T_VOID; }
790 virtual int memory_size() const { return vect_type()->length_in_bytes(); }
1367
1368 public:
1369 VectorTestNode(Node* in1, Node* in2, BoolTest::mask predicate) : Node(NULL, in1, in2), _predicate(predicate) {
1370 assert(in2->bottom_type()->is_vect() == in2->bottom_type()->is_vect(), "same vector type");
1371 }
1372 virtual int Opcode() const;
1373 virtual uint hash() const { return Node::hash() + _predicate; }
1374 virtual bool cmp( const Node &n ) const {
1375 return Node::cmp(n) && _predicate == ((VectorTestNode&)n)._predicate;
1376 }
1377 virtual const Type *bottom_type() const { return TypeInt::BOOL; }
1378 virtual uint ideal_reg() const { return Op_RegI; } // TODO Should be RegFlags but due to missing comparison flags for BoolTest
1379 // in middle-end, we make it boolean result directly.
1380 BoolTest::mask get_predicate() const { return _predicate; }
1381 };
1382
1383 class VectorBlendNode : public VectorNode {
1384 public:
1385 VectorBlendNode(Node* vec1, Node* vec2, Node* mask)
1386 : VectorNode(vec1, vec2, mask, vec1->bottom_type()->is_vect()) {
1387 // assert(mask->is_VectorMask(), "VectorBlendNode requires that third argument be a mask");
1388 }
1389
1390 virtual int Opcode() const;
1391 Node* vec1() const { return in(1); }
1392 Node* vec2() const { return in(2); }
1393 Node* vec_mask() const { return in(3); }
1394 };
1395
1396 class VectorRearrangeNode : public VectorNode {
1397 public:
1398 VectorRearrangeNode(Node* vec1, Node* shuffle)
1399 : VectorNode(vec1, shuffle, vec1->bottom_type()->is_vect()) {
1400 // assert(mask->is_VectorMask(), "VectorBlendNode requires that third argument be a mask");
1401 }
1402
1403 virtual int Opcode() const;
1404 Node* vec1() const { return in(1); }
1405 Node* vec_shuffle() const { return in(2); }
1406 };
1407
1649 bool is_shuffle_to_vector() { return _shuffle_to_vector; }
1650 };
1651
1652 class RotateRightVNode : public VectorNode {
1653 public:
1654 RotateRightVNode(Node* in1, Node* in2, const TypeVect* vt)
1655 : VectorNode(in1, in2, vt) {}
1656
1657 virtual int Opcode() const;
1658 Node* Ideal(PhaseGVN* phase, bool can_reshape);
1659 };
1660
1661 class RotateLeftVNode : public VectorNode {
1662 public:
1663 RotateLeftVNode(Node* in1, Node* in2, const TypeVect* vt)
1664 : VectorNode(in1, in2, vt) {}
1665
1666 virtual int Opcode() const;
1667 Node* Ideal(PhaseGVN* phase, bool can_reshape);
1668 };
1669 #endif // SHARE_OPTO_VECTORNODE_HPP
|
76 static VectorNode* make(int opc, Node* n1, Node* n2, uint vlen, BasicType bt, bool is_var_shift = false);
77 static VectorNode* make(int vopc, Node* n1, Node* n2, const TypeVect* vt, bool is_mask = false, bool is_var_shift = false);
78 static VectorNode* make(int opc, Node* n1, Node* n2, Node* n3, uint vlen, BasicType bt);
79 static VectorNode* make(int vopc, Node* n1, Node* n2, Node* n3, const TypeVect* vt);
80 static VectorNode* make_mask_node(int vopc, Node* n1, Node* n2, uint vlen, BasicType bt);
81
82 static bool is_shift_opcode(int opc);
83
84 static bool is_vshift_cnt_opcode(int opc);
85
86 static bool is_rotate_opcode(int opc);
87
88 static int opcode(int opc, BasicType bt);
89 static int replicate_opcode(BasicType bt);
90 static bool implemented(int opc, uint vlen, BasicType bt);
91 static bool is_shift(Node* n);
92 static bool is_vshift_cnt(Node* n);
93 static bool is_type_transition_short_to_int(Node* n);
94 static bool is_type_transition_to_int(Node* n);
95 static bool is_muladds2i(Node* n);
96 static bool is_type_transition_long_to_int(Node* n);
97 static bool is_roundopD(Node* n);
98 static bool is_scalar_rotate(Node* n);
99 static bool is_vector_rotate_supported(int opc, uint vlen, BasicType bt);
100 static bool is_vector_integral_negate_supported(int opc, uint vlen, BasicType bt, bool use_predicate);
101 static bool is_invariant_vector(Node* n);
102 static bool is_all_ones_vector(Node* n);
103 static bool is_vector_bitwise_not_pattern(Node* n);
104 static Node* degenerate_vector_rotate(Node* n1, Node* n2, bool is_rotate_left, int vlen,
105 BasicType bt, PhaseGVN* phase);
106
107 // [Start, end) half-open range defining which operands are vectors
108 static void vector_operands(Node* n, uint* start, uint* end);
109
110 static bool is_vector_shift(int opc);
111 static bool is_vector_shift_count(int opc);
112 static bool is_vector_rotate(int opc);
113 static bool is_vector_integral_negate(int opc);
114
115 static bool is_vector_shift(Node* n) {
116 return is_vector_shift(n->Opcode());
751 XorVNode(Node* in1, Node* in2, const TypeVect* vt) : VectorNode(in1,in2,vt) {}
752 virtual int Opcode() const;
753 };
754
755 //------------------------------MinReductionVNode--------------------------------------
756 // Vector min byte, short, int, long, float, double as a reduction
757 class MinReductionVNode : public ReductionNode {
758 public:
759 MinReductionVNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {}
760 virtual int Opcode() const;
761 };
762
763 //------------------------------MaxReductionVNode--------------------------------------
764 // Vector min byte, short, int, long, float, double as a reduction
765 class MaxReductionVNode : public ReductionNode {
766 public:
767 MaxReductionVNode(Node *ctrl, Node* in1, Node* in2) : ReductionNode(ctrl, in1, in2) {}
768 virtual int Opcode() const;
769 };
770
771 //------------------------------CompressVNode--------------------------------------
772 // Vector compress
773 class CompressVNode: public VectorNode {
774 public:
775 CompressVNode(Node* vec, Node* mask, const TypeVect* vt) :
776 VectorNode(vec, mask, vt) {
777 init_class_id(Class_CompressV);
778 }
779 virtual int Opcode() const;
780 };
781
782 class CompressMNode: public VectorNode {
783 public:
784 CompressMNode(Node* mask, const TypeVect* vt) :
785 VectorNode(mask, vt) {
786 init_class_id(Class_CompressM);
787 }
788 virtual int Opcode() const;
789 };
790
791 //------------------------------ExpandVNode--------------------------------------
792 // Vector expand
793 class ExpandVNode: public VectorNode {
794 public:
795 ExpandVNode(Node* vec, Node* mask, const TypeVect* vt) :
796 VectorNode(vec, mask, vt) {
797 init_class_id(Class_ExpandV);
798 }
799 virtual int Opcode() const;
800 };
801
802 //================================= M E M O R Y ===============================
803
804 //------------------------------LoadVectorNode---------------------------------
805 // Load Vector from memory
806 class LoadVectorNode : public LoadNode {
807 public:
808 LoadVectorNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeVect* vt, ControlDependency control_dependency = LoadNode::DependsOnlyOnTest)
809 : LoadNode(c, mem, adr, at, vt, MemNode::unordered, control_dependency) {
810 init_class_id(Class_LoadVector);
811 set_mismatched_access();
812 }
813
814 const TypeVect* vect_type() const { return type()->is_vect(); }
815 uint length() const { return vect_type()->length(); } // Vector length
816
817 virtual int Opcode() const;
818
819 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(memory_size()); }
820 virtual BasicType memory_type() const { return T_VOID; }
821 virtual int memory_size() const { return vect_type()->length_in_bytes(); }
1398
1399 public:
1400 VectorTestNode(Node* in1, Node* in2, BoolTest::mask predicate) : Node(NULL, in1, in2), _predicate(predicate) {
1401 assert(in2->bottom_type()->is_vect() == in2->bottom_type()->is_vect(), "same vector type");
1402 }
1403 virtual int Opcode() const;
1404 virtual uint hash() const { return Node::hash() + _predicate; }
1405 virtual bool cmp( const Node &n ) const {
1406 return Node::cmp(n) && _predicate == ((VectorTestNode&)n)._predicate;
1407 }
1408 virtual const Type *bottom_type() const { return TypeInt::BOOL; }
1409 virtual uint ideal_reg() const { return Op_RegI; } // TODO Should be RegFlags but due to missing comparison flags for BoolTest
1410 // in middle-end, we make it boolean result directly.
1411 BoolTest::mask get_predicate() const { return _predicate; }
1412 };
1413
1414 class VectorBlendNode : public VectorNode {
1415 public:
1416 VectorBlendNode(Node* vec1, Node* vec2, Node* mask)
1417 : VectorNode(vec1, vec2, mask, vec1->bottom_type()->is_vect()) {
1418 }
1419
1420 virtual int Opcode() const;
1421 Node* vec1() const { return in(1); }
1422 Node* vec2() const { return in(2); }
1423 Node* vec_mask() const { return in(3); }
1424 };
1425
1426 class VectorRearrangeNode : public VectorNode {
1427 public:
1428 VectorRearrangeNode(Node* vec1, Node* shuffle)
1429 : VectorNode(vec1, shuffle, vec1->bottom_type()->is_vect()) {
1430 // assert(mask->is_VectorMask(), "VectorBlendNode requires that third argument be a mask");
1431 }
1432
1433 virtual int Opcode() const;
1434 Node* vec1() const { return in(1); }
1435 Node* vec_shuffle() const { return in(2); }
1436 };
1437
1679 bool is_shuffle_to_vector() { return _shuffle_to_vector; }
1680 };
1681
1682 class RotateRightVNode : public VectorNode {
1683 public:
1684 RotateRightVNode(Node* in1, Node* in2, const TypeVect* vt)
1685 : VectorNode(in1, in2, vt) {}
1686
1687 virtual int Opcode() const;
1688 Node* Ideal(PhaseGVN* phase, bool can_reshape);
1689 };
1690
1691 class RotateLeftVNode : public VectorNode {
1692 public:
1693 RotateLeftVNode(Node* in1, Node* in2, const TypeVect* vt)
1694 : VectorNode(in1, in2, vt) {}
1695
1696 virtual int Opcode() const;
1697 Node* Ideal(PhaseGVN* phase, bool can_reshape);
1698 };
1699
1700 class CountLeadingZerosVNode : public VectorNode {
1701 public:
1702 CountLeadingZerosVNode(Node* in, const TypeVect* vt)
1703 : VectorNode(in, vt) {}
1704
1705 virtual int Opcode() const;
1706 };
1707
1708 class CountTrailingZerosVNode : public VectorNode {
1709 public:
1710 CountTrailingZerosVNode(Node* in, const TypeVect* vt)
1711 : VectorNode(in, vt) {}
1712
1713 virtual int Opcode() const;
1714 };
1715
1716 class ReverseVNode : public VectorNode {
1717 public:
1718 ReverseVNode(Node* in, const TypeVect* vt)
1719 : VectorNode(in, vt) {}
1720
1721 virtual int Opcode() const;
1722 };
1723
1724 class ReverseBytesVNode : public VectorNode {
1725 public:
1726 ReverseBytesVNode(Node* in, const TypeVect* vt)
1727 : VectorNode(in, vt) {}
1728
1729 virtual int Opcode() const;
1730 };
1731 #endif // SHARE_OPTO_VECTORNODE_HPP
|