[arm] Allow the summation result of signed add-with-overflow to be discarded.
commitdb962d0ad4501f2f673fc3fadd4ac572ef9a177e
authorRichard Earnshaw <rearnsha@arm.com>
Fri, 18 Oct 2019 19:04:30 +0000 (18 19:04 +0000)
committerRichard Earnshaw <rearnsha@gcc.gnu.org>
Fri, 18 Oct 2019 19:04:30 +0000 (18 19:04 +0000)
treea05d2a014c9ad429bbdef51155c9ff57d92fab77
parentdbba8a1707ffe25375282e0a075e7dff8d41ef90
[arm] Allow the summation result of signed add-with-overflow to be discarded.

This patch matches the signed add-with-overflow patterns when the
summation itself is dropped.  In this case we can use CMN (or CMP with
some immediates).  There are a small number of constants in thumb2
where this can result in less dense code (as we lack 16-bit CMN with
immediate patterns).  To handle this we use peepholes to try these
alternatives when either a scratch is available (0 <= i <= 7) or the
original register is dead (0 <= i <= 255).  We don't use a scratch in
the pattern as if those conditions are not satisfied then the 32-bit
form is preferable to forcing a reload.

* config/arm/arm.md (addsi3_compareV_reg_nosum): New insn.
(addsi3_compareV_imm_nosum): New insn.  Also add peephole2 patterns
to transform this back into the summation version when that leads
to smaller code.

From-SVN: r277185
gcc/ChangeLog
gcc/config/arm/arm.md