[PATCH take 2] Fold bswap32(x) != 0 to x != 0 (and related transforms)
Roger Sayle
roger@nextmovesoftware.com
Sat Jul 24 09:44:04 GMT 2021
My apologies for the short delay. Thanks for explaining why these
transforms
don't usually require explicit tests for side-effects (but occasionally do).
This does simplify things; please find attached the shorter revised patch.
This patch has been retested on x86_64-pc-linux-gnu with a make bootstrap
and make -k check with no new failures. Ok for mainline?
2010-07-24 Roger Sayle <roger@nextmovesoftware.com>
Marc Glisse <marc.glisse@inria.fr>
gcc/ChangeLog
* match.pd (rotate): Simplify equality/inequality of rotations.
(bswap): Simplify equality/inequality tests of byte swapping.
gcc/testsuite/ChangeLog
* gcc.dg/fold-eqrotate-1.c: New test case.
* gcc.dg/fold-eqbswap-1.c: New test case.
Roger
--
-----Original Message-----
From: Marc Glisse <marc.glisse@inria.fr>
Sent: 18 July 2021 23:03
To: Roger Sayle <roger@nextmovesoftware.com>
Cc: 'GCC Patches' <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fold bswap32(x) != 0 to x != 0 (and related transforms)
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 each @i is not
reliable.
--
Marc Glisse
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patchc2.txt
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210724/b3531739/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fold-eqbswap-1.c
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210724/b3531739/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fold-eqrotate-1.c
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210724/b3531739/attachment-0001.c>
More information about the Gcc-patches
mailing list