[arm] Implement negscc using SBC when appropriate

Programming / Compilers / GCC - rearnsha [138bc75d-0d04-0410-961f-82ee72b054a4] - 18 October 2019 19:03 EDT

When the carry flag is appropriately set by a comprison, negscc patterns can expand into a simple SBC of a register with itself. This means we can convert two conditional instructions into a single non-conditional instruction. Furthermore, in Thumb2 we can avoid the need for an IT instruction as well. This patch also fixes the remaining testcase that we initially XFAILed in the first patch of this series.

gcc:
- config/arm/arm.md (negscc_borrow): New pattern. (mov_negscc): Don't split if the insn would match negscc_borrow.
- config/arm/thumb2.md (thumb2_mov_negscc): Likewise. (thumb2_mov_negscc_strict_it): Likewise.

testsuite:
- gcc.target/arm/negdi-3.c: Remove XFAIL markers.

01089cc7434 [arm] Implement negscc using SBC when appropriate.
gcc/ChangeLog | 7 +++++++
gcc/config/arm/arm.md | 14 ++++++++++++--
gcc/config/arm/thumb2.md | 8 ++++++--
gcc/testsuite/ChangeLog | 4 ++++
gcc/testsuite/gcc.target/arm/negdi-3.c | 8 ++++----
5 files changed, 33 insertions(+), 8 deletions(-)

Upstream: gcc.gnu.org


  • Share