Re: [PATCH] match.pd: undistribute (a << s) & C, when C = (M << s) and exact_log2(M - 1)

2020-11-11 Thread Jakub Jelinek via Gcc-patches
On Wed, Nov 11, 2020 at 01:43:00PM -0800, Jim Wilson wrote: > > On Wed, Nov 11, 2020 at 11:43:34AM +0100, Philipp Tomsich wrote: > > > The patch addresses this by disallowing that rule, if an exact > > power-of-2 is > > > seen as C1. The reason why I would prefer to have this canonicalised the >

Re: [PATCH] match.pd: undistribute (a << s) & C, when C = (M << s) and exact_log2(M - 1)

2020-11-11 Thread Jim Wilson
On Wed, Nov 11, 2020 at 2:55 AM Jakub Jelinek via Gcc-patches < gcc-patches@gcc.gnu.org> wrote: > On Wed, Nov 11, 2020 at 11:43:34AM +0100, Philipp Tomsich wrote: > > The patch addresses this by disallowing that rule, if an exact > power-of-2 is > > seen as C1. The reason why I would prefer to

Re: [PATCH] match.pd: undistribute (a << s) & C, when C = (M << s) and exact_log2(M - 1)

2020-11-11 Thread Jakub Jelinek via Gcc-patches
On Wed, Nov 11, 2020 at 09:04:28PM +0100, Philipp Tomsich wrote: > On Wed, 11 Nov 2020 at 20:59, Jakub Jelinek wrote: > > > > > > The simplification that distributes the shift (i.e. the one that Jakub > > > referred > > > to as fighting the new rule) is also run after GIMPLE has been expanded to

Re: [PATCH] match.pd: undistribute (a << s) & C, when C = (M << s) and exact_log2(M - 1)

2020-11-11 Thread Philipp Tomsich
On Wed, 11 Nov 2020 at 20:59, Jakub Jelinek wrote: > > > > The simplification that distributes the shift (i.e. the one that Jakub > > referred > > to as fighting the new rule) is also run after GIMPLE has been expanded to > > RTX. In my understanding, this still implies that even if we have a

Re: [PATCH] match.pd: undistribute (a << s) & C, when C = (M << s) and exact_log2(M - 1)

2020-11-11 Thread Jakub Jelinek via Gcc-patches
On Wed, Nov 11, 2020 at 08:53:56PM +0100, Philipp Tomsich wrote: > > On 11/11/20 3:55 AM, Jakub Jelinek via Gcc-patches wrote: > > > On Wed, Nov 11, 2020 at 11:43:34AM +0100, Philipp Tomsich wrote: > > >> The patch addresses this by disallowing that rule, if an exact > > >> power-of-2 is > > >>

Re: [PATCH] match.pd: undistribute (a << s) & C, when C = (M << s) and exact_log2(M - 1)

2020-11-11 Thread Philipp Tomsich
On Wed, 11 Nov 2020 at 19:17, Jeff Law wrote: > > > On 11/11/20 3:55 AM, Jakub Jelinek via Gcc-patches wrote: > > On Wed, Nov 11, 2020 at 11:43:34AM +0100, Philipp Tomsich wrote: > >> The patch addresses this by disallowing that rule, if an exact power-of-2 > >> is > >> seen as C1. The reason

Re: [PATCH] match.pd: undistribute (a << s) & C, when C = (M << s) and exact_log2(M - 1)

2020-11-11 Thread Jeff Law via Gcc-patches
On 11/11/20 3:55 AM, Jakub Jelinek via Gcc-patches wrote: > On Wed, Nov 11, 2020 at 11:43:34AM +0100, Philipp Tomsich wrote: >> The patch addresses this by disallowing that rule, if an exact power-of-2 is >> seen as C1. The reason why I would prefer to have this canonicalised the >> same way

Re: [PATCH] match.pd: undistribute (a << s) & C, when C = (M << s) and exact_log2(M - 1)

2020-11-11 Thread Jakub Jelinek via Gcc-patches
On Wed, Nov 11, 2020 at 11:43:34AM +0100, Philipp Tomsich wrote: > The patch addresses this by disallowing that rule, if an exact power-of-2 is > seen as C1. The reason why I would prefer to have this canonicalised the > same way the (X & C1) * C2 is canonicalised, is that cleaning this up during

Re: [PATCH] match.pd: undistribute (a << s) & C, when C = (M << s) and exact_log2(M - 1)

2020-11-11 Thread Philipp Tomsich via Gcc-patches
Jakub, On Wed, 11 Nov 2020 at 11:31, Jakub Jelinek wrote: > > On Wed, Nov 11, 2020 at 11:17:32AM +0100, Philipp Tomsich wrote: > > From: Philipp Tomsich > > > > The function > > long f(long a) > > { > > return(a & 0xull) << 3; > > } > > is folded into > > _1 =

Re: [PATCH] match.pd: undistribute (a << s) & C, when C = (M << s) and exact_log2(M - 1)

2020-11-11 Thread Jakub Jelinek via Gcc-patches
On Wed, Nov 11, 2020 at 11:17:32AM +0100, Philipp Tomsich wrote: > From: Philipp Tomsich > > The function > long f(long a) > { > return(a & 0xull) << 3; > } > is folded into > _1 = a_2(D) << 3; > _3 = _1 & 34359738360; > wheras the construction > return (a &

[PATCH] match.pd: undistribute (a << s) & C, when C = (M << s) and exact_log2(M - 1)

2020-11-11 Thread Philipp Tomsich
From: Philipp Tomsich The function long f(long a) { return(a & 0xull) << 3; } is folded into _1 = a_2(D) << 3; _3 = _1 & 34359738360; wheras the construction return (a & 0xull) * 8; results in _1 = a_2(D) & 4294967295; _3 = _1 * 8; This