[arm] Match subtraction from carry_operation
authorRichard Earnshaw <rearnsha@arm.com>
Tue, 22 Oct 2019 13:19:15 +0000 (13:19 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Tue, 22 Oct 2019 13:19:15 +0000 (13:19 +0000)
commit2e30cb8395130982b8b28a4eb42814f4da1fb6d2
treebc2e47c87c976dfbcb205370a614fe10b10bc2b8
parentb747c183714a5d68da8037d8b705a8bc67f11bac
[arm] Match subtraction from carry_operation

On Arm we have both carry and borrow operations, but borrow is
essentially '~carry'.  Of course, with boolean logic ~carry is also
1-carry.

GCC transforms

(1 - X - LTU (cc, 0))

into

(GEU (cc, 0) - X)

Now the former matches a real insn in Arm state, using the RSC
instruction with #1 as the immediate, but we currently do not
recognize the canonicalized form.  Nevertheless, given the above
logic, this turns out to be quite straight forward as the original
expression matches arm_borrow_operation and the revised form can be
used with arm_carry_operation.  Since we match this new pattern we
also update rtx_costs to handle it.

* config/arm/arm.md (rsbsi_carryin_reg): New pattern.
* config/arm/arm.c (arm_rtx_costs_internal, case MINUS): Handle
subtraction from a carry operation.

From-SVN: r277290
gcc/ChangeLog
gcc/config/arm/arm.c
gcc/config/arm/arm.md