public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ARM]Add earlyclobber modifier for neon_(vtrn, vuzp, vzip)<mode>_insn rtx pattern.
@ 2015-10-06 17:27 Renlin Li
  2015-10-07  9:39 ` Ramana Radhakrishnan
  0 siblings, 1 reply; 2+ messages in thread
From: Renlin Li @ 2015-10-06 17:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ramana Radhakrishnan, Kyrill Tkachov

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

Hi all,

Previously, the compiler will generate the following pattern, which will 
cause an ICE during postreload pass. Meanwhile, the instruction itself 
produces UNKNOWN result when the source and destination register are the 
same according to ARM instruction manual. The same rule applies to vtrn 
and vzip patterns.

(insn 50 71 106 3 (parallel [
             (set (reg:V2SI 48 d16 [172])
                 (unspec:V2SI [
                         (reg:V2SI 48 d16 [172])
                         (reg:V2SI 48 d16 [172])
                     ] UNSPEC_VUZP1))
             (set (reg:V2SI 48 d16 [172])
                 (unspec:V2SI [
                         (reg:V2SI 48 d16 [172])
                         (reg:V2SI 48 d16 [172])
                     ] UNSPEC_VUZP2))
         ]) /src/gcc/gcc/testsuite/gcc.dg/vect/pr37474.c:21 1991 
{*neon_vuzpv2si_insn}
      (nil))

The ICE is triggered when compiling gcc.dg/vect/pr37474.c using 
arm-none-linux-gnueabihf toolchain.

Adding "&" modifier to operands[0] and operands[2] will explicitly 
prevent those two register operands getting the same register.
I made the same changes to neon_vtrn<mode>_insn and neon_vzip<mode>_insn 
pattern as well.

arm-none-linux-gnueabihf regression tests Okay. Okay to commit?

Regards,
Renlin Li

gcc/ChangeLog:

2015-10-06  Renlin Li  <renlin.li@arm.com>

     * config/arm/neon.md (neon_vuzp<mode>_insn): Add & modifier for
         operands[0] and operands[2].
         (neon_vtrn<mode>_insn): Likewise.
         (neon_vzip<mode>_insn): Likewise.


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

diff --git a/gcc/config/arm/neon.md b/gcc/config/arm/neon.md
index 2667866..e5a2b0f 100644
--- a/gcc/config/arm/neon.md
+++ b/gcc/config/arm/neon.md
@@ -4074,11 +4074,11 @@ if (BYTES_BIG_ENDIAN)
 
 ;; Note: Different operand numbering to handle tied registers correctly.
 (define_insn "*neon_vtrn<mode>_insn"
-  [(set (match_operand:VDQW 0 "s_register_operand" "=w")
+  [(set (match_operand:VDQW 0 "s_register_operand" "=&w")
         (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0")
                       (match_operand:VDQW 3 "s_register_operand" "2")]
                      UNSPEC_VTRN1))
-   (set (match_operand:VDQW 2 "s_register_operand" "=w")
+   (set (match_operand:VDQW 2 "s_register_operand" "=&w")
          (unspec:VDQW [(match_dup 1) (match_dup 3)]
                      UNSPEC_VTRN2))]
   "TARGET_NEON"
@@ -4100,11 +4100,11 @@ if (BYTES_BIG_ENDIAN)
 
 ;; Note: Different operand numbering to handle tied registers correctly.
 (define_insn "*neon_vzip<mode>_insn"
-  [(set (match_operand:VDQW 0 "s_register_operand" "=w")
+  [(set (match_operand:VDQW 0 "s_register_operand" "=&w")
         (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0")
                       (match_operand:VDQW 3 "s_register_operand" "2")]
                      UNSPEC_VZIP1))
-   (set (match_operand:VDQW 2 "s_register_operand" "=w")
+   (set (match_operand:VDQW 2 "s_register_operand" "=&w")
         (unspec:VDQW [(match_dup 1) (match_dup 3)]
                      UNSPEC_VZIP2))]
   "TARGET_NEON"
@@ -4126,11 +4126,11 @@ if (BYTES_BIG_ENDIAN)
 
 ;; Note: Different operand numbering to handle tied registers correctly.
 (define_insn "*neon_vuzp<mode>_insn"
-  [(set (match_operand:VDQW 0 "s_register_operand" "=w")
+  [(set (match_operand:VDQW 0 "s_register_operand" "=&w")
         (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0")
                       (match_operand:VDQW 3 "s_register_operand" "2")]
                      UNSPEC_VUZP1))
-   (set (match_operand:VDQW 2 "s_register_operand" "=w")
+   (set (match_operand:VDQW 2 "s_register_operand" "=&w")
         (unspec:VDQW [(match_dup 1) (match_dup 3)]
                      UNSPEC_VUZP2))]
   "TARGET_NEON"

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

* Re: [PATCH][ARM]Add earlyclobber modifier for neon_(vtrn, vuzp, vzip)<mode>_insn rtx pattern.
  2015-10-06 17:27 [PATCH][ARM]Add earlyclobber modifier for neon_(vtrn, vuzp, vzip)<mode>_insn rtx pattern Renlin Li
@ 2015-10-07  9:39 ` Ramana Radhakrishnan
  0 siblings, 0 replies; 2+ messages in thread
