diff options
author | Andrew Pinski <quic_apinski@quicinc.com> | 2023-11-26 23:25:51 +0000 |
---|---|---|
committer | Andrew Pinski <quic_apinski@quicinc.com> | 2023-11-27 23:11:35 +0000 |
commit | d29d27bde5df89e5357e0a33a71bb49125bd1655 (patch) | |
tree | 13dc32e5962cb216b5c092945db65e12d87340e5 /gcc/c/c-lang.h | |
parent | cd2519a6f857539262398f3ff63b53de173e2a88 (diff) | |
download | gcc-d29d27bde5df89e5357e0a33a71bb49125bd1655.zip gcc-d29d27bde5df89e5357e0a33a71bb49125bd1655.tar.gz gcc-d29d27bde5df89e5357e0a33a71bb49125bd1655.tar.bz2 |
aarch64: Improve cost of `a ? {-,}1 : b`
While looking into PR 112454, I found the cost for
`(if_then_else (cmp) (const_int 1) (reg))` was being recorded as 8
(or `COSTS_N_INSNS (2)`) but it should have been 4 (or `COSTS_N_INSNS (1)`).
This improves the cost by not adding the cost of `(const_int 1)` to
the total cost.
It does not does not fully fix PR 112454 as that requires other changes to forwprop
the `(const_int 1)` earlier than combine. Though we do fix the loop case where the
constant was only used once.
Bootstrapped and tested on aarch64-linux-gnu with no regressions.
gcc/ChangeLog:
* config/aarch64/aarch64.cc (aarch64_if_then_else_costs):
Handle csinv/csinc case of 1/-1.
gcc/testsuite/ChangeLog:
* gcc.target/aarch64/csinc-3.c: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'gcc/c/c-lang.h')
0 files changed, 0 insertions, 0 deletions