Re: [PATCH v2] match.pd: rewrite select to branchless expression

2022-12-02 Thread Richard Biener via Gcc-patches
On Thu, Dec 1, 2022 at 7:57 PM Michael Collison wrote: > > Richard, > > Can you submit this patch for me while I sort out git write access? Done. I had to apply the patch manually - in future please make sure to send patches that can be applied with git am. Thanks, Richard. > On 11/18/22 07:57

Re: [PATCH v2] match.pd: rewrite select to branchless expression

2022-12-01 Thread Michael Collison
Richard, Can you submit this patch for me while I sort out git write access? On 11/18/22 07:57, Richard Biener wrote: On Fri, Nov 11, 2022 at 3:28 AM Michael Collison wrote: This patches transforms ((x & 0x1) == 0) ? y : z y -into (-(typeof(y))(x & 0x1) & z) y, where op is a '^' or a '|'. I

Re: [PATCH v2] match.pd: rewrite select to branchless expression

2022-11-18 Thread Richard Biener via Gcc-patches
On Fri, Nov 11, 2022 at 3:28 AM Michael Collison wrote: > > This patches transforms ((x & 0x1) == 0) ? y : z y -into > (-(typeof(y))(x & 0x1) & z) y, where op is a '^' or a '|'. It also > transforms (cond (and (x , 0x1) != 0), (z op y), y ) into (-(and (x , > 0x1)) & z ) op y. > > Matching this

Re: [PATCH v2] match.pd: rewrite select to branchless expression

2022-11-17 Thread Jeff Law via Gcc-patches
On 11/11/22 06:00, Michael Collison wrote: Hi Prathamesh, It is my understanding that INTEGRAL_TYPE_P applies to the other integer types you mentioned (chart, short, long). In fact the test function that motivated this match has a mixture of char and short and does not restrict matching.

Re: [PATCH v2] match.pd: rewrite select to branchless expression

2022-11-11 Thread Michael Collison
Hi Prathamesh, It is my understanding that INTEGRAL_TYPE_P applies to the other integer types you mentioned (chart, short, long). In fact the test function that motivated this match has a mixture of char and short and does not restrict matching. On 11/11/22 02:44, Prathamesh Kulkarni wrote:

Re: [PATCH v2] match.pd: rewrite select to branchless expression

2022-11-10 Thread Prathamesh Kulkarni via Gcc-patches
On Fri, 11 Nov 2022 at 07:58, Michael Collison wrote: > > This patches transforms ((x & 0x1) == 0) ? y : z y -into > (-(typeof(y))(x & 0x1) & z) y, where op is a '^' or a '|'. It also > transforms (cond (and (x , 0x1) != 0), (z op y), y ) into (-(and (x , > 0x1)) & z ) op y. > > Matching this pa

[PATCH v2] match.pd: rewrite select to branchless expression

2022-11-10 Thread Michael Collison
This patches transforms ((x & 0x1) == 0) ? y : z y -into (-(typeof(y))(x & 0x1) & z) y, where op is a '^' or a '|'. It also transforms (cond (and (x , 0x1) != 0), (z op y), y ) into (-(and (x , 0x1)) & z ) op y. Matching this patterns allows GCC to generate branchless code for one of the fu