[AArch64] Fix cost of (plus ... (const_int -C))
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 26 Sep 2019 07:38:21 +0000 (07:38 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Thu, 26 Sep 2019 07:38:21 +0000 (07:38 +0000)
commit835d50c66aa5bde2f354a6e63a2afa7d2f76a05a
treebf36b9fe02ba04c1cc56570b9226ec5ce8decbf2
parentec14f8abf00880d8fd7051d828bd2cbfd385b92b
[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
gcc/ChangeLog
gcc/config/aarch64/aarch64.c