Optimization bug with floating-point?

Steve Kargl sgk at troutmask.apl.washington.edu
Wed Mar 13 15:05:54 UTC 2019


On Tue, Mar 12, 2019 at 07:45:41PM -0700, Steve Kargl wrote:
> All,
> 
> There seems to an optimization bug with clang on
> 
> % uname -a
> FreeBSD mobile 13.0-CURRENT FreeBSD 13.0-CURRENT r344653 MOBILE  i386
> 
> IOW, if you do numerica work on i386, you may want to check your
> results.
> 
> The program demonstrating the issue is at the end of this email.
> 
> gcc8 --version
> gcc8 (FreeBSD Ports Collection) 8.3.0
> 
> gcc8 -fno-builtin -o z a.c -lm && ./z
> gcc8 -O -fno-builtin -o z a.c -lm && ./z
> gcc8 -O2 -fno-builtin -o z a.c -lm && ./z
> gcc8 -O3 -fno-builtin -o z a.c -lm && ./z
> 
> Max ULP: 2.297073
> Count: 0           (# of ULP that exceed 21)
> 

The above results do not change if one add -ffloat-store to
the command line.


> cc -O -fno-builtin -o z a.c -lm && ./z
> cc -O2 -fno-builtin -o z a.c -lm && ./z
> cc -O3 -fno-builtin -o z a.c -lm && ./z
> 
> Max ULP: 23.061242
> Count: 39          (# of ULP that exceeds 21)

Clang doesn't support -ffloat-store, so the above does not change.

-- 
Steve


More information about the freebsd-current mailing list