Displaying 1 result from an estimated 1 matches for "cvtsd2ss".
Did you mean:
cvtsd2si
2015 Aug 21
2
The semantics of the fptrunc instruction with an example of incorrect optimisation
...variable x is being handled using LLVM IR's ``fptrunc``
```
...
store double 3.000000e-01, double* %x, align 8
%call = call i32 @fesetround(i32 0) #3
%0 = load double, double* %x, align 8
%conv = fptrunc double %0 to float
....
```
If I look at the codegened assembly I see that the ``cvtsd2ss`` x86
instruction is used (how rounding is done is controlled by the MXCSR
register apparently). So this instruction might not "truncate"
depending on how MXCSR is set.
If I run the program
```
$ clang -O0 float.c -lm -o float.clang.o0
$ ./float.clang.o0
y (nearest):0x1.333334p-2
y (upw...