aboutsummaryrefslogtreecommitdiff
path: root/gcc/function-abi.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2021-01-12 11:03:40 +0100
committerJakub Jelinek <jakub@redhat.com>2021-01-12 11:03:40 +0100
commit13d47c37a2c043f3e5981e73e4c82158a39f41e8 (patch)
treea7069386bc37834678a8f0c7b5989121a4213060 /gcc/function-abi.h
parentff99d05f40fc573ee405f1278f2bc5ac55019bdb (diff)
downloadgcc-13d47c37a2c043f3e5981e73e4c82158a39f41e8.zip
gcc-13d47c37a2c043f3e5981e73e4c82158a39f41e8.tar.gz
gcc-13d47c37a2c043f3e5981e73e4c82158a39f41e8.tar.bz2
reassoc: Optimize in reassoc x < 0 && y < 0 to (x | y) < 0 etc. [PR95731]
We already had x != 0 && y != 0 to (x | y) != 0 and x != -1 && y != -1 to (x & y) != -1 and x < 32U && y < 32U to (x | y) < 32U, this patch adds signed x < 0 && y < 0 to (x | y) < 0. In that case, the low/high seem to be always the same and just in_p indices whether it is >= 0 or < 0, also, all types in the same bucket (same precision) should be type compatible, but we can have some >= 0 and some < 0 comparison mixed, so the patch handles that by using the right BIT_IOR_EXPR or BIT_AND_EXPR and doing one set of < 0 or >= 0 first, then BIT_NOT_EXPR and then the other one. I had to move optimize_range_tests_var_bound before this optimization because that one deals with signed a >= 0 && a < b, and limited it to the last reassoc pass as reassoc itself can't virtually undo this optimization yet (and not sure if vrp would be able to). 2021-01-12 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/95731 * tree-ssa-reassoc.c (optimize_range_tests_cmp_bitwise): Also optimize x < 0 && y < 0 && z < 0 into (x | y | z) < 0 for signed x, y, z. (optimize_range_tests): Call optimize_range_tests_cmp_bitwise only after optimize_range_tests_var_bound. * gcc.dg/tree-ssa/pr95731.c: New test. * gcc.c-torture/execute/pr95731.c: New test.
Diffstat (limited to 'gcc/function-abi.h')
0 files changed, 0 insertions, 0 deletions