Date: Wed, 13 Mar 2019 08:50:09 -0700 From: Steve Kargl <sgk@troutmask.apl.washington.edu> To: Hans Petter Selasky <hps@selasky.org> Cc: freebsd-toolchain@freebsd.org, freebsd-current@freebsd.org Subject: Re: Optimization bug with floating-point? Message-ID: <20190313155009.GA34852@troutmask.apl.washington.edu> In-Reply-To: <14ead2c2-b586-309d-947f-1395b5284dd1@selasky.org> References: <20190313024506.GA31746@troutmask.apl.washington.edu> <20190313151635.GA34757@troutmask.apl.washington.edu> <14ead2c2-b586-309d-947f-1395b5284dd1@selasky.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 13, 2019 at 04:41:51PM +0100, Hans Petter Selasky wrote: > On 3/13/19 4:16 PM, Steve Kargl wrote: > > On Tue, Mar 12, 2019 at 07:45:41PM -0700, Steve Kargl wrote: > >> > >> 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) > >> > > > > clang agrees with gcc8 if one changes ... > > > >> int > >> main(void) > >> { > >> double re, im, u, ur, ui; > >> float complex f; > >> float x, y; > > > > this line to "volatile float x, y". > > > > Can you try to use: > > #define sincos(x,p,q) do { \ > *(p) = sin(x); \ > *(q) = cos(x); \ > } while (0) > > > Instead of libm's sincos(). Might be a bug in there. > 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. -- Steve
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190313155009.GA34852>