comparison src/share/vm/opto/mulnode.cpp @ 404:78c058bc5cdc

6717150: improper constant folding of subnormal strictfp multiplications and divides Summary: suppress constant folding of double divides and multiplications on ia32 Reviewed-by: never
author rasbold
date Tue, 14 Oct 2008 06:58:58 -0700
parents d1605aabd0a1
children 3b5ac9e7e6ea
comparison
equal deleted inserted replaced
403:b744678d4d71 404:78c058bc5cdc
150 150
151 // Either input is BOTTOM ==> the result is the local BOTTOM 151 // Either input is BOTTOM ==> the result is the local BOTTOM
152 if( t1 == Type::BOTTOM || t2 == Type::BOTTOM ) 152 if( t1 == Type::BOTTOM || t2 == Type::BOTTOM )
153 return bottom_type(); 153 return bottom_type();
154 154
155 #if defined(IA32)
156 // Can't trust native compilers to properly fold strict double
157 // multiplication with round-to-zero on this platform.
158 if (op == Op_MulD && phase->C->method()->is_strict()) {
159 return TypeD::DOUBLE;
160 }
161 #endif
162
155 return mul_ring(t1,t2); // Local flavor of type multiplication 163 return mul_ring(t1,t2); // Local flavor of type multiplication
156 } 164 }
157 165
158 166
159 //============================================================================= 167 //=============================================================================
358 //============================================================================= 366 //=============================================================================
359 //------------------------------mul_ring--------------------------------------- 367 //------------------------------mul_ring---------------------------------------
360 // Compute the product type of two double ranges into this node. 368 // Compute the product type of two double ranges into this node.
361 const Type *MulDNode::mul_ring(const Type *t0, const Type *t1) const { 369 const Type *MulDNode::mul_ring(const Type *t0, const Type *t1) const {
362 if( t0 == Type::DOUBLE || t1 == Type::DOUBLE ) return Type::DOUBLE; 370 if( t0 == Type::DOUBLE || t1 == Type::DOUBLE ) return Type::DOUBLE;
363 // We must be adding 2 double constants. 371 // We must be multiplying 2 double constants.
364 return TypeD::make( t0->getd() * t1->getd() ); 372 return TypeD::make( t0->getd() * t1->getd() );
365 } 373 }
366 374
367 //============================================================================= 375 //=============================================================================
368 //------------------------------Value------------------------------------------ 376 //------------------------------Value------------------------------------------