< prev index next >

src/hotspot/share/opto/type.cpp

Print this page
rev 53001 : 8212043: Add floating-point Math.min/max intrinsics
Summary: Floating-point Math.min() and Math.max() intrinsics are enabled on AArch64 platform
Reviewed-by: adinn, aph


 428 
 429   current->set_type_arena(shared_type_arena);
 430   _shared_type_dict =
 431     new (shared_type_arena) Dict( (CmpKey)Type::cmp, (Hash)Type::uhash,
 432                                   shared_type_arena, 128 );
 433   current->set_type_dict(_shared_type_dict);
 434 
 435   // Make shared pre-built types.
 436   CONTROL = make(Control);      // Control only
 437   TOP     = make(Top);          // No values in set
 438   MEMORY  = make(Memory);       // Abstract store only
 439   ABIO    = make(Abio);         // State-of-machine only
 440   RETURN_ADDRESS=make(Return_Address);
 441   FLOAT   = make(FloatBot);     // All floats
 442   DOUBLE  = make(DoubleBot);    // All doubles
 443   BOTTOM  = make(Bottom);       // Everything
 444   HALF    = make(Half);         // Placeholder half of doublewide type
 445 
 446   TypeF::ZERO = TypeF::make(0.0); // Float 0 (positive zero)
 447   TypeF::ONE  = TypeF::make(1.0); // Float 1


 448 
 449   TypeD::ZERO = TypeD::make(0.0); // Double 0 (positive zero)
 450   TypeD::ONE  = TypeD::make(1.0); // Double 1


 451 
 452   TypeInt::MINUS_1 = TypeInt::make(-1);  // -1
 453   TypeInt::ZERO    = TypeInt::make( 0);  //  0
 454   TypeInt::ONE     = TypeInt::make( 1);  //  1
 455   TypeInt::BOOL    = TypeInt::make(0,1,   WidenMin);  // 0 or 1, FALSE or TRUE.
 456   TypeInt::CC      = TypeInt::make(-1, 1, WidenMin);  // -1, 0 or 1, condition codes
 457   TypeInt::CC_LT   = TypeInt::make(-1,-1, WidenMin);  // == TypeInt::MINUS_1
 458   TypeInt::CC_GT   = TypeInt::make( 1, 1, WidenMin);  // == TypeInt::ONE
 459   TypeInt::CC_EQ   = TypeInt::make( 0, 0, WidenMin);  // == TypeInt::ZERO
 460   TypeInt::CC_LE   = TypeInt::make(-1, 0, WidenMin);
 461   TypeInt::CC_GE   = TypeInt::make( 0, 1, WidenMin);  // == TypeInt::BOOL
 462   TypeInt::BYTE    = TypeInt::make(-128,127,     WidenMin); // Bytes
 463   TypeInt::UBYTE   = TypeInt::make(0, 255,       WidenMin); // Unsigned Bytes
 464   TypeInt::CHAR    = TypeInt::make(0,65535,      WidenMin); // Java chars
 465   TypeInt::SHORT   = TypeInt::make(-32768,32767, WidenMin); // Java shorts
 466   TypeInt::POS     = TypeInt::make(0,max_jint,   WidenMin); // Non-neg values
 467   TypeInt::POS1    = TypeInt::make(1,max_jint,   WidenMin); // Positive values
 468   TypeInt::INT     = TypeInt::make(min_jint,max_jint, WidenMax); // 32-bit integers
 469   TypeInt::SYMINT  = TypeInt::make(-max_jint,max_jint,WidenMin); // symmetric range
 470   TypeInt::TYPE_DOMAIN  = TypeInt::INT;


1070 }
1071 #endif
1072 
1073 //------------------------------typerr-----------------------------------------
1074 void Type::typerr( const Type *t ) const {
1075 #ifndef PRODUCT
1076   tty->print("\nError mixing types: ");
1077   dump();
1078   tty->print(" and ");
1079   t->dump();
1080   tty->print("\n");
1081 #endif
1082   ShouldNotReachHere();
1083 }
1084 
1085 
1086 //=============================================================================
1087 // Convenience common pre-built types.
1088 const TypeF *TypeF::ZERO;       // Floating point zero
1089 const TypeF *TypeF::ONE;        // Floating point one


