aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-loop-versioning.cc
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2022-06-27 07:44:49 +0100
committerRoger Sayle <roger@nextmovesoftware.com>2022-06-27 07:44:49 +0100
commitf3f73e86ec8613f176db3e52bbfbfbb9636cb714 (patch)
treed1d5494a41fd8953a3de98c88875ad5875b484bc /gcc/gimple-loop-versioning.cc
parent2ae7895416a7aa4fc9e7f9fa646dca1f51bdea56 (diff)
downloadgcc-f3f73e86ec8613f176db3e52bbfbfbb9636cb714.zip
gcc-f3f73e86ec8613f176db3e52bbfbfbb9636cb714.tar.gz
gcc-f3f73e86ec8613f176db3e52bbfbfbb9636cb714.tar.bz2
[PATCH] PR tree-optimization/94026: Simplify (X>>8)&6 != 0 as X&1536 != 0.
This patch implements the missed optimization described in PR 94026, where a the shift can be eliminated from the sequence of a shift, followed by a bit-wise AND followed by an equality/inequality test. Specifically, ((X << C1) & C2) cmp C3 into (X & (C2 >> C1)) cmp (C3 >> C1) and likewise ((X >> C1) & C2) cmp C3 into (X & (C2 << C1)) cmp (C3 << C1) where cmp is == or !=, and C1, C2 and C3 are integer constants. The example in the subject line is taken from the hot function self_atari from the Go program Leela (in SPEC CPU 2017). 2022-06-27 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog PR tree-optimization/94026 * match.pd (((X << C1) & C2) eq/ne C3): New simplification. (((X >> C1) & C2) eq/ne C3): Likewise. gcc/testsuite/ChangeLog PR tree-optimization/94026 * gcc.dg/pr94026.c: New test case.
Diffstat (limited to 'gcc/gimple-loop-versioning.cc')
0 files changed, 0 insertions, 0 deletions