Re: Optimization bug with floating-point?

From: Hans Petter Selasky <hps_at_selasky.org>
Date: Wed, 13 Mar 2019 16:56:26 +0100
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
Received on Wed Mar 13 2019 - 14:56:54 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:20 UTC