< prev index next >

src/hotspot/share/opto/mulnode.cpp

Print this page




 218     } else {
 219       return MulNode::Ideal(phase, can_reshape);
 220     }
 221   }
 222 
 223   if( sign_flip ) {             // Need to negate result?
 224     res = phase->transform(res);// Transform, before making the zero con
 225     res = new SubINode(phase->intcon(0),res);
 226   }
 227 
 228   return res;                   // Return final result
 229 }
 230 
 231 //------------------------------mul_ring---------------------------------------
 232 // Compute the product type of two integer ranges into this node.
 233 const Type *MulINode::mul_ring(const Type *t0, const Type *t1) const {
 234   const TypeInt *r0 = t0->is_int(); // Handy access
 235   const TypeInt *r1 = t1->is_int();
 236 
 237   // Fetch endpoints of all ranges
 238   int32_t lo0 = r0->_lo;
 239   double a = (double)lo0;
 240   int32_t hi0 = r0->_hi;
 241   double b = (double)hi0;
 242   int32_t lo1 = r1->_lo;
 243   double c = (double)lo1;
 244   int32_t hi1 = r1->_hi;
 245   double d = (double)hi1;
 246 
 247   // Compute all endpoints & check for overflow
 248   int32_t A = java_multiply(lo0, lo1);
 249   if( (double)A != a*c ) return TypeInt::INT; // Overflow?
 250   int32_t B = java_multiply(lo0, hi1);
 251   if( (double)B != a*d ) return TypeInt::INT; // Overflow?
 252   int32_t C = java_multiply(hi0, lo1);
 253   if( (double)C != b*c ) return TypeInt::INT; // Overflow?
 254   int32_t D = java_multiply(hi0, hi1);
 255   if( (double)D != b*d ) return TypeInt::INT; // Overflow?
 256 
 257   if( A < B ) { lo0 = A; hi0 = B; } // Sort range endpoints
 258   else { lo0 = B; hi0 = A; }
 259   if( C < D ) {
 260     if( C < lo0 ) lo0 = C;
 261     if( D > hi0 ) hi0 = D;
 262   } else {
 263     if( D < lo0 ) lo0 = D;
 264     if( C > hi0 ) hi0 = C;




 218     } else {
 219       return MulNode::Ideal(phase, can_reshape);
 220     }
 221   }
 222 
 223   if( sign_flip ) {             // Need to negate result?
 224     res = phase->transform(res);// Transform, before making the zero con
 225     res = new SubINode(phase->intcon(0),res);
 226   }
 227 
 228   return res;                   // Return final result
 229 }
 230 
 231 //------------------------------mul_ring---------------------------------------
 232 // Compute the product type of two integer ranges into this node.
 233 const Type *MulINode::mul_ring(const Type *t0, const Type *t1) const {
 234   const TypeInt *r0 = t0->is_int(); // Handy access
 235   const TypeInt *r1 = t1->is_int();
 236 
 237   // Fetch endpoints of all ranges
 238   jint lo0 = r0->_lo;
 239   double a = (double)lo0;
 240   jint hi0 = r0->_hi;
 241   double b = (double)hi0;
 242   jint lo1 = r1->_lo;
 243   double c = (double)lo1;
 244   jint hi1 = r1->_hi;
 245   double d = (double)hi1;
 246 
 247   // Compute all endpoints & check for overflow
 248   int32_t A = java_multiply(lo0, lo1);
 249   if( (double)A != a*c ) return TypeInt::INT; // Overflow?
 250   int32_t B = java_multiply(lo0, hi1);
 251   if( (double)B != a*d ) return TypeInt::INT; // Overflow?
 252   int32_t C = java_multiply(hi0, lo1);
 253   if( (double)C != b*c ) return TypeInt::INT; // Overflow?
 254   int32_t D = java_multiply(hi0, hi1);
 255   if( (double)D != b*d ) return TypeInt::INT; // Overflow?
 256 
 257   if( A < B ) { lo0 = A; hi0 = B; } // Sort range endpoints
 258   else { lo0 = B; hi0 = A; }
 259   if( C < D ) {
 260     if( C < lo0 ) lo0 = C;
 261     if( D > hi0 ) hi0 = D;
 262   } else {
 263     if( D < lo0 ) lo0 = D;
 264     if( C > hi0 ) hi0 = C;


< prev index next >