Re: [PATCH] Fix wrong optimization of conditional expression with enumeration type

2025-04-18 Thread Eric Botcazou
> I'd reword this to > > "Similarly, TYPE_UNSIGNED is false for components of vector masks and > possibly for boolean types in languages other than C." > > That is, the C/middle-end boolean_type_node is always unsigned. OK, thanks, I have installed the attached patch. -- Eric Botcazoudiff --gi

Re: [PATCH] Fix wrong optimization of conditional expression with enumeration type

2025-04-17 Thread Richard Biener
On Thu, Apr 17, 2025 at 2:10 PM Eric Botcazou wrote: > > > That looks like a good place - can we possibly say sth about signedness a > > well? IIRC all languages have unsigned bools but vector mask components are > > signed bools? > > Not really the right person to answer the above second ? I'm af

Re: [PATCH] Fix wrong optimization of conditional expression with enumeration type

2025-04-17 Thread Eric Botcazou
> That looks like a good place - can we possibly say sth about signedness a > well? IIRC all languages have unsigned bools but vector mask components are > signed bools? Not really the right person to answer the above second ? I'm afraid. diff --git a/gcc/tree.def b/gcc/tree.def index c4ad8d08f10

Re: [PATCH] Fix wrong optimization of conditional expression with enumeration type

2025-04-17 Thread Richard Biener
On Thu, Apr 17, 2025 at 10:19 AM Eric Botcazou wrote: > > > LGTM. I do wonder if this could be documented somewhere if not > > already. Because I suspect there are other places which miss that if > > TYPE_PRECISION are equal, you might still need a cast for boolean > > types. Maybe a helper functi

Re: [PATCH] Fix wrong optimization of conditional expression with enumeration type

2025-04-17 Thread Eric Botcazou
> LGTM. I do wonder if this could be documented somewhere if not > already. Because I suspect there are other places which miss that if > TYPE_PRECISION are equal, you might still need a cast for boolean > types. Maybe a helper function might be useful too. The knowledge is indeed encoded in usele

Re: [PATCH] Fix wrong optimization of conditional expression with enumeration type

2025-04-16 Thread Richard Biener
> Am 16.04.2025 um 15:24 schrieb Eric Botcazou : > > Hi, > > this is a regression introduced on the mainline and 14 branch by: > https://gcc.gnu.org/pipermail/gcc-cvs/2023-October/391658.html > > The change bypasses int_fits_type_p (essentially) to work around the > signedness constraints,

Re: [PATCH] Fix wrong optimization of conditional expression with enumeration type

2025-04-16 Thread Andrew Pinski
On Wed, Apr 16, 2025 at 6:25 AM Eric Botcazou wrote: > > Hi, > > this is a regression introduced on the mainline and 14 branch by: > https://gcc.gnu.org/pipermail/gcc-cvs/2023-October/391658.html > > The change bypasses int_fits_type_p (essentially) to work around the > signedness constraints, b

[PATCH] Fix wrong optimization of conditional expression with enumeration type

2025-04-16 Thread Eric Botcazou
Hi, this is a regression introduced on the mainline and 14 branch by: https://gcc.gnu.org/pipermail/gcc-cvs/2023-October/391658.html The change bypasses int_fits_type_p (essentially) to work around the signedness constraints, but in doing so disregards the peculiarities of boolean types whose