public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tamar Christina <tnfchris@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-5753] AArch64: fix aarch64_usubw pattern
Date: Wed, 22 Nov 2023 10:37:47 +0000 (GMT)	[thread overview]
Message-ID: <20231122103747.2A0B53858D35@sourceware.org> (raw)

https://gcc.gnu.org/g:c2ef4708856f2ccb7ce96489c6ee4b8c775257a8

commit r14-5753-gc2ef4708856f2ccb7ce96489c6ee4b8c775257a8
Author: Tamar Christina <tamar.christina@arm.com>
Date:   Wed Nov 22 10:36:43 2023 +0000

    AArch64: fix aarch64_usubw pattern
    
    It looks like during my pre-commit testrun I forgot to apply this patch
    to the patch stack.  It had a typo in the element size.
    
    It also looks like since the hi/lo operations take different element
    counts for the assembler syntax that I can't have a unified pattern.
    
    gcc/ChangeLog:
    
            * config/aarch64/aarch64-simd.md
            (aarch64_uaddw<mode>_<PERM_EXTEND:perm_hilo>_zip,
            aarch64_usubw<mode>_<PERM_EXTEND:perm_hilo>_zip): Split into...
            (aarch64_uaddw<mode>_lo_zip, aarch64_uaddw<mode>_hi_zip,
            "aarch64_usubw<mode>_lo_zip, "aarch64_usubw<mode>_hi_zip): ... This.
            * config/aarch64/iterators.md (PERM_EXTEND, perm_index): Remove.
            (perm_hilo): Remove UNSPEC_ZIP1, UNSPEC_ZIP2.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/aarch64/uxtl-combine-4.c: Fix typo.
            * gcc.target/aarch64/uxtl-combine-5.c: Likewise.
            * gcc.target/aarch64/uxtl-combine-6.c: Likewise.

Diff:
---
 gcc/config/aarch64/aarch64-simd.md                | 40 +++++++++++++++++++----
 gcc/config/aarch64/iterators.md                   |  8 +----
 gcc/testsuite/gcc.target/aarch64/uxtl-combine-4.c |  2 +-
 gcc/testsuite/gcc.target/aarch64/uxtl-combine-5.c |  2 +-
 gcc/testsuite/gcc.target/aarch64/uxtl-combine-6.c |  2 +-
 5 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index 75ee6598710..80e338bb895 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -4810,7 +4810,7 @@
   [(set_attr "type" "neon_sub_widen")]
 )
 
-(define_insn "aarch64_usubw<mode>_<PERM_EXTEND:perm_hilo>_zip"
+(define_insn "aarch64_usubw<mode>_lo_zip"
   [(set (match_operand:<VWIDE> 0 "register_operand" "=w")
 	(minus:<VWIDE>
 	  (match_operand:<VWIDE> 1 "register_operand" "w")
@@ -4818,23 +4818,51 @@
 	    (unspec:<MODE> [
 		(match_operand:VQW 2 "register_operand" "w")
 		(match_operand:VQW 3 "aarch64_simd_imm_zero")
-	       ] PERM_EXTEND) 0)))]
+	       ] UNSPEC_ZIP1) 0)))]
   "TARGET_SIMD"
-  "usubw<PERM_EXTEND:perm_index>\\t%0.<Vwtype>, %1.<Vwtype>, %2.<Vhalftype>"
+  "usubw\\t%0.<Vwtype>, %1.<Vwtype>, %2.<Vhalftype>"
   [(set_attr "type" "neon_sub_widen")]
 )
 
-(define_insn "aarch64_uaddw<mode>_<PERM_EXTEND:perm_hilo>_zip"
+(define_insn "aarch64_uaddw<mode>_lo_zip"
   [(set (match_operand:<VWIDE> 0 "register_operand" "=w")
 	(plus:<VWIDE>
 	  (subreg:<VWIDE>
 	    (unspec:<MODE> [
 		(match_operand:VQW 2 "register_operand" "w")
 		(match_operand:VQW 3 "aarch64_simd_imm_zero")
-	       ] PERM_EXTEND) 0)
+	       ] UNSPEC_ZIP1) 0)
 	  (match_operand:<VWIDE> 1 "register_operand" "w")))]
   "TARGET_SIMD"
-  "uaddw<PERM_EXTEND:perm_index>\\t%0.<Vwtype>, %1.<Vwtype>, %2.<Vhalftype>"
+  "uaddw\\t%0.<Vwtype>, %1.<Vwtype>, %2.<Vhalftype>"
+  [(set_attr "type" "neon_add_widen")]
+)
+
+(define_insn "aarch64_usubw<mode>_hi_zip"
+  [(set (match_operand:<VWIDE> 0 "register_operand" "=w")
+	(minus:<VWIDE>
+	  (match_operand:<VWIDE> 1 "register_operand" "w")
+	  (subreg:<VWIDE>
+	    (unspec:<MODE> [
+		(match_operand:VQW 2 "register_operand" "w")
+		(match_operand:VQW 3 "aarch64_simd_imm_zero")
+	       ] UNSPEC_ZIP2) 0)))]
+  "TARGET_SIMD"
+  "usubw2\\t%0.<Vwtype>, %1.<Vwtype>, %2.<Vtype>"
+  [(set_attr "type" "neon_sub_widen")]
+)
+
+(define_insn "aarch64_uaddw<mode>_hi_zip"
+  [(set (match_operand:<VWIDE> 0 "register_operand" "=w")
+	(plus:<VWIDE>
+	  (subreg:<VWIDE>
+	    (unspec:<MODE> [
+		(match_operand:VQW 2 "register_operand" "w")
+		(match_operand:VQW 3 "aarch64_simd_imm_zero")
+	       ] UNSPEC_ZIP2) 0)
+	  (match_operand:<VWIDE> 1 "register_operand" "w")))]
+  "TARGET_SIMD"
+  "uaddw2\\t%0.<Vwtype>, %1.<Vwtype>, %2.<Vtype>"
   [(set_attr "type" "neon_add_widen")]
 )
 
diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md
index 2354315d7d2..a920de99ffc 100644
--- a/gcc/config/aarch64/iterators.md
+++ b/gcc/config/aarch64/iterators.md
@@ -2645,9 +2645,6 @@
 (define_int_iterator OPTAB_PERMUTE [UNSPEC_ZIP1 UNSPEC_ZIP2
 				    UNSPEC_UZP1 UNSPEC_UZP2])
 
-;; Permutes for zero extends
-(define_int_iterator PERM_EXTEND [UNSPEC_ZIP1 UNSPEC_ZIP2])
-
 (define_int_iterator REVERSE [UNSPEC_REV64 UNSPEC_REV32 UNSPEC_REV16])
 
 (define_int_iterator FRINT [UNSPEC_FRINTZ UNSPEC_FRINTP UNSPEC_FRINTM
@@ -3470,10 +3467,7 @@
 			 (UNSPEC_REV16 "16")])
 
 (define_int_attr perm_hilo [(UNSPEC_UNPACKSHI "hi") (UNSPEC_UNPACKUHI "hi")
-			    (UNSPEC_UNPACKSLO "lo") (UNSPEC_UNPACKULO "lo")
-			    (UNSPEC_ZIP2 "hi") (UNSPEC_ZIP1 "lo")])
-
-(define_int_attr perm_index [(UNSPEC_ZIP2 "2") (UNSPEC_ZIP1 "")])
+			    (UNSPEC_UNPACKSLO "lo") (UNSPEC_UNPACKULO "lo")])
 
 ;; Return true if the associated optab refers to the high-numbered lanes,
 ;; false if it refers to the low-numbered lanes.  The convention is for
diff --git a/gcc/testsuite/gcc.target/aarch64/uxtl-combine-4.c b/gcc/testsuite/gcc.target/aarch64/uxtl-combine-4.c
index e1a9c4f5661..67944f70ecc 100755
--- a/gcc/testsuite/gcc.target/aarch64/uxtl-combine-4.c
+++ b/gcc/testsuite/gcc.target/aarch64/uxtl-combine-4.c
@@ -16,5 +16,5 @@ void d2 (SIGN TYPE2 * restrict a, SIGN TYPE1 *b, int n)
 /* { dg-final { scan-assembler-not {\tzip1\t} } } */
 /* { dg-final { scan-assembler-not {\tzip2\t} } } */
 /* { dg-final { scan-assembler-times {\tsxtl\t} 1 } } */
-/* { dg-final { scan-assembler-time {\tsxtl2\t} 1 } } */
+/* { dg-final { scan-assembler-times {\tsxtl2\t} 1 } } */
 
diff --git a/gcc/testsuite/gcc.target/aarch64/uxtl-combine-5.c b/gcc/testsuite/gcc.target/aarch64/uxtl-combine-5.c
index 92b09ba4abb..e691c4f0b59 100755
--- a/gcc/testsuite/gcc.target/aarch64/uxtl-combine-5.c
+++ b/gcc/testsuite/gcc.target/aarch64/uxtl-combine-5.c
@@ -16,5 +16,5 @@ void d2 (SIGN TYPE2 * restrict a, SIGN TYPE1 *b, int n)
 /* { dg-final { scan-assembler-not {\tzip1\t} } } */
 /* { dg-final { scan-assembler-not {\tzip2\t} } } */
 /* { dg-final { scan-assembler-times {\tsxtl\t} 1 } } */
-/* { dg-final { scan-assembler-time {\tsxtl2\t} 1 } } */
+/* { dg-final { scan-assembler-times {\tsxtl2\t} 1 } } */
 
diff --git a/gcc/testsuite/gcc.target/aarch64/uxtl-combine-6.c b/gcc/testsuite/gcc.target/aarch64/uxtl-combine-6.c
index 5c6e635f29d..9383f7ebf93 100755
--- a/gcc/testsuite/gcc.target/aarch64/uxtl-combine-6.c
+++ b/gcc/testsuite/gcc.target/aarch64/uxtl-combine-6.c
@@ -16,5 +16,5 @@ void d2 (SIGN TYPE2 * restrict a, SIGN TYPE1 *b, int n)
 /* { dg-final { scan-assembler-not {\tzip1\t} } } */
 /* { dg-final { scan-assembler-not {\tzip2\t} } } */
 /* { dg-final { scan-assembler-times {\tsxtl\t} 1 } } */
-/* { dg-final { scan-assembler-time {\tsxtl2\t} 1 } } */
+/* { dg-final { scan-assembler-times {\tsxtl2\t} 1 } } */

                 reply	other threads:[~2023-11-22 10:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231122103747.2A0B53858D35@sourceware.org \
    --to=tnfchris@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).