aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-03-19 11:05:10 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-03-19 11:05:10 +0100
commit1504f0b4b1d481479c0fc915ae74095b7dd8065d (patch)
tree2f6cd10e18ab2a6b264fd7b133951aee006c8539 /gcc
parentcad3fc8c59c1fc94defff1d211f683bef2bc1f05 (diff)
downloadgcc-1504f0b4b1d481479c0fc915ae74095b7dd8065d.zip
gcc-1504f0b4b1d481479c0fc915ae74095b7dd8065d.tar.gz
gcc-1504f0b4b1d481479c0fc915ae74095b7dd8065d.tar.bz2
re PR target/89506 (ICE: in decompose, at rtl.h:2266 with -Og -g)
PR target/89506 * config/arm/arm.md (cmpsi2_addneg): Swap the alternatives and use subs for the first alternative except when operands[3] is 1. From-SVN: r269795
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/config/arm/arm.md20
2 files changed, 14 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f96d515a..9327ed8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2019-03-19 Jakub Jelinek <jakub@redhat.com>
+ PR target/89506
+ * config/arm/arm.md (cmpsi2_addneg): Swap the alternatives and use
+ subs for the first alternative except when operands[3] is 1.
+
PR target/89752
* gimplify.c (gimplify_asm_expr): For output argument with
TREE_ADDRESSABLE type, clear allows_reg if it allows memory, otherwise
diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 1805901..0aecd03 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -857,27 +857,27 @@
(set_attr "type" "alus_sreg")]
)
-;; This is the canonicalization of addsi3_compare0_for_combiner when the
+;; This is the canonicalization of subsi3_compare when the
;; addend is a constant.
(define_insn "cmpsi2_addneg"
[(set (reg:CC CC_REGNUM)
(compare:CC
(match_operand:SI 1 "s_register_operand" "r,r")
- (match_operand:SI 2 "arm_addimm_operand" "L,I")))
+ (match_operand:SI 2 "arm_addimm_operand" "I,L")))
(set (match_operand:SI 0 "s_register_operand" "=r,r")
(plus:SI (match_dup 1)
- (match_operand:SI 3 "arm_addimm_operand" "I,L")))]
+ (match_operand:SI 3 "arm_addimm_operand" "L,I")))]
"TARGET_32BIT
&& (INTVAL (operands[2])
== trunc_int_for_mode (-INTVAL (operands[3]), SImode))"
{
- /* For 0 and INT_MIN it is essential that we use subs, as adds
- will result in different condition codes (like cmn rather than
- like cmp). For other immediates, we should choose whatever
- will have smaller encoding. */
- if (operands[2] == const0_rtx
- || INTVAL (operands[2]) == -HOST_WIDE_INT_C (0x80000000)
- || which_alternative == 1)
+ /* For 0 and INT_MIN it is essential that we use subs, as adds will result
+ in different condition codes (like cmn rather than like cmp), so that
+ alternative comes first. Both alternatives can match for any 0x??000000
+ where except for 0 and INT_MIN it doesn't matter what we choose, and also
+ for -1 and 1 with TARGET_THUMB2, in that case prefer instruction with #1
+ as it is shorter. */
+ if (which_alternative == 0 && operands[3] != const1_rtx)
return "subs%?\\t%0, %1, #%n3";
else
return "adds%?\\t%0, %1, %3";