30 #include "opto/opcodes.hpp"
31
32 //------------------------------VectorNode--------------------------------------
33 // Vector Operation
34 class VectorNode : public Node {
35 virtual uint size_of() const { return sizeof(*this); }
36 protected:
37 uint _length; // vector length
38 virtual BasicType elt_basic_type() const = 0; // Vector element basic type
39
40 static const Type* vect_type(BasicType elt_bt, uint len);
41 static const Type* vect_type(const Type* elt_type, uint len) {
42 return vect_type(elt_type->array_element_basic_type(), len);
43 }
44
45 public:
46 friend class VectorLoadNode; // For vect_type
47 friend class VectorStoreNode; // ditto.
48
49 VectorNode(Node* n1, uint vlen) : Node(NULL, n1), _length(vlen) {
50 init_flags(Flag_is_Vector);
51 }
52 VectorNode(Node* n1, Node* n2, uint vlen) : Node(NULL, n1, n2), _length(vlen) {
53 init_flags(Flag_is_Vector);
54 }
55 virtual int Opcode() const;
56
57 uint length() const { return _length; } // Vector length
58
59 static uint max_vlen(BasicType bt) { // max vector length
60 return (uint)(Matcher::vector_width_in_bytes() / type2aelembytes(bt));
61 }
62
63 // Element and vector type
64 const Type* elt_type() const { return Type::get_const_basic_type(elt_basic_type()); }
65 const Type* vect_type() const { return vect_type(elt_basic_type(), length()); }
66
67 virtual const Type *bottom_type() const { return vect_type(); }
68 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(); }
69
70 // Vector opcode from scalar opcode
71 static int opcode(int sopc, uint vlen, const Type* opd_t);
72
73 static VectorNode* scalar2vector(Compile* C, Node* s, uint vlen, const Type* opd_t);
372 };
373
374 //================================= M E M O R Y ==================================
375
376
377 //------------------------------VectorLoadNode--------------------------------------
378 // Vector Load from memory
379 class VectorLoadNode : public LoadNode {
380 virtual uint size_of() const { return sizeof(*this); }
381
382 protected:
383 virtual BasicType elt_basic_type() const = 0; // Vector element basic type
384 // For use in constructor
385 static const Type* vect_type(const Type* elt_type, uint len) {
386 return VectorNode::vect_type(elt_type, len);
387 }
388
389 public:
390 VectorLoadNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const Type *rt)
391 : LoadNode(c,mem,adr,at,rt) {
392 init_flags(Flag_is_Vector);
393 }
394 virtual int Opcode() const;
395
396 virtual uint length() const = 0; // Vector length
397
398 // Element and vector type
399 const Type* elt_type() const { return Type::get_const_basic_type(elt_basic_type()); }
400 const Type* vect_type() const { return VectorNode::vect_type(elt_basic_type(), length()); }
401
402 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(); }
403 virtual BasicType memory_type() const { return T_VOID; }
404 virtual int memory_size() const { return length()*type2aelembytes(elt_basic_type()); }
405
406 // Vector opcode from scalar opcode
407 static int opcode(int sopc, uint vlen);
408
409 static VectorLoadNode* make(Compile* C, int opc, Node* ctl, Node* mem,
410 Node* adr, const TypePtr* atyp, uint vlen);
411 };
412
600 public:
601 Load2DNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const Type *t = Type::DOUBLE)
602 : VectorLoadNode(c,mem,adr,at,vect_type(t,2)) {}
603 virtual int Opcode() const;
604 virtual int store_Opcode() const { return Op_Store2D; }
605 virtual uint length() const { return 2; }
606 };
607
608
609 //------------------------------VectorStoreNode--------------------------------------
610 // Vector Store to memory
611 class VectorStoreNode : public StoreNode {
612 virtual uint size_of() const { return sizeof(*this); }
613
614 protected:
615 virtual BasicType elt_basic_type() const = 0; // Vector element basic type
616
617 public:
618 VectorStoreNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
619 : StoreNode(c,mem,adr,at,val) {
620 init_flags(Flag_is_Vector);
621 }
622 virtual int Opcode() const;
623
624 virtual uint length() const = 0; // Vector length
625
626 // Element and vector type
627 const Type* elt_type() const { return Type::get_const_basic_type(elt_basic_type()); }
628 const Type* vect_type() const { return VectorNode::vect_type(elt_basic_type(), length()); }
629
630 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(); }
631 virtual BasicType memory_type() const { return T_VOID; }
632 virtual int memory_size() const { return length()*type2aelembytes(elt_basic_type()); }
633
634 // Vector opcode from scalar opcode
635 static int opcode(int sopc, uint vlen);
636
637 static VectorStoreNode* make(Compile* C, int opc, Node* ctl, Node* mem,
638 Node* adr, const TypePtr* atyp, VectorNode* val,
639 uint vlen);
640 };
641
642 //------------------------------Store16BNode--------------------------------------
643 // Vector store of 16 bytes (8bits signed) to memory
644 class Store16BNode : public VectorStoreNode {
645 protected:
646 virtual BasicType elt_basic_type() const { return T_BYTE; }
647 public:
648 Store16BNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
649 : VectorStoreNode(c,mem,adr,at,val) {}
650 virtual int Opcode() const;
651 virtual uint length() const { return 16; }
652 };
653
654 //------------------------------Store8BNode--------------------------------------
655 // Vector store of 8 bytes (8bits signed) to memory
656 class Store8BNode : public VectorStoreNode {
657 protected:
658 virtual BasicType elt_basic_type() const { return T_BYTE; }
|
30 #include "opto/opcodes.hpp"
31
32 //------------------------------VectorNode--------------------------------------
33 // Vector Operation
34 class VectorNode : public Node {
35 virtual uint size_of() const { return sizeof(*this); }
36 protected:
37 uint _length; // vector length
38 virtual BasicType elt_basic_type() const = 0; // Vector element basic type
39
40 static const Type* vect_type(BasicType elt_bt, uint len);
41 static const Type* vect_type(const Type* elt_type, uint len) {
42 return vect_type(elt_type->array_element_basic_type(), len);
43 }
44
45 public:
46 friend class VectorLoadNode; // For vect_type
47 friend class VectorStoreNode; // ditto.
48
49 VectorNode(Node* n1, uint vlen) : Node(NULL, n1), _length(vlen) {
50 init_class_id(Class_Vector);
51 }
52 VectorNode(Node* n1, Node* n2, uint vlen) : Node(NULL, n1, n2), _length(vlen) {
53 init_class_id(Class_Vector);
54 }
55 virtual int Opcode() const;
56
57 uint length() const { return _length; } // Vector length
58
59 static uint max_vlen(BasicType bt) { // max vector length
60 return (uint)(Matcher::vector_width_in_bytes() / type2aelembytes(bt));
61 }
62
63 // Element and vector type
64 const Type* elt_type() const { return Type::get_const_basic_type(elt_basic_type()); }
65 const Type* vect_type() const { return vect_type(elt_basic_type(), length()); }
66
67 virtual const Type *bottom_type() const { return vect_type(); }
68 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(); }
69
70 // Vector opcode from scalar opcode
71 static int opcode(int sopc, uint vlen, const Type* opd_t);
72
73 static VectorNode* scalar2vector(Compile* C, Node* s, uint vlen, const Type* opd_t);
372 };
373
374 //================================= M E M O R Y ==================================
375
376
377 //------------------------------VectorLoadNode--------------------------------------
378 // Vector Load from memory
379 class VectorLoadNode : public LoadNode {
380 virtual uint size_of() const { return sizeof(*this); }
381
382 protected:
383 virtual BasicType elt_basic_type() const = 0; // Vector element basic type
384 // For use in constructor
385 static const Type* vect_type(const Type* elt_type, uint len) {
386 return VectorNode::vect_type(elt_type, len);
387 }
388
389 public:
390 VectorLoadNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const Type *rt)
391 : LoadNode(c,mem,adr,at,rt) {
392 init_class_id(Class_VectorLoad);
393 }
394 virtual int Opcode() const;
395
396 virtual uint length() const = 0; // Vector length
397
398 // Element and vector type
399 const Type* elt_type() const { return Type::get_const_basic_type(elt_basic_type()); }
400 const Type* vect_type() const { return VectorNode::vect_type(elt_basic_type(), length()); }
401
402 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(); }
403 virtual BasicType memory_type() const { return T_VOID; }
404 virtual int memory_size() const { return length()*type2aelembytes(elt_basic_type()); }
405
406 // Vector opcode from scalar opcode
407 static int opcode(int sopc, uint vlen);
408
409 static VectorLoadNode* make(Compile* C, int opc, Node* ctl, Node* mem,
410 Node* adr, const TypePtr* atyp, uint vlen);
411 };
412
600 public:
601 Load2DNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const Type *t = Type::DOUBLE)
602 : VectorLoadNode(c,mem,adr,at,vect_type(t,2)) {}
603 virtual int Opcode() const;
604 virtual int store_Opcode() const { return Op_Store2D; }
605 virtual uint length() const { return 2; }
606 };
607
608
609 //------------------------------VectorStoreNode--------------------------------------
610 // Vector Store to memory
611 class VectorStoreNode : public StoreNode {
612 virtual uint size_of() const { return sizeof(*this); }
613
614 protected:
615 virtual BasicType elt_basic_type() const = 0; // Vector element basic type
616
617 public:
618 VectorStoreNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
619 : StoreNode(c,mem,adr,at,val) {
620 init_class_id(Class_VectorStore);
621 }
622 virtual int Opcode() const;
623
624 virtual uint length() const = 0; // Vector length
625
626 // Element and vector type
627 const Type* elt_type() const { return Type::get_const_basic_type(elt_basic_type()); }
628 const Type* vect_type() const { return VectorNode::vect_type(elt_basic_type(), length()); }
629
630 virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(); }
631 virtual BasicType memory_type() const { return T_VOID; }
632 virtual int memory_size() const { return length()*type2aelembytes(elt_basic_type()); }
633
634 // Vector opcode from scalar opcode
635 static int opcode(int sopc, uint vlen);
636
637 static VectorStoreNode* make(Compile* C, int opc, Node* ctl, Node* mem,
638 Node* adr, const TypePtr* atyp, Node* val,
639 uint vlen);
640 };
641
642 //------------------------------Store16BNode--------------------------------------
643 // Vector store of 16 bytes (8bits signed) to memory
644 class Store16BNode : public VectorStoreNode {
645 protected:
646 virtual BasicType elt_basic_type() const { return T_BYTE; }
647 public:
648 Store16BNode(Node* c, Node* mem, Node* adr, const TypePtr* at, Node* val)
649 : VectorStoreNode(c,mem,adr,at,val) {}
650 virtual int Opcode() const;
651 virtual uint length() const { return 16; }
652 };
653
654 //------------------------------Store8BNode--------------------------------------
655 // Vector store of 8 bytes (8bits signed) to memory
656 class Store8BNode : public VectorStoreNode {
657 protected:
658 virtual BasicType elt_basic_type() const { return T_BYTE; }
|