Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-31 Thread Jeff Law via Gcc-patches
On 8/29/2022 8:30 AM, Aldy Hernandez via Gcc-patches wrote: On Mon, Aug 29, 2022 at 4:27 PM Jakub Jelinek wrote: On Mon, Aug 29, 2022 at 04:20:16PM +0200, Aldy Hernandez wrote: Sure, I can add the HONOR_NANS, but can we even "see" a NAN in the IL for -ffinite-math-only? Sure, you can, e.g.

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-31 Thread Jeff Law via Gcc-patches
On 8/29/2022 8:42 AM, Toon Moene wrote: On 8/29/22 16:36, Aldy Hernandez wrote: On Mon, Aug 29, 2022 at 4:30 PM Toon Moene wrote: On 8/29/22 16:15, Aldy Hernandez wrote: But even with -ffinite-math-only, is there any benefit to propagating a known NAN?  For example: The original inten

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-31 Thread Jeff Law via Gcc-patches
On 8/29/2022 8:15 AM, Aldy Hernandez via Gcc-patches wrote: On Mon, Aug 29, 2022 at 4:08 PM Toon Moene wrote: On 8/29/22 15:54, Jakub Jelinek via Gcc-patches wrote: On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: For convenience, singleton_p() returns false for a NAN. IMO

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-31 Thread Jeff Law via Gcc-patches
On 8/29/2022 7:54 AM, Jakub Jelinek via Gcc-patches wrote: On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: For convenience, singleton_p() returns false for a NAN. IMO, it makes the implementation cleaner, but I'm not wed to the idea if someone objects. If singleton_p() is us

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-30 Thread Joseph Myers
On Mon, 29 Aug 2022, Jakub Jelinek via Gcc-patches wrote: > On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: > > For convenience, singleton_p() returns false for a NAN. IMO, it makes > > the implementation cleaner, but I'm not wed to the idea if someone > > objects. > > If singlet

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-30 Thread Aldy Hernandez via Gcc-patches
> > > > Thanks. > > Aldy > > > > Yep, I think that would do it. > > Thanks, > > -- > Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290 > Saturnushof 14, 3738 XG Maartensdijk, The Netherlands > From 7ded1c025a44d9e3e141bd1c7694aef3931acb6

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Toon Moene
On 8/29/22 16:36, Aldy Hernandez wrote: On Mon, Aug 29, 2022 at 4:30 PM Toon Moene wrote: On 8/29/22 16:15, Aldy Hernandez wrote: But even with -ffinite-math-only, is there any benefit to propagating a known NAN? For example: The original intent (in 2002) for the option -ffinite-math-onl

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 4:30 PM Toon Moene wrote: > > On 8/29/22 16:15, Aldy Hernandez wrote: > > > But even with -ffinite-math-only, is there any benefit to propagating > > a known NAN? For example: > > The original intent (in 2002) for the option -ffinite-math-only was for > the optimizers to i

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 4:27 PM Jakub Jelinek wrote: > > On Mon, Aug 29, 2022 at 04:20:16PM +0200, Aldy Hernandez wrote: > > Sure, I can add the HONOR_NANS, but can we even "see" a NAN in the IL > > for -ffinite-math-only? > > Sure, you can, e.g. __builtin_nan{,s}{,f,l} etc. would do it. > It woul

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Toon Moene
On 8/29/22 16:15, Aldy Hernandez wrote: But even with -ffinite-math-only, is there any benefit to propagating a known NAN? For example: The original intent (in 2002) for the option -ffinite-math-only was for the optimizers to ignore all the various exceptions to common optimizations because

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Jakub Jelinek via Gcc-patches
On Mon, Aug 29, 2022 at 04:20:16PM +0200, Aldy Hernandez wrote: > Sure, I can add the HONOR_NANS, but can we even "see" a NAN in the IL > for -ffinite-math-only? Sure, you can, e.g. __builtin_nan{,s}{,f,l} etc. would do it. It would be UB to use it at runtime in -ffinite-math-only code though. Ano

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 4:17 PM Jakub Jelinek wrote: > > On Mon, Aug 29, 2022 at 04:08:58PM +0200, Aldy Hernandez wrote: > > On Mon, Aug 29, 2022 at 3:55 PM Jakub Jelinek wrote: > > > > > > On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: > > > > For convenience, singleton_p() retu

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Jakub Jelinek via Gcc-patches
On Mon, Aug 29, 2022 at 04:08:58PM +0200, Aldy Hernandez wrote: > On Mon, Aug 29, 2022 at 3:55 PM Jakub Jelinek wrote: > > > > On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: > > > For convenience, singleton_p() returns false for a NAN. IMO, it makes > > > the implementation clean

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 4:08 PM Toon Moene wrote: > > On 8/29/22 15:54, Jakub Jelinek via Gcc-patches wrote: > > > On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: > > >> For convenience, singleton_p() returns false for a NAN. IMO, it makes > >> the implementation cleaner, but I'm

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Aldy Hernandez via Gcc-patches
On Mon, Aug 29, 2022 at 3:55 PM Jakub Jelinek wrote: > > On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: > > For convenience, singleton_p() returns false for a NAN. IMO, it makes > > the implementation cleaner, but I'm not wed to the idea if someone > > objects. > > If singleton_p

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Toon Moene
On 8/29/22 15:54, Jakub Jelinek via Gcc-patches wrote: On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: For convenience, singleton_p() returns false for a NAN. IMO, it makes the implementation cleaner, but I'm not wed to the idea if someone objects. If singleton_p() is used

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Jakub Jelinek via Gcc-patches
On Mon, Aug 29, 2022 at 03:45:33PM +0200, Aldy Hernandez wrote: > For convenience, singleton_p() returns false for a NAN. IMO, it makes > the implementation cleaner, but I'm not wed to the idea if someone > objects. If singleton_p() is used to decide whether one can just replace a variable with s

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-29 Thread Aldy Hernandez via Gcc-patches
or the following snippet with -O2 > > -fno-signed-zeros -fdump-tree-phiopt-folding... > > > > float f0(float A) > > { > > // A == 0? A : -Asame as -A > > if (A == 0) return A; > > return -A; > > } > > > > ...the phiopt2 dump

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-26 Thread Andrew Pinski via Gcc-patches
On Fri, Aug 26, 2022 at 12:16 PM Aldy Hernandez wrote: > > On Fri, Aug 26, 2022 at 7:40 PM Andrew Pinski wrote: > > > > On Fri, Aug 26, 2022 at 8:55 AM Aldy Hernandez wrote: > > > > > > [pinskia: I'm CCing you as the author of the match.pd pattern.] > > > > > > So, as I wrap up the work here (la

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-26 Thread Aldy Hernandez via Gcc-patches
On Fri, Aug 26, 2022 at 7:40 PM Andrew Pinski wrote: > > On Fri, Aug 26, 2022 at 8:55 AM Aldy Hernandez wrote: > > > > [pinskia: I'm CCing you as the author of the match.pd pattern.] > > > > So, as I wrap up the work here (latest patch attached), I see there's > > another phiopt regression (not s

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-26 Thread Aldy Hernandez via Gcc-patches
On Fri, Aug 26, 2022, 19:40 Andrew Pinski wrote: > On Fri, Aug 26, 2022 at 8:55 AM Aldy Hernandez wrote: > > > > [pinskia: I'm CCing you as the author of the match.pd pattern.] > > > > So, as I wrap up the work here (latest patch attached), I see there's > > another phiopt regression (not spaces

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-26 Thread Andrew Pinski via Gcc-patches
On Fri, Aug 26, 2022 at 8:55 AM Aldy Hernandez wrote: > > [pinskia: I'm CCing you as the author of the match.pd pattern.] > > So, as I wrap up the work here (latest patch attached), I see there's > another phiopt regression (not spaceship related). I was hoping > someone could either give me a ha

Re: [PATCH] Add support for floating point endpoints to frange.

2022-08-26 Thread Aldy Hernandez via Gcc-patches
ething that can be done by improving the match.pd pattern, or should be done elsewhere? Thanks. Aldy From a1f64017defaf6d5841b54e8bc867d63738a9f5c Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Tue, 23 Aug 2022 13:36:33 +0200 Subject: [PATCH] Add support for floating point endpoints to frange. The

[PATCH] Add support for floating point endpoints to frange.

2022-08-23 Thread Aldy Hernandez via Gcc-patches
The current implementation of frange is just a type with some bits to represent NAN and INF. We can do better and represent endpoints to ultimately solve longstanding PRs such as PR24021. This patch adds these endpoints. In follow-up patches I will add support for relational operators using them