aboutsummaryrefslogtreecommitdiff
path: root/gcc/ggc-common.cc
diff options
context:
space:
mode:
authorAndrew Pinski <apinski@marvell.com>2023-09-13 16:50:33 -0700
committerAndrew Pinski <apinski@marvell.com>2023-09-14 07:29:44 -0700
commit5e4a248b03f01f422b0dbc9e1464eb6c2f2bafc6 (patch)
treebc11075b2f36c3c5303feb3f448975dc0c0d386a /gcc/ggc-common.cc
parent4241415b8817d505e92144175c040a48b1cf2b9f (diff)
downloadgcc-5e4a248b03f01f422b0dbc9e1464eb6c2f2bafc6.zip
gcc-5e4a248b03f01f422b0dbc9e1464eb6c2f2bafc6.tar.gz
gcc-5e4a248b03f01f422b0dbc9e1464eb6c2f2bafc6.tar.bz2
MATCH: Support `(a != (CST+1)) & (a > CST)` optimizations
Even though this is done via reassocation, match can support these with a simple change to detect that the difference is just one. This allows to optimize these earlier and even during phiopt for an example. This patch adds the following cases: (a != (CST+1)) & (a > CST) -> a > (CST+1) (a != (CST-1)) & (a < CST) -> a < (CST-1) (a == (CST-1)) | (a >= CST) -> a >= (CST-1) (a == (CST+1)) | (a <= CST) -> a <= (CST+1) Canonicalizations of comparisons causes this case to show up more. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/106164 gcc/ChangeLog: * match.pd (`(X CMP1 CST1) AND/IOR (X CMP2 CST2)`): Expand to support constants that are off by one. gcc/testsuite/ChangeLog: * gcc.dg/pr21643.c: Update test now that match does the combing of the comparisons. * gcc.dg/tree-ssa/cmpbit-5.c: New test. * gcc.dg/tree-ssa/phi-opt-35.c: New test.
Diffstat (limited to 'gcc/ggc-common.cc')
0 files changed, 0 insertions, 0 deletions