Commit 1504f0b4 by Jakub Jelinek Committed by Jakub Jelinek

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
parent cad3fc8c
2019-03-19 Jakub Jelinek <jakub@redhat.com> 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 PR target/89752
* gimplify.c (gimplify_asm_expr): For output argument with * gimplify.c (gimplify_asm_expr): For output argument with
TREE_ADDRESSABLE type, clear allows_reg if it allows memory, otherwise TREE_ADDRESSABLE type, clear allows_reg if it allows memory, otherwise
......
...@@ -857,27 +857,27 @@ ...@@ -857,27 +857,27 @@
(set_attr "type" "alus_sreg")] (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. ;; addend is a constant.
(define_insn "cmpsi2_addneg" (define_insn "cmpsi2_addneg"
[(set (reg:CC CC_REGNUM) [(set (reg:CC CC_REGNUM)
(compare:CC (compare:CC
(match_operand:SI 1 "s_register_operand" "r,r") (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") (set (match_operand:SI 0 "s_register_operand" "=r,r")
(plus:SI (match_dup 1) (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 "TARGET_32BIT
&& (INTVAL (operands[2]) && (INTVAL (operands[2])
== trunc_int_for_mode (-INTVAL (operands[3]), SImode))" == trunc_int_for_mode (-INTVAL (operands[3]), SImode))"
{ {
/* For 0 and INT_MIN it is essential that we use subs, as adds /* For 0 and INT_MIN it is essential that we use subs, as adds will result
will result in different condition codes (like cmn rather than in different condition codes (like cmn rather than like cmp), so that
like cmp). For other immediates, we should choose whatever alternative comes first. Both alternatives can match for any 0x??000000
will have smaller encoding. */ where except for 0 and INT_MIN it doesn't matter what we choose, and also
if (operands[2] == const0_rtx for -1 and 1 with TARGET_THUMB2, in that case prefer instruction with #1
|| INTVAL (operands[2]) == -HOST_WIDE_INT_C (0x80000000) as it is shorter. */
|| which_alternative == 1) if (which_alternative == 0 && operands[3] != const1_rtx)
return "subs%?\\t%0, %1, #%n3"; return "subs%?\\t%0, %1, #%n3";
else else
return "adds%?\\t%0, %1, %3"; return "adds%?\\t%0, %1, %3";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment