diff options
author | Roger Sayle <roger@nextmovesoftware.com> | 2021-07-26 17:30:26 +0100 |
---|---|---|
committer | Roger Sayle <roger@nextmovesoftware.com> | 2021-07-26 17:30:26 +0100 |
commit | cf5f544227f16b63e224529190329eb0edca791c (patch) | |
tree | ca89fa4ac8eb34f2b1e5a9566e8d298fdc6e9b4e /gcc/tree-ssa-uninit.c | |
parent | 44e322f4326202799cca46e0cc1b435fcfcb06c5 (diff) | |
download | gcc-cf5f544227f16b63e224529190329eb0edca791c.zip gcc-cf5f544227f16b63e224529190329eb0edca791c.tar.gz gcc-cf5f544227f16b63e224529190329eb0edca791c.tar.bz2 |
Fold bswap32(x) != 0 to x != 0 (and related transforms)
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), generalizing the transform in the subject.
[2] bswap(X) eq/ne bswap(Y) simplifies to X eq/ne Y.
[3] lrotate(X,C1) eq/ne C2 simplifies to X eq/ne C3, where
C3 = rrotate(C2,C1), i.e. apply the inverse rotation to C2.
[4] Likewise, rrotate(X,C1) eq/ne C2 simplifies to X eq/ne C3,
where C3 = lrotate(C2,C1).
[5] rotate(X,Z) eq/ne rotate(Y,Z) simplifies to X eq/ne Y, when
the bit-count Z (the same on both sides) has no side-effects.
[6] rotate(X,Y) eq/ne 0 simplifies to X eq/ne 0 if Y has no
side-effects.
[7] Likewise, rotate(X,Y) eq/ne -1 simplifies to X eq/ne -1,
if Y has no side-effects.
2010-07-26 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.
Diffstat (limited to 'gcc/tree-ssa-uninit.c')
0 files changed, 0 insertions, 0 deletions