Re: [PATCH] Fold bswap32(x) != 0 to x != 0 (and related transforms)

2021-07-22 Thread Richard Biener via Gcc-patches
On Mon, Jul 19, 2021 at 12:03 AM Marc Glisse wrote: > > On Sun, 18 Jul 2021, Roger Sayle wrote: > > > +(if (GIMPLE || !TREE_SIDE_EFFECTS (@0)) > > I don't think you need to worry about that, the general genmatch machinery > is already supposed to take care of it. All the existing cases in matc

Re: [PATCH] Fold bswap32(x) != 0 to x != 0 (and related transforms)

2021-07-20 Thread Jeff Law via Gcc-patches
On 7/18/2021 4:03 PM, Marc Glisse wrote: On Sun, 18 Jul 2021, Roger Sayle wrote: +    (if (GIMPLE || !TREE_SIDE_EFFECTS (@0)) I don't think you need to worry about that, the general genmatch machinery is already supposed to take care of it. All the existing cases in match.pd are about co

Re: [PATCH] Fold bswap32(x) != 0 to x != 0 (and related transforms)

2021-07-18 Thread Marc Glisse
On Sun, 18 Jul 2021, Roger Sayle wrote: +(if (GIMPLE || !TREE_SIDE_EFFECTS (@0)) I don't think you need to worry about that, the general genmatch machinery is already supposed to take care of it. All the existing cases in match.pd are about cond_expr, where counting the occurrences of ea

[PATCH] Fold bswap32(x) != 0 to x != 0 (and related transforms)

2021-07-18 Thread Roger Sayle
This patch to match.pd implements several closely related folding simplifications at the tree-level, that make use of the property that bit permutation functions, rotate and bswap have inverses. [1] bswap(X) eq/ne C, for constant C, simplifies to X eq/ne C' where C'=bswap(C), generaliz