aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.c
diff options
context:
space:
mode:
authorEugene Rozenfeld <erozen@microsoft.com>2020-12-09 16:44:25 -0800
committerRichard Biener <rguenther@suse.de>2021-01-20 16:31:46 +0100
commit49e8c14ef6f1f968602a04c8499a672182590e87 (patch)
tree117f6abdfcbca618c48c14b2b7808f93a449ba4d /gcc/tree-data-ref.c
parentcafcfcb5840b62d9fc80c12192189351e995a4f2 (diff)
downloadgcc-49e8c14ef6f1f968602a04c8499a672182590e87.zip
gcc-49e8c14ef6f1f968602a04c8499a672182590e87.tar.gz
gcc-49e8c14ef6f1f968602a04c8499a672182590e87.tar.bz2
Optimize combination of comparisons to dec+compare
This patch adds patterns for optimizing x < y || y == XXX_MIN to x <= y-1 x >= y && y != XXX_MIN to x > y-1 if y is an integer with TYPE_OVERFLOW_WRAPS. This fixes pr96674. Tested on x86_64-pc-linux-gnu. For this function bool f(unsigned a, unsigned b) { return (b == 0) | (a < b); } the code without the patch is test esi,esi sete al cmp esi,edi seta dl or eax,edx ret the code with the patch is sub esi,0x1 cmp esi,edi setae al ret PR tree-optimization/96674 gcc/ * match.pd: New patterns: x < y || y == XXX_MIN --> x <= y - 1 x >= y && y != XXX_MIN --> x > y - 1 gcc/testsuite * gcc.dg/pr96674.c: New tests.
Diffstat (limited to 'gcc/tree-data-ref.c')
0 files changed, 0 insertions, 0 deletions