aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-reassoc.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-01-05 16:35:22 +0100
committerJakub Jelinek <jakub@redhat.com>2021-01-05 16:35:22 +0100
commit576714b309b330df0e80e34114bcdf0bba35e146 (patch)
tree61e31f861adc2c8993b85149f5081881f620b0dd /gcc/tree-ssa-reassoc.c
parent5ca2400270e985f9b33d93007f4d831299b9bda7 (diff)
downloadgcc-576714b309b330df0e80e34114bcdf0bba35e146.zip
gcc-576714b309b330df0e80e34114bcdf0bba35e146.tar.gz
gcc-576714b309b330df0e80e34114bcdf0bba35e146.tar.bz2
phiopt: Optimize x < 0 ? ~y : y to (x >> 31) ^ y [PR96928]
As requested in the PR, the one's complement abs can be done more efficiently without cmov or branching. Had to change the ifcvt-onecmpl-abs-1.c testcase, we no longer optimize it in ifcvt, on x86_64 with -m32 we generate in the end the exact same code, but with -m64: movl %edi, %eax - notl %eax - cmpl %edi, %eax - cmovl %edi, %eax + sarl $31, %eax + xorl %edi, %eax ret 2021-01-05 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/96928 * tree-ssa-phiopt.c (xor_replacement): New function. (tree_ssa_phiopt_worker): Call it. * gcc.dg/tree-ssa/pr96928.c: New test. * gcc.target/i386/ifcvt-onecmpl-abs-1.c: Remove -fdump-rtl-ce1, instead of scanning rtl dump for ifcvt message check assembly for xor instruction.
Diffstat (limited to 'gcc/tree-ssa-reassoc.c')
0 files changed, 0 insertions, 0 deletions