public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ARM]Fix addsi3_compare_op2 pattern.
@ 2015-11-12  9:29 Renlin Li
  2015-11-12  9:33 ` Kyrill Tkachov
  0 siblings, 1 reply; 2+ messages in thread
From: Renlin Li @ 2015-11-12  9:29 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ramana Radhakrishnan, Kyrill Tkachov

[-- Attachment #1: Type: text/plain, Size: 842 bytes --]

Hi all,

This is a simply patch to adjust the assembly output for 
addsi3_compare_op2 rtx pattern in ARM backend.

According to the constraints, it's the second alternative which allows 
the second operand to be a constant.
The original pattern will trigger an ICE when the third alternative is 
chosen, and trying to output a constant while the second operand is a 
register.

This is triggered by my experimental backend changes. branch 5, 4.9 all 
have this problem.

arm-none-linux-gnueabihf bootstrap Okay, arm-none-eabi regression test Okay.

Okay to commit into trunk and backport to branch 5 and 4.9?

Regards,
Renlin Li

gcc/ChangeLog:

2015-11-12  Renlin Li  <renlin.li@arm.com>

     * config/arm/arm.md (addsi3_compare_op2): Make the order of
         assembly pattern consistent with constraint order.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bug-1.diff --]
[-- Type: text/x-patch; name=bug-1.diff, Size: 415 bytes --]

diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 8ebb1bf..73c3088 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -747,8 +747,8 @@
   "TARGET_32BIT"
   "@
    adds%?\\t%0, %1, %2
-   adds%?\\t%0, %1, %2
-   subs%?\\t%0, %1, #%n2"
+   subs%?\\t%0, %1, #%n2
+   adds%?\\t%0, %1, %2"
   [(set_attr "conds" "set")
    (set_attr "type" "alus_imm,alus_imm,alus_sreg")]
 )

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][ARM]Fix addsi3_compare_op2 pattern.
  2015-11-12  9:29 [PATCH][ARM]Fix addsi3_compare_op2 pattern Renlin Li
@ 2015-11-12  9:33 ` Kyrill Tkachov
  0 siblings, 0 replies; 2+ messages in thread
From: Kyrill Tkachov @ 2015-11-12  9:33 UTC (permalink / raw)
  To: Renlin Li, gcc-patches; +Cc: Ramana Radhakrishnan

Hi Renlin,

On 12/11/15 09:29, Renlin Li wrote:
> Hi all,
>
> This is a simply patch to adjust the assembly output for addsi3_compare_op2 rtx pattern in ARM backend.
>
> According to the constraints, it's the second alternative which allows the second operand to be a constant.
> The original pattern will trigger an ICE when the third alternative is chosen, and trying to output a constant while the second operand is a register.
>
> This is triggered by my experimental backend changes. branch 5, 4.9 all have this problem.
>
> arm-none-linux-gnueabihf bootstrap Okay, arm-none-eabi regression test Okay.
>
> Okay to commit into trunk and backport to branch 5 and 4.9?
>
> Regards,
> Renlin Li
>
> gcc/ChangeLog:
>
> 2015-11-12  Renlin Li  <renlin.li@arm.com>
>
>     * config/arm/arm.md (addsi3_compare_op2): Make the order of
>         assembly pattern consistent with constraint order.

Yes, this is ok. I think the order of the alternatives is obviously wrong.

For context, this is the whole pattern:
(define_insn "*addsi3_compare_op2"
   [(set (reg:CC_C CC_REGNUM)
     (compare:CC_C
      (plus:SI (match_operand:SI 1 "s_register_operand" "r,r,r")
           (match_operand:SI 2 "arm_add_operand" "I,L,r"))
      (match_dup 2)))
    (set (match_operand:SI 0 "s_register_operand" "=r,r,r")
     (plus:SI (match_dup 1) (match_dup 2)))]
   "TARGET_32BIT"
   "@
    add%.\\t%0, %1, %2
    add%.\\t%0, %1, %2
    sub%.\\t%0, %1, #%n2"
   [(set_attr "conds" "set")
    (set_attr "type" "alus_imm,alus_imm,alus_sreg")]
)

Thanks,
Kyrill

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-12  9:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-12  9:29 [PATCH][ARM]Fix addsi3_compare_op2 pattern Renlin Li
2015-11-12  9:33 ` Kyrill Tkachov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).