]> git.ipfire.org Git - thirdparty/gcc.git/commit
[arm] Improve constant handling for usubvsi4.
authorrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Oct 2019 19:04:46 +0000 (19:04 +0000)
committerrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Oct 2019 19:04:46 +0000 (19:04 +0000)
commitc9092f6571bbf20828a6d37da0c2f353c97c19ee
treef1e52a3111c47fb41bbec05a282a1f88a986cbd6
parent8414e41f6fe46c49ef7fab21747a84c6b19c86f2
[arm] Improve constant handling for usubvsi4.

This patch improves the expansion of usubvsi4 by allowing suitable
constants to be passed directly.  Unlike normal subtraction, either
operand may be a constant (and indeed I have seen cases where both can
be with LTO enabled).  One interesting testcase that improves as a
result of this is:

unsigned f6 (unsigned a)
{
  unsigned x;
  return __builtin_sub_overflow (5U, a, &x) ? 0 : x;
}

Which previously compiled to:

rsbs r3, r0, #5
cmp r0, #5
movls r0, r3
movhi r0, #0

but now generates the optimal sequence:

rsbs r0, r0, #5
movcc r0, #0

* config/arm/arm.md (usubv<mode>4): Delete expansion.
(usubvsi4): New pattern.  Allow some immediate values for inputs.
(usubvdi4): New pattern.

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