[LLVMdev] Related constant folding of floating point values

Arsen Hakobyan artinetstudio at gmail.com
Wed Oct 9 13:51:35 PDT 2013


Thank you all for your responses.

Just one point I have not understand well. Lets look at this part of IR
code:

store float 0x4020333340000000, float* %a, align 4 
%0 = load float* %a, align 4 
%conv = fpext float %0 to double 
%sub = fsub double %conv, 8.100000e+00 

Here the float value is represented by hexadecimal constant value of float
type ( float 0x4020333340000000). If I have correctly understood the same
hex value can be converted to different result of float or double types
because the IEEE 754 standard specifies a binary32 as having:
(single-precision binary floating-point format)
Sign bit: 1 bit
Exponent width: 8 bits
Significand precision: 24 (23 explicitly stored)

and

a binary64 as having:  (double-precision binary floating-point format)
Sign bit: 1 bit
Exponent width: 11 bits
Significand precision: 53 bits (52 explicitly stored)

After this all, I think that the optimizations should not replace the
conversation:
%conv = fpext float 0x4020333340000000 to double,
with
double 0x4020333340000000
Please note, I have got during the debugging that EarlyCSE transformation
does this.


I think that it should be another constant hexadecimal value when its type
is already a 'double'.

Am I misunderstood anything?

Thanks,
Arsen 



--
View this message in context: http://llvm.1065342.n5.nabble.com/Related-constant-folding-of-floating-point-values-tp61897p61914.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.



More information about the llvm-dev mailing list