Re: On(c)e more: optimizer failure

2021-08-27 Thread Stefan Kanthak
Manuel López-Ibáñez wrote: > FWIW: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24021 Thanks. So this bug may soon have a driver's license in some countries... One more for the road: $ cat wtf.c double wtf(double x) { return sqrt(x * x); // can the square ever be negative? } $ gcc -m64 -o-

Re: On(c)e more: optimizer failure

2021-08-25 Thread Manuel López-Ibáñez
FWIW: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24021 Cheers, Manuel.

Re: On(c)e more: optimizer failure

2021-08-23 Thread Stefan Kanthak
Gabriel Ravier wrote: > On 8/23/21 3:46 PM, Stefan Kanthak wrote: >> JFTR: do you consider your wild speculations to be on-topic here? > > I suppose I should apologize: I did not intend to make any accusations > here. No need to, I can stand a little heat. [...] > I also had been rather ange

Re: On(c)e more: optimizer failure

2021-08-23 Thread Gabriel Ravier via Gcc
On 8/23/21 3:46 PM, Stefan Kanthak wrote: > Gabriel Ravier wrote: > >> On 8/22/21 11:22 PM, Stefan Kanthak wrote: > > [ 2bugzilla | !2bugzilla ] > >>> You (and everybody else) if free to use GCC bugzilla. >>> Everybody and me is but also free NOT to use GCC bugzilla. >>> >>> Stefan >> >> Yes, you

Re: On(c)e more: optimizer failure

2021-08-23 Thread Stefan Kanthak
Gabriel Ravier wrote: > On 8/22/21 11:22 PM, Stefan Kanthak wrote: [ 2bugzilla | !2bugzilla ] >> You (and everybody else) if free to use GCC bugzilla. >> Everybody and me is but also free NOT to use GCC bugzilla. >> >> Stefan > > Yes, you are free not to use the GCC Bugzilla. And GCC developer

Re: On(c)e more: optimizer failure

2021-08-23 Thread Gabriel Ravier via Gcc
On 8/22/21 11:22 PM, Stefan Kanthak wrote: Gabriel Ravier wrote: On 8/21/21 10:19 PM, Stefan Kanthak wrote: Jakub Jelinek wrote: [...] You should file missed optimizations into gcc bugzilla where they can be seen any time. You should better implement such missing optimisations your users

Re: On(c)e more: optimizer failure

2021-08-22 Thread Jonathan Wakely via Gcc
On Sun, 22 Aug 2021, 22:27 Stefan Kanthak, wrote: > Gabriel Ravier wrote: > > > On 8/21/21 10:19 PM, Stefan Kanthak wrote: > >> Jakub Jelinek wrote: > > [...] > > >>> GCC doesn't do value range propagation of floating point values, not > even > >>> the special ones like NaNs, infinities, +/- ze

Re: On(c)e more: optimizer failure

2021-08-22 Thread Stefan Kanthak
Gabriel Ravier wrote: > On 8/21/21 10:19 PM, Stefan Kanthak wrote: >> Jakub Jelinek wrote: [...] >>> GCC doesn't do value range propagation of floating point values, not even >>> the special ones like NaNs, infinities, +/- zeros etc., and without that the >>> earlier ifs aren't taken into acco

Re: On(c)e more: optimizer failure

2021-08-22 Thread Jonathan Wakely via Gcc
On Sun, 22 Aug 2021, 06:38 Gabriel Ravier wrote: > On 8/21/21 10:19 PM, Stefan Kanthak wrote: > > I don't have a bugzilla account, and I don't use GCC for anything > serious. > > > > Stefan > > It's *that* demanding for you to create a Bugzilla account ? From my > experience, creating a Bugzilla a

Re: On(c)e more: optimizer failure

2021-08-21 Thread Gabriel Ravier via Gcc
On 8/21/21 10:19 PM, Stefan Kanthak wrote: Jakub Jelinek wrote: On Sat, Aug 21, 2021 at 09:40:16PM +0200, Stefan Kanthak wrote: I believe your example doesn't take into account that the values can be NaN which compares false in all situations. That's a misbelief! Please notice the first if-c

Re: On(c)e more: optimizer failure

2021-08-21 Thread Stefan Kanthak
Jakub Jelinek wrote: > On Sat, Aug 21, 2021 at 09:40:16PM +0200, Stefan Kanthak wrote: >> > I believe your example doesn't take into account that the values can be NaN >> > which compares false in all situations. >> >> That's a misbelief! >> Please notice the first if-clause, which rules out NaN

Re: On(c)e more: optimizer failure

2021-08-21 Thread Jakub Jelinek via Gcc
On Sat, Aug 21, 2021 at 09:40:16PM +0200, Stefan Kanthak wrote: > > I believe your example doesn't take into account that the values can be NaN > > which compares false in all situations. > > That's a misbelief! > Please notice the first if-clause, which rules out NaNs for both arguments. > Also n

Re: On(c)e more: optimizer failure

2021-08-21 Thread Matt Godbolt
Ok! Thanks; sorry for the misunderstanding on my side. --matt On Sat, Aug 21, 2021 at 2:53 PM Stefan Kanthak wrote: > Matt Godbolt wrote: > > > I believe your example doesn't take into account that the values can be > NaN > > which compares false in all situations. > > That's a misbelief! > Pl

Re: On(c)e more: optimizer failure

2021-08-21 Thread Stefan Kanthak
Matt Godbolt wrote: > I believe your example doesn't take into account that the values can be NaN > which compares false in all situations. That's a misbelief! Please notice the first if-clause, which rules out NaNs for both arguments. Also notice that GCC did NOT generate JP after the 4 COMISD

Re: On(c)e more: optimizer failure

2021-08-21 Thread Matt Godbolt
I believe your example doesn't take into account that the values can be NaN which compares false in all situations. If you allow the compiler to optimize without supporting NaN (-ffast-math), I think it generates the code you want: https://godbolt.org/z/1ra7zcsnd --matt On Sat, Aug 21, 2021 at 1:

On(c)e more: optimizer failure

2021-08-21 Thread Stefan Kanthak
Hi, the following snippet is from the nextafter() function of --- repro.c --- #define Zero 0.0 double nextafter(double argx, double argy) { double z = argx; if (isnan(argx) || isnan(argy)) return argx + argy; if (argx == argy) return argx;