Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-06-02 Thread Richard Biener via Gcc-patches
tor lowering eventually turning them into scalar operations and quite some patterns in match.pd applying to ANY_INTEGRAL_TYPE_P. > Revised patch below. The revised patch is OK. Thanks, Richard. > > It would be also good to amend the RTL documentation. > > > > It would be ve

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-06-02 Thread Richard Biener via Gcc-patches
On Fri, Jun 2, 2023 at 11:24 AM Alexander Monakov wrote: > > > On Fri, 2 Jun 2023, Matthias Kretz wrote: > > > > Okay, I see opinions will vary here. I was thinking about our immintrin.h > > > which is partially implemented in terms of generic vectors. Imagine we > > > extend UBSan to trap on

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-06-02 Thread Matthias Kretz via Gcc-patches
On Friday, 2 June 2023 11:24:23 CEST Alexander Monakov wrote: > > > I'm not sure what you consider a breaking change here. Is that the > > > implied > > > threat to use undefinedness for range deduction and other optimizations? > > > > Consider the stdx::simd implementation. It currently follows

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-06-02 Thread Alexander Monakov via Gcc-patches
On Fri, 2 Jun 2023, Matthias Kretz wrote: > > Okay, I see opinions will vary here. I was thinking about our immintrin.h > > which is partially implemented in terms of generic vectors. Imagine we > > extend UBSan to trap on signed overflow for vector types. I expect that > > will blow up on

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-06-02 Thread Matthias Kretz via Gcc-patches
On Friday, 2 June 2023 09:49:26 CEST Alexander Monakov wrote: > > simd x = ...; > > bool t = all_of(x < x + 1); // unconditionally true or not? > > > > I'd expect t to be unconditionally true. Because simd simply is a > > data- parallel version of int. > > Okay, I see opinions will vary here. I

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-06-02 Thread Alexander Monakov via Gcc-patches
On Fri, 2 Jun 2023, Matthias Kretz wrote: > On Thursday, 1 June 2023 20:25:14 CEST Alexander Monakov wrote: > > On Wed, 31 May 2023, Richard Biener wrote: > > > So yes, we probably should clarify the semantics to match the > > > implementation (since we have two targets doing things differently

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-06-02 Thread Matthias Kretz via Gcc-patches
On Thursday, 1 June 2023 20:25:14 CEST Alexander Monakov wrote: > On Wed, 31 May 2023, Richard Biener wrote: > > So yes, we probably should clarify the semantics to match the > > implementation (since we have two targets doing things differently > > since forever we can only document it as UB) and

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-06-01 Thread Alexander Monakov via Gcc-patches
target defined) behavior in the > GENERIC, GIMPLE and RTL ILs and what predicates eventually > control that (like TYPE_OVERFLOW_UNDEFINED). Maybe spread it over > {gimple,generic,rtl}.texi, though gimple.texi is only about the representation > and all semantics are shared and docu

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-05-31 Thread Richard Biener via Gcc-patches
On Tue, May 30, 2023 at 4:49 PM Alexander Monakov wrote: > > > On Thu, 25 May 2023, Richard Biener wrote: > > > On Wed, May 24, 2023 at 8:36 PM Alexander Monakov > > wrote: > > > > > > > > > On Wed, 24 May 2023, Richard Biener via Gcc-patches wrote: > > > > > > > I’d have to check the ISAs what

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-05-30 Thread Alexander Monakov via Gcc-patches
On Thu, 25 May 2023, Richard Biener wrote: > On Wed, May 24, 2023 at 8:36 PM Alexander Monakov wrote: > > > > > > On Wed, 24 May 2023, Richard Biener via Gcc-patches wrote: > > > > > I’d have to check the ISAs what they actually do here - it of course > > > depends > > > on RTL semantics as

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-05-25 Thread Richard Biener via Gcc-patches
On Thu, May 25, 2023 at 8:50 AM Richard Biener wrote: > > On Wed, May 24, 2023 at 8:36 PM Alexander Monakov wrote: > > > > > > On Wed, 24 May 2023, Richard Biener via Gcc-patches wrote: > > > > > I’d have to check the ISAs what they actually do here - it of course > > > depends > > > on RTL

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-05-25 Thread Richard Biener via Gcc-patches
On Wed, May 24, 2023 at 8:36 PM Alexander Monakov wrote: > > > On Wed, 24 May 2023, Richard Biener via Gcc-patches wrote: > > > I’d have to check the ISAs what they actually do here - it of course depends > > on RTL semantics as well but as you say those are not strictly defined here > > either.

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-05-24 Thread Alexander Monakov via Gcc-patches
On Wed, 24 May 2023, Richard Biener via Gcc-patches wrote: > I’d have to check the ISAs what they actually do here - it of course depends > on RTL semantics as well but as you say those are not strictly defined here > either. Plus, we can add the following executable test to the testsuite:

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-05-24 Thread Richard Biener via Gcc-patches
 > Am 24.05.2023 um 16:21 schrieb Alexander Monakov : > >  >> On Wed, 24 May 2023, Richard Biener wrote: >>> On Wed, May 24, 2023 at 2:54 PM Alexander Monakov via Gcc-patches >>> wrote: >>> Explicitly say that bitwise shifts for narrow types work similar to >>> element-wise C shifts with

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-05-24 Thread Alexander Monakov via Gcc-patches
On Wed, 24 May 2023, Richard Biener wrote: > On Wed, May 24, 2023 at 2:54 PM Alexander Monakov via Gcc-patches > wrote: > > > > Explicitly say that bitwise shifts for narrow types work similar to > > element-wise C shifts with integer promotions, which coincides with > > OpenCL semantics. > >

Re: [PATCH] doc: clarify semantics of vector bitwise shifts

2023-05-24 Thread Richard Biener via Gcc-patches
On Wed, May 24, 2023 at 2:54 PM Alexander Monakov via Gcc-patches wrote: > > Explicitly say that bitwise shifts for narrow types work similar to > element-wise C shifts with integer promotions, which coincides with > OpenCL semantics. Do we need to clarify that v << w with v being a vector of

[PATCH] doc: clarify semantics of vector bitwise shifts

2023-05-24 Thread Alexander Monakov via Gcc-patches
Explicitly say that bitwise shifts for narrow types work similar to element-wise C shifts with integer promotions, which coincides with OpenCL semantics. gcc/ChangeLog: * doc/extend.texi (Vector Extensions): Clarify bitwise shift semantics. --- gcc/doc/extend.texi | 7 ++- 1