diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2024-10-20 10:44:14 -0700 |
---|---|---|
committer | Andrew Pinski <quic_apinski@quicinc.com> | 2024-10-25 15:15:34 -0700 |
commit | 35bf490452e06b3e3567933342fb15ef5d11f503 (patch) | |
tree | 2fc81bbac929c4cfaa3229e92ac928745e946172 /gcc/jit | |
parent | 2266e38cfd8071262004f164ebe37f60e2d4615d (diff) | |
download | gcc-35bf490452e06b3e3567933342fb15ef5d11f503.zip gcc-35bf490452e06b3e3567933342fb15ef5d11f503.tar.gz gcc-35bf490452e06b3e3567933342fb15ef5d11f503.tar.bz2 |
simplify-rtx: Handle `a != 0 ? -a : 0` [PR58195]
The gimple (and generic) levels have this optmization since r12-2041-g7d6979197274a662da7bdc5.
It seems like a good idea to add a similar one to rtl just in case it is not caught at the
gimple level.
Note the loop case in csel-neg-1.c is not handled at the gimple level (even with phiopt turned back on),
this is because of casts to avoid signed integer overflow; a patch to fix this at the gimple level will be
submitted seperately.
Changes since v1:
* v2: Use `CONST0_RTX (mode)` instead of const0_rtx. Add csel-neg-2.c for float testcase which now passes.
Build and tested for aarch64-linux-gnu.
PR rtl-optimization/58195
gcc/ChangeLog:
* simplify-rtx.cc (simplify_context::simplify_ternary_operation): Handle
`a != 0 ? -a : 0` and `a == 0 ? 0 : -a`.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/csel-neg-1.c: New test.
* gcc.target/aarch64/csel-neg-2.c: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'gcc/jit')
0 files changed, 0 insertions, 0 deletions