aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2022-12-12 15:21:39 +0000
committerTamar Christina <tamar.christina@arm.com>2022-12-12 15:21:39 +0000
commit4d9db4bdd458a4b526f59e4bc5bbd549d3861cea (patch)
treee358bee89eb086f37e9d44026954d0eaaff5ef58 /gcc/rust
parent594264e9bcb592b8edc4b50b5d9be5eb34c1d6d7 (diff)
downloadgcc-4d9db4bdd458a4b526f59e4bc5bbd549d3861cea.zip
gcc-4d9db4bdd458a4b526f59e4bc5bbd549d3861cea.tar.gz
gcc-4d9db4bdd458a4b526f59e4bc5bbd549d3861cea.tar.bz2
middle-end: simplify complex if expressions where comparisons are inverse of one another.
This optimizes the following sequence ((a < b) & c) | ((a >= b) & d) into (a < b ? c : d) & 1 for scalar and on vector we can omit the & 1. Also recognizes (-(a < b) & c) | (-(a >= b) & d) into a < b ? c : d This changes the code generation from zoo2: cmp w0, w1 cset w0, lt cset w1, ge and w0, w0, w2 and w1, w1, w3 orr w0, w0, w1 ret into cmp w0, w1 csel w0, w2, w3, lt and w0, w0, 1 ret and significantly reduces the number of selects we have to do in the vector code. gcc/ChangeLog: * match.pd: Add new rule. gcc/testsuite/ChangeLog: * gcc.target/aarch64/if-compare_1.c: New test. * gcc.target/aarch64/if-compare_2.c: New test.
Diffstat (limited to 'gcc/rust')
0 files changed, 0 insertions, 0 deletions