diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2025-01-14 19:38:47 -0800 |
---|---|---|
committer | Andrew Pinski <quic_apinski@quicinc.com> | 2025-01-15 15:20:58 -0800 |
commit | 903ab914dd48c3131ded0cf427da50c23168024c (patch) | |
tree | f72fae09cc8b310759c0d01bc925c9627a63c6fc /libstdc++-v3 | |
parent | c340ff207f0fd297231e9d5c093c06c11b84bede (diff) | |
download | gcc-903ab914dd48c3131ded0cf427da50c23168024c.zip gcc-903ab914dd48c3131ded0cf427da50c23168024c.tar.gz gcc-903ab914dd48c3131ded0cf427da50c23168024c.tar.bz2 |
match: Simplify `1 >> x` into `x == 0` [PR102705]
This in this PR we have missed optimization where we miss that,
`1 >> x` and `(1 >> x) ^ 1` can't be equal. There are a few ways of
optimizing this, the easiest and simpliest is to simplify `1 >> x` into
just `x == 0` as those are equivalant (if we ignore out of range values for x).
we already have an optimization for `(1 >> X) !=/== 0` so the only difference
here is we don't need the `!=/== 0` part to do the transformation.
So this removes the `(1 >> X) !=/== 0` transformation and just adds a simplfied
`1 >> x` -> `x == 0` one.
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/102705
gcc/ChangeLog:
* match.pd (`(1 >> X) != 0`): Remove pattern.
(`1 >> x`): New pattern.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/pr105832-2.c: Update testcase.
* gcc.dg/tree-ssa/pr96669-1.c: Likewise.
* gcc.dg/tree-ssa/pr102705-1.c: New test.
* gcc.dg/tree-ssa/pr102705-2.c: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'libstdc++-v3')
0 files changed, 0 insertions, 0 deletions