public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-84] aarch64: Factorise widening add/sub high-half expanders with iterators
@ 2023-04-19 14:44 Kyrylo Tkachov
  0 siblings, 0 replies; only message in thread
From: Kyrylo Tkachov @ 2023-04-19 14:44 UTC (permalink / raw)
  To: gcc-cvs

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

commit r14-84-ga30078d5d974c3b2c784c522a84fd12df74767dd
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date:   Wed Apr 19 15:43:49 2023 +0100

    aarch64: Factorise widening add/sub high-half expanders with iterators
    
    I noticed these define_expand are almost identical modulo some string substitutions.
    This patch compresses them together with a couple of code iterators.
    No functional change intended.
    Bootstrapped and tested on aarch64-none-linux-gnu.
    
    gcc/ChangeLog:
    
            * config/aarch64/aarch64-simd.md (aarch64_saddw2<mode>): Delete.
            (aarch64_uaddw2<mode>): Delete.
            (aarch64_ssubw2<mode>): Delete.
            (aarch64_usubw2<mode>): Delete.
            (aarch64_<ANY_EXTEND:su><ADDSUB:optab>w2<mode>): New define_expand.

Diff:
---
 gcc/config/aarch64/aarch64-simd.md | 66 ++++++++++++--------------------------
 1 file changed, 20 insertions(+), 46 deletions(-)

diff --git a/gcc/config/aarch64/aarch64-simd.md b/gcc/config/aarch64/aarch64-simd.md
index de2b7383749..1bed24477fb 100644
--- a/gcc/config/aarch64/aarch64-simd.md
+++ b/gcc/config/aarch64/aarch64-simd.md
@@ -4713,52 +4713,26 @@
   [(set_attr "type" "neon_add_widen")]
 )
 
-(define_expand "aarch64_saddw2<mode>"
-  [(match_operand:<VWIDE> 0 "register_operand")
-   (match_operand:<VWIDE> 1 "register_operand")
-   (match_operand:VQW 2 "register_operand")]
-  "TARGET_SIMD"
-{
-  rtx p = aarch64_simd_vect_par_cnst_half (<MODE>mode, <nunits>, true);
-  emit_insn (gen_aarch64_saddw2<mode>_internal (operands[0], operands[1],
-						operands[2], p));
-  DONE;
-})
-
-(define_expand "aarch64_uaddw2<mode>"
-  [(match_operand:<VWIDE> 0 "register_operand")
-   (match_operand:<VWIDE> 1 "register_operand")
-   (match_operand:VQW 2 "register_operand")]
-  "TARGET_SIMD"
-{
-  rtx p = aarch64_simd_vect_par_cnst_half (<MODE>mode, <nunits>, true);
-  emit_insn (gen_aarch64_uaddw2<mode>_internal (operands[0], operands[1],
-						operands[2], p));
-  DONE;
-})
-
-
-(define_expand "aarch64_ssubw2<mode>"
-  [(match_operand:<VWIDE> 0 "register_operand")
-   (match_operand:<VWIDE> 1 "register_operand")
-   (match_operand:VQW 2 "register_operand")]
-  "TARGET_SIMD"
-{
-  rtx p = aarch64_simd_vect_par_cnst_half (<MODE>mode, <nunits>, true);
-  emit_insn (gen_aarch64_ssubw2<mode>_internal (operands[0], operands[1],
-						operands[2], p));
-  DONE;
-})
-
-(define_expand "aarch64_usubw2<mode>"
-  [(match_operand:<VWIDE> 0 "register_operand")
-   (match_operand:<VWIDE> 1 "register_operand")
-   (match_operand:VQW 2 "register_operand")]
-  "TARGET_SIMD"
-{
-  rtx p = aarch64_simd_vect_par_cnst_half (<MODE>mode, <nunits>, true);
-  emit_insn (gen_aarch64_usubw2<mode>_internal (operands[0], operands[1],
-						operands[2], p));
+(define_expand "aarch64_<ANY_EXTEND:su><ADDSUB:optab>w2<mode>"
+  [(set (match_operand:<VWIDE> 0 "register_operand")
+	(ADDSUB:<VWIDE>
+	  (ANY_EXTEND:<VWIDE>
+	    (vec_select:<VHALF>
+	      (match_operand:VQW 2 "register_operand")
+	      (match_dup 3)))
+	  (match_operand:<VWIDE> 1 "register_operand")))]
+  "TARGET_SIMD"
+{
+  /* We still do an emit_insn rather than relying on the pattern above
+     because for the MINUS case the operands would need to be swapped
+     around.  */
+  operands[3]
+    = aarch64_simd_vect_par_cnst_half (<MODE>mode, <nunits>, true);
+  emit_insn (gen_aarch64_<ANY_EXTEND:su><ADDSUB:optab>w2<mode>_internal(
+						       operands[0],
+						       operands[1],
+						       operands[2],
+						       operands[3]));
   DONE;
 })

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-19 14:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-19 14:44 [gcc r14-84] aarch64: Factorise widening add/sub high-half expanders with iterators Kyrylo 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).