// Create a binary tree form for Packs. [lo, hi) (half-open) range PackNode* PackNode::binary_tree_pack(Compile* C, int lo, int hi) { int ct = hi - lo; assert(is_power_of_2(ct), "power of 2"); if (ct == 2) { PackNode* pk = PackNode::make(C, in(lo), 2, vect_type()->element_basic_type()); pk->add_opd(in(lo+1)); return pk; } else { int mid = lo + ct/2; PackNode* n1 = binary_tree_pack(C, lo, mid); PackNode* n2 = binary_tree_pack(C, mid, hi ); BasicType bt = n1->vect_type()->element_basic_type(); assert(bt == n2->vect_type()->element_basic_type(), "should be the same"); switch (bt) { case T_BOOLEAN: case T_BYTE: return new (C) PackSNode(n1, n2, TypeVect::make(T_SHORT, 2)); case T_CHAR: case T_SHORT: return new (C) PackINode(n1, n2, TypeVect::make(T_INT, 2)); case T_INT: return new (C) PackLNode(n1, n2, TypeVect::make(T_LONG, 2)); case T_LONG: return new (C) Pack2LNode(n1, n2, TypeVect::make(T_LONG, 2)); case T_FLOAT: return new (C) PackDNode(n1, n2, TypeVect::make(T_DOUBLE, 2)); case T_DOUBLE: return new (C) Pack2DNode(n1, n2, TypeVect::make(T_DOUBLE, 2)); } fatal(err_msg_res("Type '%s' is not supported for vectors", type2name(bt))); } return NULL; }
virtual uint ideal_reg() const { return Matcher::vector_ideal_reg(vect_type()->length_in_bytes()); }
virtual int memory_size() const { return vect_type()->length_in_bytes(); }
uint length() const { return vect_type()->length(); } // Vector length
uint length_in_bytes() const { return vect_type()->length_in_bytes(); }
Load2DNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const Type *t = Type::DOUBLE) : VectorLoadNode(c,mem,adr,at,vect_type(t,2)) {}
virtual const Type *bottom_type() const { return vect_type(); }
Load2FNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const Type *t = Type::FLOAT) : VectorLoadNode(c,mem,adr,at,vect_type(t,2)) {}
const Type* vect_type() const { return vect_type(elt_basic_type(), length()); }
Load2LNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeLong *tl = TypeLong::LONG) : VectorLoadNode(c,mem,adr,at,vect_type(tl,2)) {}
Load2INode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::INT) : VectorLoadNode(c,mem,adr,at,vect_type(ti,2)) {}
Load4SNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::SHORT) : VectorLoadNode(c,mem,adr,at,vect_type(ti,4)) {}
Load8CNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::CHAR) : VectorLoadNode(c,mem,adr,at,vect_type(ti,8)) {}
Load16BNode(Node* c, Node* mem, Node* adr, const TypePtr* at, const TypeInt *ti = TypeInt::BYTE) : VectorLoadNode(c,mem,adr,at,vect_type(ti,16)) {}
static const Type* vect_type(const Type* elt_type, uint len) { return vect_type(elt_type->array_element_basic_type(), len); }