From: Ramana Radhakrishnan @ 2015-10-07  9:39 UTC (permalink / raw)
  To: Renlin Li, gcc-patches; +Cc: Ramana Radhakrishnan, Kyrill Tkachov



On 06/10/15 18:27, Renlin Li wrote:
> Hi all,
> 
> Previously, the compiler will generate the following pattern, which will cause an ICE during postreload pass. Meanwhile, the instruction itself produces UNKNOWN result when the source and destination register are the same according to ARM instruction manual. The same rule applies to vtrn and vzip patterns.
> 
> (insn 50 71 106 3 (parallel [
>             (set (reg:V2SI 48 d16 [172])
>                 (unspec:V2SI [
>                         (reg:V2SI 48 d16 [172])
>                         (reg:V2SI 48 d16 [172])
>                     ] UNSPEC_VUZP1))
>             (set (reg:V2SI 48 d16 [172])
>                 (unspec:V2SI [
>                         (reg:V2SI 48 d16 [172])
>                         (reg:V2SI 48 d16 [172])
>                     ] UNSPEC_VUZP2))
>         ]) /src/gcc/gcc/testsuite/gcc.dg/vect/pr37474.c:21 1991 {*neon_vuzpv2si_insn}
>      (nil))
> 
> The ICE is triggered when compiling gcc.dg/vect/pr37474.c using arm-none-linux-gnueabihf toolchain.
> 
> Adding "&" modifier to operands[0] and operands[2] will explicitly prevent those two register operands getting the same register.

> I made the same changes to neon_vtrn<mode>_insn and neon_vzip<mode>_insn pattern as well.
> 
> arm-none-linux-gnueabihf regression tests Okay. Okay to commit?


OK  - please watch out for any fallout in the coming days.

After letting this bake for a few days please backport to all release branches as this is a latent issue in the target that is purely dependent on the pattern.

regards
Ramana


> 
> Regards,
> Renlin Li
> 
> gcc/ChangeLog:
> 
> 2015-10-06  Renlin Li  <renlin.li@arm.com>
> 
>     * config/arm/neon.md (neon_vuzp<mode>_insn): Add & modifier for
>         operands[0] and operands[2].
>         (neon_vtrn<mode>_insn): Likewise.
>         (neon_vzip<mode>_insn): Likewise.
> 

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

end of thread, other threads:[~2015-10-07  9:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-06 17:27 [PATCH][ARM]Add earlyclobber modifier for neon_(vtrn, vuzp, vzip)<mode>_insn rtx pattern Renlin Li
2015-10-07  9:39 ` Ramana Radhakrishnan

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).