[llvm-commits] [llvm] r128545 - in /llvm/trunk: include/llvm/ADT/APFloat.h lib/Support/APFloat.cpp unittests/ADT/APFloatTest.cpp

Benjamin Kramer benny.kra at googlemail.com
Wed Mar 30 10:08:38 PDT 2011


On 30.03.2011, at 18:11, Stephen Canon wrote:

> What will this patch do on a platform where denormals are treated as zero?
> 
> Specifically, I'm interested in a case like this:
> 
> 	float a;
> 	float b = a / 0x1.0p127f;
> 
> If this is converted into the reciprocal multiply by 0x0.8p-126f (a denormal value), on platforms where denormals are treated as zero (the default state on many ARM cores, cell BE, and GPUs), this will become a multiplication by zero, which is incorrect.
> 
> The "safe" range of divisors that can be optimized into reciprocal multiplies with regard to this issue, for any IEEE-754 type, is +/-[minNormal, 1/minNormal].

Hi Steve,

Thanks for the quick review. I changed the code to avoid denormal multiplications in r128555.

I wonder how (llvm-)gcc deals with this, on x86 it turns divisions into subnormal multiplications, is there
some target specific setting that disables it on ARM and other "odd" platforms?



More information about the llvm-commits mailing list