src/share/vm/opto/connode.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6823354 Sdiff src/share/vm/opto

src/share/vm/opto/connode.cpp

Print this page
rev 743 : [mq]: 6823354


1234 const Type *MoveF2INode::Value( PhaseTransform *phase ) const {
1235   const Type *t = phase->type( in(1) );
1236   if( t == Type::TOP )       return Type::TOP;
1237   if( t == Type::FLOAT ) return TypeInt::INT;
1238   const TypeF *tf = t->is_float_constant();
1239   JavaValue v;
1240   v.set_jfloat(tf->getf());
1241   return TypeInt::make( v.get_jint() );
1242 }
1243 
1244 //------------------------------Value------------------------------------------
1245 const Type *MoveD2LNode::Value( PhaseTransform *phase ) const {
1246   const Type *t = phase->type( in(1) );
1247   if( t == Type::TOP ) return Type::TOP;
1248   if( t == Type::DOUBLE ) return TypeLong::LONG;
1249   const TypeD *td = t->is_double_constant();
1250   JavaValue v;
1251   v.set_jdouble(td->getd());
1252   return TypeLong::make( v.get_jlong() );
1253 }




















































































1234 const Type *MoveF2INode::Value( PhaseTransform *phase ) const {
1235   const Type *t = phase->type( in(1) );
1236   if( t == Type::TOP )       return Type::TOP;
1237   if( t == Type::FLOAT ) return TypeInt::INT;
1238   const TypeF *tf = t->is_float_constant();
1239   JavaValue v;
1240   v.set_jfloat(tf->getf());
1241   return TypeInt::make( v.get_jint() );
1242 }
1243 
1244 //------------------------------Value------------------------------------------
1245 const Type *MoveD2LNode::Value( PhaseTransform *phase ) const {
1246   const Type *t = phase->type( in(1) );
1247   if( t == Type::TOP ) return Type::TOP;
1248   if( t == Type::DOUBLE ) return TypeLong::LONG;
1249   const TypeD *td = t->is_double_constant();
1250   JavaValue v;
1251   v.set_jdouble(td->getd());
1252   return TypeLong::make( v.get_jlong() );
1253 }
1254 
1255 //------------------------------Ideal------------------------------------------
1256 Node* CountLeadingZerosINode::Ideal(PhaseGVN* phase, bool can_reshape) {
1257   Node* in1 = in(1);
1258   if (in1->is_Con()) {
1259     jint i = phase->type(in1)->is_int()->get_con();
1260     // HD, Figure 5-6
1261     if (i == 0)
1262       return ConINode::make(phase->C, BitsPerInt);
1263     int n = 1;
1264     unsigned int x = i;
1265     if (x >> 16 == 0) { n += 16; x <<= 16; }
1266     if (x >> 24 == 0) { n +=  8; x <<=  8; }
1267     if (x >> 28 == 0) { n +=  4; x <<=  4; }
1268     if (x >> 30 == 0) { n +=  2; x <<=  2; }
1269     n -= x >> 31;
1270     return ConINode::make(phase->C, n);
1271   }
1272   return NULL;
1273 }
1274 
1275 //------------------------------Ideal------------------------------------------
1276 Node* CountLeadingZerosLNode::Ideal(PhaseGVN* phase, bool can_reshape) {
1277   Node* in1 = in(1);
1278   if (in1->is_Con()) {
1279     jlong l = phase->type(in1)->is_long()->get_con();
1280     // HD, Figure 5-6
1281     if (l == 0)
1282       return ConINode::make(phase->C, BitsPerLong);
1283     int n = 1;
1284     unsigned int x = (((julong) l) >> 32);
1285     if (x == 0) { n += 32; x = (int) l; }
1286     if (x >> 16 == 0) { n += 16; x <<= 16; }
1287     if (x >> 24 == 0) { n +=  8; x <<=  8; }
1288     if (x >> 28 == 0) { n +=  4; x <<=  4; }
1289     if (x >> 30 == 0) { n +=  2; x <<=  2; }
1290     n -= x >> 31;
1291     return ConINode::make(phase->C, n);
1292   }
1293   return NULL;
1294 }
1295 
1296 //------------------------------Ideal------------------------------------------
1297 Node* CountTrailingZerosINode::Ideal(PhaseGVN* phase, bool can_reshape) {
1298   Node* in1 = in(1);
1299   if (in1->is_Con()) {
1300     jint i = phase->type(in1)->is_int()->get_con();
1301     // HD, Figure 5-14
1302     int y;
1303     if (i == 0)
1304       return ConINode::make(phase->C, BitsPerInt);
1305     int n = 31;
1306     y = i << 16; if (y != 0) { n = n - 16; i = y; }
1307     y = i <<  8; if (y != 0) { n = n -  8; i = y; }
1308     y = i <<  4; if (y != 0) { n = n -  4; i = y; }
1309     y = i <<  2; if (y != 0) { n = n -  2; i = y; }
1310     y = i <<  1; if (y != 0) { n = n -  1; }
1311     return ConINode::make(phase->C, n);
1312   }
1313   return NULL;
1314 }
1315 
1316 //------------------------------Ideal------------------------------------------
1317 Node* CountTrailingZerosLNode::Ideal(PhaseGVN* phase, bool can_reshape) {
1318   Node* in1 = in(1);
1319   if (in1->is_Con()) {
1320     jlong l = phase->type(in1)->is_long()->get_con();
1321     // HD, Figure 5-14
1322     int x, y;
1323     if (l == 0)
1324       return ConINode::make(phase->C, BitsPerLong);
1325     int n = 63;
1326     y = (int) l; if (y != 0) { n = n - 32; x = y; } else x = (((julong) l) >> 32);
1327     y = x << 16; if (y != 0) { n = n - 16; x = y; }
1328     y = x <<  8; if (y != 0) { n = n -  8; x = y; }
1329     y = x <<  4; if (y != 0) { n = n -  4; x = y; }
1330     y = x <<  2; if (y != 0) { n = n -  2; x = y; }
1331     y = x <<  1; if (y != 0) { n = n -  1; }
1332     return ConINode::make(phase->C, n);
1333   }
1334   return NULL;
1335 }
src/share/vm/opto/connode.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File