comparison src/share/vm/opto/type.cpp @ 6179:8c92982cbbc4

7119644: Increase superword's vector size up to 256 bits Summary: Increase vector size up to 256-bits for YMM AVX registers on x86. Reviewed-by: never, twisti, roland
author kvn
date Fri, 15 Jun 2012 01:25:19 -0700
parents c7f3d0b4570f
children 765ee2d1674b
comparison
equal deleted inserted replaced
6146:eba1d5bce9e8 6179:8c92982cbbc4
1 /* 1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
58 T_VOID, // Half 58 T_VOID, // Half
59 T_NARROWOOP, // NarrowOop 59 T_NARROWOOP, // NarrowOop
60 60
61 T_ILLEGAL, // Tuple 61 T_ILLEGAL, // Tuple
62 T_ARRAY, // Array 62 T_ARRAY, // Array
63 T_ILLEGAL, // VectorS
64 T_ILLEGAL, // VectorD
65 T_ILLEGAL, // VectorX
66 T_ILLEGAL, // VectorY
63 67
64 T_ADDRESS, // AnyPtr // shows up in factory methods for NULL_PTR 68 T_ADDRESS, // AnyPtr // shows up in factory methods for NULL_PTR
65 T_ADDRESS, // RawPtr 69 T_ADDRESS, // RawPtr
66 T_OBJECT, // OopPtr 70 T_OBJECT, // OopPtr
67 T_OBJECT, // InstPtr 71 T_OBJECT, // InstPtr
412 _zero_type[T_VOID] = Type::TOP; // the only void value is no value at all 416 _zero_type[T_VOID] = Type::TOP; // the only void value is no value at all
413 417
414 // get_zero_type() should not happen for T_CONFLICT 418 // get_zero_type() should not happen for T_CONFLICT
415 _zero_type[T_CONFLICT]= NULL; 419 _zero_type[T_CONFLICT]= NULL;
416 420
421 // Vector predefined types, it needs initialized _const_basic_type[].
422 if (Matcher::vector_size_supported(T_BYTE,4)) {
423 TypeVect::VECTS = TypeVect::make(T_BYTE,4);
424 }
425 if (Matcher::vector_size_supported(T_FLOAT,2)) {
426 TypeVect::VECTD = TypeVect::make(T_FLOAT,2);
427 }
428 if (Matcher::vector_size_supported(T_FLOAT,4)) {
429 TypeVect::VECTX = TypeVect::make(T_FLOAT,4);
430 }
431 if (Matcher::vector_size_supported(T_FLOAT,8)) {
432 TypeVect::VECTY = TypeVect::make(T_FLOAT,8);
433 }
434 mreg2type[Op_VecS] = TypeVect::VECTS;
435 mreg2type[Op_VecD] = TypeVect::VECTD;
436 mreg2type[Op_VecX] = TypeVect::VECTX;
437 mreg2type[Op_VecY] = TypeVect::VECTY;
438
417 // Restore working type arena. 439 // Restore working type arena.
418 current->set_type_arena(save); 440 current->set_type_arena(save);
419 current->set_type_dict(NULL); 441 current->set_type_dict(NULL);
420 } 442 }
421 443
666 Half, // Half 688 Half, // Half
667 Bad, // NarrowOop - handled in v-call 689 Bad, // NarrowOop - handled in v-call
668 690
669 Bad, // Tuple - handled in v-call 691 Bad, // Tuple - handled in v-call
670 Bad, // Array - handled in v-call 692 Bad, // Array - handled in v-call
693 Bad, // VectorS - handled in v-call
694 Bad, // VectorD - handled in v-call
695 Bad, // VectorX - handled in v-call
696 Bad, // VectorY - handled in v-call
671 697
672 Bad, // AnyPtr - handled in v-call 698 Bad, // AnyPtr - handled in v-call
673 Bad, // RawPtr - handled in v-call 699 Bad, // RawPtr - handled in v-call
674 Bad, // OopPtr - handled in v-call 700 Bad, // OopPtr - handled in v-call
675 Bad, // InstPtr - handled in v-call 701 Bad, // InstPtr - handled in v-call
726 } 752 }
727 753
728 //------------------------------data------------------------------------------- 754 //------------------------------data-------------------------------------------
729 const char * const Type::msg[Type::lastype] = { 755 const char * const Type::msg[Type::lastype] = {
730 "bad","control","top","int:","long:","half", "narrowoop:", 756 "bad","control","top","int:","long:","half", "narrowoop:",
731 "tuple:", "aryptr", 757 "tuple:", "array:", "vectors:", "vectord:", "vectorx:", "vectory:",
732 "anyptr:", "rawptr:", "java:", "inst:", "ary:", "klass:", 758 "anyptr:", "rawptr:", "java:", "inst:", "aryptr:", "klass:",
733 "func", "abIO", "return_address", "memory", 759 "func", "abIO", "return_address", "memory",
734 "float_top", "ftcon:", "float", 760 "float_top", "ftcon:", "float",
735 "double_top", "dblcon:", "double", 761 "double_top", "dblcon:", "double",
736 "bottom" 762 "bottom"
737 }; 763 };
788 } 814 }
789 815
790 //------------------------------isa_oop_ptr------------------------------------ 816 //------------------------------isa_oop_ptr------------------------------------
791 // Return true if type is an oop pointer type. False for raw pointers. 817 // Return true if type is an oop pointer type. False for raw pointers.
792 static char isa_oop_ptr_tbl[Type::lastype] = { 818 static char isa_oop_ptr_tbl[Type::lastype] = {
793 0,0,0,0,0,0,0/*narrowoop*/,0/*tuple*/, 0/*ary*/, 819 0,0,0,0,0,0,0/*narrowoop*/,0/*tuple*/, 0/*array*/, 0, 0, 0, 0/*vector*/,
794 0/*anyptr*/,0/*rawptr*/,1/*OopPtr*/,1/*InstPtr*/,1/*AryPtr*/,1/*KlassPtr*/, 820 0/*anyptr*/,0/*rawptr*/,1/*OopPtr*/,1/*InstPtr*/,1/*AryPtr*/,1/*KlassPtr*/,
795 0/*func*/,0,0/*return_address*/,0, 821 0/*func*/,0,0/*return_address*/,0,
796 /*floats*/0,0,0, /*doubles*/0,0,0, 822 /*floats*/0,0,0, /*doubles*/0,0,0,
797 0 823 0
798 }; 824 };
1923 tap = _elem->isa_aryptr(); 1949 tap = _elem->isa_aryptr();
1924 if (tap) 1950 if (tap)
1925 return tap->ary()->ary_must_be_exact(); 1951 return tap->ary()->ary_must_be_exact();
1926 return false; 1952 return false;
1927 } 1953 }
1954
1955 //==============================TypeVect=======================================
1956 // Convenience common pre-built types.
1957 const TypeVect *TypeVect::VECTS = NULL; // 32-bit vectors
1958 const TypeVect *TypeVect::VECTD = NULL; // 64-bit vectors
1959 const TypeVect *TypeVect::VECTX = NULL; // 128-bit vectors
1960 const TypeVect *TypeVect::VECTY = NULL; // 256-bit vectors
1961
1962 //------------------------------make-------------------------------------------
1963 const TypeVect* TypeVect::make(const Type *elem, uint length) {
1964 BasicType elem_bt = elem->array_element_basic_type();
1965 assert(is_java_primitive(elem_bt), "only primitive types in vector");
1966 assert(length > 1 && is_power_of_2(length), "vector length is power of 2");
1967 assert(Matcher::vector_size_supported(elem_bt, length), "length in range");
1968 int size = length * type2aelembytes(elem_bt);
1969 switch (Matcher::vector_ideal_reg(size)) {
1970 case Op_VecS:
1971 return (TypeVect*)(new TypeVectS(elem, length))->hashcons();
1972 case Op_VecD:
1973 case Op_RegD:
1974 return (TypeVect*)(new TypeVectD(elem, length))->hashcons();
1975 case Op_VecX:
1976 return (TypeVect*)(new TypeVectX(elem, length))->hashcons();
1977 case Op_VecY:
1978 return (TypeVect*)(new TypeVectY(elem, length))->hashcons();
1979 }
1980 ShouldNotReachHere();
1981 return NULL;
1982 }
1983
1984 //------------------------------meet-------------------------------------------
1985 // Compute the MEET of two types. It returns a new Type object.
1986 const Type *TypeVect::xmeet( const Type *t ) const {
1987 // Perform a fast test for common case; meeting the same types together.
1988 if( this == t ) return this; // Meeting same type-rep?
1989
1990 // Current "this->_base" is Vector
1991 switch (t->base()) { // switch on original type
1992
1993 case Bottom: // Ye Olde Default
1994 return t;
1995
1996 default: // All else is a mistake
1997 typerr(t);
1998
1999 case VectorS:
2000 case VectorD:
2001 case VectorX:
2002 case VectorY: { // Meeting 2 vectors?
2003 const TypeVect* v = t->is_vect();
2004 assert( base() == v->base(), "");
2005 assert(length() == v->length(), "");
2006 assert(element_basic_type() == v->element_basic_type(), "");
2007 return TypeVect::make(_elem->xmeet(v->_elem), _length);
2008 }
2009 case Top:
2010 break;
2011 }
2012 return this;
2013 }
2014
2015 //------------------------------xdual------------------------------------------
2016 // Dual: compute field-by-field dual
2017 const Type *TypeVect::xdual() const {
2018 return new TypeVect(base(), _elem->dual(), _length);
2019 }
2020
2021 //------------------------------eq---------------------------------------------
2022 // Structural equality check for Type representations
2023 bool TypeVect::eq(const Type *t) const {
2024 const TypeVect *v = t->is_vect();
2025 return (_elem == v->_elem) && (_length == v->_length);
2026 }
2027
2028 //------------------------------hash-------------------------------------------
2029 // Type-specific hashing function.
2030 int TypeVect::hash(void) const {
2031 return (intptr_t)_elem + (intptr_t)_length;
2032 }
2033
2034 //------------------------------singleton--------------------------------------
2035 // TRUE if Type is a singleton type, FALSE otherwise. Singletons are simple
2036 // constants (Ldi nodes). Vector is singleton if all elements are the same
2037 // constant value (when vector is created with Replicate code).
2038 bool TypeVect::singleton(void) const {
2039 // There is no Con node for vectors yet.
2040 // return _elem->singleton();
2041 return false;
2042 }
2043
2044 bool TypeVect::empty(void) const {
2045 return _elem->empty();
2046 }
2047
2048 //------------------------------dump2------------------------------------------
2049 #ifndef PRODUCT
2050 void TypeVect::dump2(Dict &d, uint depth, outputStream *st) const {
2051 switch (base()) {
2052 case VectorS:
2053 st->print("vectors["); break;
2054 case VectorD:
2055 st->print("vectord["); break;
2056 case VectorX:
2057 st->print("vectorx["); break;
2058 case VectorY:
2059 st->print("vectory["); break;
2060 default:
2061 ShouldNotReachHere();
2062 }
2063 st->print("%d]:{", _length);
2064 _elem->dump2(d, depth, st);
2065 st->print("}");
2066 }
2067 #endif
2068
1928 2069
1929 //============================================================================= 2070 //=============================================================================
1930 // Convenience common pre-built types. 2071 // Convenience common pre-built types.
1931 const TypePtr *TypePtr::NULL_PTR; 2072 const TypePtr *TypePtr::NULL_PTR;
1932 const TypePtr *TypePtr::NOTNULL; 2073 const TypePtr *TypePtr::NOTNULL;
4138 4279
4139 //------------------------------print_flattened-------------------------------- 4280 //------------------------------print_flattened--------------------------------
4140 // Print a 'flattened' signature 4281 // Print a 'flattened' signature
4141 static const char * const flat_type_msg[Type::lastype] = { 4282 static const char * const flat_type_msg[Type::lastype] = {
4142 "bad","control","top","int","long","_", "narrowoop", 4283 "bad","control","top","int","long","_", "narrowoop",
4143 "tuple:", "array:", 4284 "tuple:", "array:", "vectors:", "vectord:", "vectorx:", "vectory:",
4144 "ptr", "rawptr", "ptr", "ptr", "ptr", "ptr", 4285 "ptr", "rawptr", "ptr", "ptr", "ptr", "ptr",
4145 "func", "abIO", "return_address", "mem", 4286 "func", "abIO", "return_address", "mem",
4146 "float_top", "ftcon:", "flt", 4287 "float_top", "ftcon:", "flt",
4147 "double_top", "dblcon:", "dbl", 4288 "double_top", "dblcon:", "dbl",
4148 "bottom" 4289 "bottom"