1090 
1091 //------------------------------make-------------------------------------------
1092 // Create a float constant
1093 const TypeF *TypeF::make(float f) {
1094   return (TypeF*)(new TypeF(f))->hashcons();
1095 }
1096 
1097 //------------------------------meet-------------------------------------------
1098 // Compute the MEET of two types.  It returns a new Type object.
1099 const Type *TypeF::xmeet( const Type *t ) const {
1100   // Perform a fast test for common case; meeting the same types together.
1101   if( this == t ) return this;  // Meeting same type-rep?
1102 
1103   // Current "this->_base" is FloatCon
1104   switch (t->base()) {          // Switch on original type
1105   case AnyPtr:                  // Mixing with oops happens when javac
1106   case RawPtr:                  // reuses local variables
1107   case OopPtr:
1108   case InstPtr:
1109   case AryPtr:


1178   st->print("%f", _f);
1179 }
1180 #endif
1181 
1182 //------------------------------singleton--------------------------------------
1183 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
1184 // constants (Ldi nodes).  Singletons are integer, float or double constants
1185 // or a single symbol.
1186 bool TypeF::singleton(void) const {
1187   return true;                  // Always a singleton
1188 }
1189 
1190 bool TypeF::empty(void) const {
1191   return false;                 // always exactly a singleton
1192 }
1193 
1194 //=============================================================================
1195 // Convenience common pre-built types.
1196 const TypeD *TypeD::ZERO;       // Floating point zero
1197 const TypeD *TypeD::ONE;        // Floating point one


1198 
1199 //------------------------------make-------------------------------------------
1200 const TypeD *TypeD::make(double d) {
1201   return (TypeD*)(new TypeD(d))->hashcons();
1202 }
1203 
1204 //------------------------------meet-------------------------------------------
1205 // Compute the MEET of two types.  It returns a new Type object.
1206 const Type *TypeD::xmeet( const Type *t ) const {
1207   // Perform a fast test for common case; meeting the same types together.
1208   if( this == t ) return this;  // Meeting same type-rep?
1209 
1210   // Current "this->_base" is DoubleCon
1211   switch (t->base()) {          // Switch on original type
1212   case AnyPtr:                  // Mixing with oops happens when javac
1213   case RawPtr:                  // reuses local variables
1214   case OopPtr:
1215   case InstPtr:
1216   case AryPtr:
1217   case MetadataPtr:




 428 
 429   current->set_type_arena(shared_type_arena);
 430   _shared_type_dict =
 431     new (shared_type_arena) Dict( (CmpKey)Type::cmp, (Hash)Type::uhash,
 432                                   shared_type_arena, 128 );
 433   current->set_type_dict(_shared_type_dict);
 434 
 435   // Make shared pre-built types.
 436   CONTROL = make(Control);      // Control only
 437   TOP     = make(Top);          // No values in set
 438   MEMORY  = make(Memory);       // Abstract store only
 439   ABIO    = make(Abio);         // State-of-machine only
 440   RETURN_ADDRESS=make(Return_Address);
 441   FLOAT   = make(FloatBot);     // All floats
 442   DOUBLE  = make(DoubleBot);    // All doubles
 443   BOTTOM  = make(Bottom);       // Everything
 444   HALF    = make(Half);         // Placeholder half of doublewide type
 445 
 446   TypeF::ZERO = TypeF::make(0.0); // Float 0 (positive zero)
 447   TypeF::ONE  = TypeF::make(1.0); // Float 1
 448   TypeF::POS_INF = TypeF::make(1.0f/0.0f);  // Float positive infinity
 449   TypeF::NEG_INF = TypeF::make(-1.0f/0.0f); // Float negative infinity
 450 
 451   TypeD::ZERO = TypeD::make(0.0); // Double 0 (positive zero)
 452   TypeD::ONE  = TypeD::make(1.0); // Double 1
 453   TypeD::POS_INF = TypeD::make(1.0d/0.0d);  // Double positive infinity
 454   TypeD::NEG_INF = TypeD::make(-1.0d/0.0d); // Double negative infinity
 455 
 456   TypeInt::MINUS_1 = TypeInt::make(-1);  // -1
 457   TypeInt::ZERO    = TypeInt::make( 0);  //  0
 458   TypeInt::ONE     = TypeInt::make( 1);  //  1
 459   TypeInt::BOOL    = TypeInt::make(0,1,   WidenMin);  // 0 or 1, FALSE or TRUE.
 460   TypeInt::CC      = TypeInt::make(-1, 1, WidenMin);  // -1, 0 or 1, condition codes
 461   TypeInt::CC_LT   = TypeInt::make(-1,-1, WidenMin);  // == TypeInt::MINUS_1
 462   TypeInt::CC_GT   = TypeInt::make( 1, 1, WidenMin);  // == TypeInt::ONE
 463   TypeInt::CC_EQ   = TypeInt::make( 0, 0, WidenMin);  // == TypeInt::ZERO
 464   TypeInt::CC_LE   = TypeInt::make(-1, 0, WidenMin);
 465   TypeInt::CC_GE   = TypeInt::make( 0, 1, WidenMin);  // == TypeInt::BOOL
 466   TypeInt::BYTE    = TypeInt::make(-128,127,     WidenMin); // Bytes
 467   TypeInt::UBYTE   = TypeInt::make(0, 255,       WidenMin); // Unsigned Bytes
 468   TypeInt::CHAR    = TypeInt::make(0,65535,      WidenMin); // Java chars
 469   TypeInt::SHORT   = TypeInt::make(-32768,32767, WidenMin); // Java shorts
 470   TypeInt::POS     = TypeInt::make(0,max_jint,   WidenMin); // Non-neg values
 471   TypeInt::POS1    = TypeInt::make(1,max_jint,   WidenMin); // Positive values
 472   TypeInt::INT     = TypeInt::make(min_jint,max_jint, WidenMax); // 32-bit integers
 473   TypeInt::SYMINT  = TypeInt::make(-max_jint,max_jint,WidenMin); // symmetric range
 474   TypeInt::TYPE_DOMAIN  = TypeInt::INT;


1074 }
1075 #endif
1076 
1077 //------------------------------typerr-----------------------------------------
1078 void Type::typerr( const Type *t ) const {
1079 #ifndef PRODUCT
1080   tty->print("\nError mixing types: ");
1081   dump();
1082   tty->print(" and ");
1083   t->dump();
1084   tty->print("\n");
1085 #endif
1086   ShouldNotReachHere();
1087 }
1088 
1089 
1090 //=============================================================================
1091 // Convenience common pre-built types.
1092 const TypeF *TypeF::ZERO;       // Floating point zero
1093 const TypeF *TypeF::ONE;        // Floating point one
1094 const TypeF *TypeF::POS_INF;    // Floating point positive infinity
1095 const TypeF *TypeF::NEG_INF;    // Floating point negative infinity
1096 
1097 //------------------------------make-------------------------------------------
1098 // Create a float constant
1099 const TypeF *TypeF::make(float f) {
1100   return (TypeF*)(new TypeF(f))->hashcons();
1101 }
1102 
1103 //------------------------------meet-------------------------------------------
1104 // Compute the MEET of two types.  It returns a new Type object.
1105 const Type *TypeF::xmeet( const Type *t ) const {
1106   // Perform a fast test for common case; meeting the same types together.
1107   if( this == t ) return this;  // Meeting same type-rep?
1108 
1109   // Current "this->_base" is FloatCon
1110   switch (t->base()) {          // Switch on original type
1111   case AnyPtr:                  // Mixing with oops happens when javac
1112   case RawPtr:                  // reuses local variables
1113   case OopPtr:
1114   case InstPtr:
1115   case AryPtr:


1184   st->print("%f", _f);
1185 }
1186 #endif
1187 
1188 //------------------------------singleton--------------------------------------
1189 // TRUE if Type is a singleton type, FALSE otherwise.   Singletons are simple
1190 // constants (Ldi nodes).  Singletons are integer, float or double constants
1191 // or a single symbol.
1192 bool TypeF::singleton(void) const {
1193   return true;                  // Always a singleton
1194 }
1195 
1196 bool TypeF::empty(void) const {
1197   return false;                 // always exactly a singleton
1198 }
1199 
1200 //=============================================================================
1201 // Convenience common pre-built types.
1202 const TypeD *TypeD::ZERO;       // Floating point zero
1203 const TypeD *TypeD::ONE;        // Floating point one
1204 const TypeD *TypeD::POS_INF;    // Floating point positive infinity
1205 const TypeD *TypeD::NEG_INF;    // Floating point negative infinity
1206 
1207 //------------------------------make-------------------------------------------
1208 const TypeD *TypeD::make(double d) {
1209   return (TypeD*)(new TypeD(d))->hashcons();
1210 }
1211 
1212 //------------------------------meet-------------------------------------------
1213 // Compute the MEET of two types.  It returns a new Type object.
1214 const Type *TypeD::xmeet( const Type *t ) const {
1215   // Perform a fast test for common case; meeting the same types together.
1216   if( this == t ) return this;  // Meeting same type-rep?
1217 
1218   // Current "this->_base" is DoubleCon
1219   switch (t->base()) {          // Switch on original type
1220   case AnyPtr:                  // Mixing with oops happens when javac
1221   case RawPtr:                  // reuses local variables
1222   case OopPtr:
1223   case InstPtr:
1224   case AryPtr:
1225   case MetadataPtr:


< prev index next >