-
Enhancement
-
Resolution: Won't Implement
-
Not Prioritized
-
Code Generation Tools
-
CODEGEN-9190
-
-
default
-
--fp_mode=strict compiler option should be used for this purpose.
For these assignments to float variables ...
f1 = 540.0f; f2 = f1 / (728.0f) ; f3 = 540.0f / (728.0f) ;
Note f2 and f3 should get the same value. However, when this code is built with optimization level 3, slightly different values are assigned. Here are some key lines from the compiler generated assembly code ...
MOVIZ R1H,#16189 ; [CPU_FPU] |8| MOVIZ R0H,#16189 ; [CPU_FPU] |9| MOVIZ R2H,#17415 ; [CPU_FPU] |7| MOVW DP,#_f1 ; [CPU_ARAU] MOVXI R1H,#58335 ; [CPU_FPU] |8| MOVXI R0H,#58334 ; [CPU_FPU] |9| MOV32 @_f1,R2H ; [CPU_FPU] |7| MOV32 @_f2,R1H ; [CPU_FPU] |8| MOV32 @_f3,R0H ; [CPU_FPU] |9|
The two MOVXI instructions should assign the same value. But they are off by 1.