Optimization bug with floating-point?
Hans Petter Selasky
hps at selasky.org
Wed Mar 13 15:56:54 UTC 2019
On 3/13/19 4:50 PM, Steve Kargl wrote:
> Using sin() and cos() directly as in
>
> /* Double precision csinh() without using C's double complex.s */
> void
> dp_csinh(double x, double y, double *re, double *im)
> {
> double c, s;
> *re = sinh(x) * cos(y);
> *im = cosh(x) * sin(y);
> }
>
> does not change the result. I'll also note that libm
> is compiled by clang, and I do not recompile it for the
> tests. Both gcc8 and cc are using the same libm.
>
> I've also tested clang of amd64 with the -m32, it fails
> as well.
Hi,
I cannot see this is failing with 11-stable userland. Can you check with
objdump() that clang doesn't optimise it to sincos() ?
FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on
LLVM 3.8.0)
Target: x86_64-unknown-freebsd11.0
Thread model: posix
InstalledDir: /usr/bin
cc -lm -O2 -Wall test.c && ./a.out
Max ULP: 2.297073
Count: 0
clang40 -lm -O2 test6.c
> ./a.out
Max ULP: 2.297073
Count: 0
clang50 -lm -O2 test6.c
> ./a.out
Max ULP: 2.297073
Count: 0
clang60 -lm -O2 test6.c
> ./a.out
Max ULP: 2.297073
Count: 0
--HPS
More information about the freebsd-toolchain
mailing list