diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-09-26 07:38:21 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-09-26 07:38:21 +0000 |
commit | 835d50c66aa5bde2f354a6e63a2afa7d2f76a05a (patch) | |
tree | bf36b9fe02ba04c1cc56570b9226ec5ce8decbf2 /gcc/config/aarch64 | |
parent | ec14f8abf00880d8fd7051d828bd2cbfd385b92b (diff) | |
download | gcc-835d50c66aa5bde2f354a6e63a2afa7d2f76a05a.zip gcc-835d50c66aa5bde2f354a6e63a2afa7d2f76a05a.tar.gz gcc-835d50c66aa5bde2f354a6e63a2afa7d2f76a05a.tar.bz2 |
[AArch64] Fix cost of (plus ... (const_int -C))
The PLUS handling in aarch64_rtx_costs only checked for nonnegative
constants, meaning that simple immediate subtractions like:
(set (reg R1) (plus (reg R2) (const_int -8)))
had a cost of two instructions.
2019-09-26 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* config/aarch64/aarch64.c (aarch64_rtx_costs): Use
aarch64_plus_immediate rather than aarch64_uimm12_shift
to test for valid PLUS immediates.
From-SVN: r276140
Diffstat (limited to 'gcc/config/aarch64')
-rw-r--r-- | gcc/config/aarch64/aarch64.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 56a4a47d..71d44de 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -10753,7 +10753,7 @@ cost_plus: } if (GET_MODE_CLASS (mode) == MODE_INT - && ((CONST_INT_P (op1) && aarch64_uimm12_shift (INTVAL (op1))) + && (aarch64_plus_immediate (op1, mode) || aarch64_sve_addvl_addpl_immediate (op1, mode))) { *cost += rtx_cost (op0, mode, PLUS, 0, speed); |