]> git.ipfire.org Git - thirdparty/gcc.git/commit
[arm] Match subtraction from carry_operation
authorrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Oct 2019 13:19:15 +0000 (13:19 +0000)
committerrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 22 Oct 2019 13:19:15 +0000 (13:19 +0000)
commitbc0ce08b88ff2c4163f3d8aee29ed20d28774864
treebc2e47c87c976dfbcb205370a614fe10b10bc2b8
parentb80bc224a5bf7c1ac0ee575bf6fb1031e4d90ac0
[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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277290 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/arm/arm.c
gcc/config/arm/arm.md