Re: Floating-point comparisons in the middle-end

2022-09-01 Thread Joseph Myers
On Thu, 1 Sep 2022, FX via Gcc wrote: > The next thing I need to tackle for Fortran is the implementation of > functions that perform maxNum, maxNumMag, minNum, and minNumMag. Am I > correct in assuming that maxNum and minNum correspond to fmin and fmax? Yes (note that maxNum and minNum were

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread Joseph Myers
On Thu, 1 Sep 2022, FX via Gcc wrote: > I have a Fortran patch ready to submit, but before I do so I’d like to > know: do you support or oppose a __builtin_iseqsig()? I support having such a built-in function. -- Joseph S. Myers jos...@codesourcery.com

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread FX via Gcc
> See N3047 Annex F for the current bindings (there have been a lot of > changes to the C2x working draft after N3047 in the course of editorial > review, but I don't think any of them affect the IEEE bindings for > comparisons). Thanks for the pointer, it is very helpful. The next thing I

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread FX via Gcc
Hi Joseph, I have a Fortran patch ready to submit, but before I do so I’d like to know: do you support or oppose a __builtin_iseqsig()? Jakub said he was against, but deferred to you on that. For me, it makes the Fortran front-end part slightly simpler, so if it is decided to go that route

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread FX via Gcc
For the record, this is now PR 106805 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106805 FX

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread Joseph Myers
On Thu, 1 Sep 2022, FX via Gcc wrote: > Do you want me to file a bug report? Yes. -- Joseph S. Myers jos...@codesourcery.com

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread FX via Gcc
> Presumably that can be reproduced without depending on the new built-in > function? In which case it's an existing bug somewhere in the optimizers. Yes: $ cat a.c #include #include #include void foo (void) { if (fetestexcept (FE_INVALID) & FE_INVALID) printf("Invalid raised\n");

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread Joseph Myers
On Thu, 1 Sep 2022, Marc Glisse via Gcc wrote: > On Thu, 1 Sep 2022, Joseph Myers wrote: > > > On Thu, 1 Sep 2022, FX via Gcc wrote: > > > > > A tentative patch is attached, it seems to work well on simple examples, > > > but for test coverage the hard part is going to be that the comparisons >

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread Marc Glisse via Gcc
On Thu, 1 Sep 2022, Joseph Myers wrote: On Thu, 1 Sep 2022, FX via Gcc wrote: A tentative patch is attached, it seems to work well on simple examples, but for test coverage the hard part is going to be that the comparisons seem to be optimised away very easily into their non-signaling

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread Joseph Myers
On Thu, 1 Sep 2022, FX via Gcc wrote: > A tentative patch is attached, it seems to work well on simple examples, > but for test coverage the hard part is going to be that the comparisons > seem to be optimised away very easily into their non-signaling versions. > Basically, if I do:

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread Joseph Myers
On Thu, 1 Sep 2022, FX via Gcc wrote: > 1. Is this list normative, and was it modified later (I have only found > a 2012 draft)? See N3047 Annex F for the current bindings (there have been a lot of changes to the C2x working draft after N3047 in the course of editorial review, but I don't

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread Segher Boessenkool
On Thu, Sep 01, 2022 at 10:19:59AM +0200, Jakub Jelinek via Gcc wrote: > On Thu, Sep 01, 2022 at 10:04:58AM +0200, FX wrote: > > 2. All the functions are available as GCC type-generic built-ins (yeah!), > > except there is no __builtin_ iseqsig > >

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread FX via Gcc
Hi, > Dunno if we really need a builtin for this, especially if it is lowered > to that x >= y && x <= y early, will defer to Joseph. I think it’d be nice to have one for consistency, as the other standard floating-point functions are there. It would also make things slightly easier for our

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread Jakub Jelinek via Gcc
On Thu, Sep 01, 2022 at 11:04:03AM +0200, FX wrote: > Hi Jakub, > > >> 2. All the functions are available as GCC type-generic built-ins (yeah!), > >> except there is no __builtin_ iseqsig > >> (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77928). Is there a > >> fundamental problem with

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread FX via Gcc
Hi Jakub, >> 2. All the functions are available as GCC type-generic built-ins (yeah!), >> except there is no __builtin_ iseqsig >> (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77928). Is there a >> fundamental problem with creating one, and could someone help there? > > IMHO until that one is

Re: Floating-point comparisons in the middle-end

2022-09-01 Thread Jakub Jelinek via Gcc
On Thu, Sep 01, 2022 at 10:04:58AM +0200, FX wrote: > Fortran 2018 introduced intrinsic functions for all the IEEE-754 comparison > operations, compareQuiet* and compareSignaling* I want to introduce those > into the Fortran front-end, and make them emit the right code. But cannot > find the

Floating-point comparisons in the middle-end

2022-09-01 Thread FX via Gcc
Hi, Fortran 2018 introduced intrinsic functions for all the IEEE-754 comparison operations, compareQuiet* and compareSignaling* I want to introduce those into the Fortran front-end, and make them emit the right code. But cannot find the correspondance between IEEE-754 nomenclature and GCC