[05/22] arm: [MVE intrinsics] add binary_opt_n shape

Message ID 20230418134608.244751-6-christophe.lyon@arm.com
State Committed
Commit fc4cbe8f59b2c3e29c6ef95833b12b57704f0520
Headers
Series arm: New framework for MVE intrinsics |

Commit Message

Christophe Lyon April 18, 2023, 1:45 p.m. UTC
  This patch adds the binary_opt_n shape description.

	gcc/
	* config/arm/arm-mve-builtins-shapes.cc (binary_opt_n): New.
	* config/arm/arm-mve-builtins-shapes.h (binary_opt_n): New.
---
 gcc/config/arm/arm-mve-builtins-shapes.cc | 32 +++++++++++++++++++++++
 gcc/config/arm/arm-mve-builtins-shapes.h  |  1 +
 2 files changed, 33 insertions(+)
  

Comments

Kyrylo Tkachov May 2, 2023, 4:16 p.m. UTC | #1
> -----Original Message-----
> From: Christophe Lyon <christophe.lyon@arm.com>
> Sent: Tuesday, April 18, 2023 2:46 PM
> To: gcc-patches@gcc.gnu.org; Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>;
> Richard Earnshaw <Richard.Earnshaw@arm.com>; Richard Sandiford
> <Richard.Sandiford@arm.com>
> Cc: Christophe Lyon <Christophe.Lyon@arm.com>
> Subject: [PATCH 05/22] arm: [MVE intrinsics] add binary_opt_n shape
> 
> This patch adds the binary_opt_n shape description.
> 

Ok.
Thanks,
Kyrill

> 	gcc/
> 	* config/arm/arm-mve-builtins-shapes.cc (binary_opt_n): New.
> 	* config/arm/arm-mve-builtins-shapes.h (binary_opt_n): New.
> ---
>  gcc/config/arm/arm-mve-builtins-shapes.cc | 32 +++++++++++++++++++++++
>  gcc/config/arm/arm-mve-builtins-shapes.h  |  1 +
>  2 files changed, 33 insertions(+)
> 
> diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-
> mve-builtins-shapes.cc
> index ce476aa196e..033b304060a 100644
> --- a/gcc/config/arm/arm-mve-builtins-shapes.cc
> +++ b/gcc/config/arm/arm-mve-builtins-shapes.cc
> @@ -338,6 +338,38 @@ struct overloaded_base : public function_shape
>    }
>  };
> 
> +/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t)
> +   <T0>_t vfoo[_n_t0](<T0>_t, <S0>_t)
> +
> +   i.e. the standard shape for binary operations that operate on
> +   uniform types.
> +
> +   Example: vaddq.
> +   int8x16_t [__arm_]vaddq[_s8](int8x16_t a, int8x16_t b)
> +   int8x16_t [__arm_]vaddq[_n_s8](int8x16_t a, int8_t b)
> +   int8x16_t [__arm_]vaddq_m[_s8](int8x16_t inactive, int8x16_t a, int8x16_t
> b, mve_pred16_t p)
> +   int8x16_t [__arm_]vaddq_m[_n_s8](int8x16_t inactive, int8x16_t a, int8_t
> b, mve_pred16_t p)
> +   int8x16_t [__arm_]vaddq_x[_s8](int8x16_t a, int8x16_t b, mve_pred16_t p)
> +   int8x16_t [__arm_]vaddq_x[_n_s8](int8x16_t a, int8_t b, mve_pred16_t p)
> */
> +struct binary_opt_n_def : public overloaded_base<0>
> +{
> +  void
> +  build (function_builder &b, const function_group_info &group,
> +	 bool preserve_user_namespace) const override
> +  {
> +    b.add_overloaded_functions (group, MODE_none,
> preserve_user_namespace);
> +    build_all (b, "v0,v0,v0", group, MODE_none, preserve_user_namespace);
> +    build_all (b, "v0,v0,s0", group, MODE_n, preserve_user_namespace);
> +  }
> +
> +  tree
> +  resolve (function_resolver &r) const override
> +  {
> +    return r.resolve_uniform_opt_n (2);
> +  }
> +};
> +SHAPE (binary_opt_n)
> +
>  /* <T0>[xN]_t vfoo_t0().
> 
>     Example: vuninitializedq.
> diff --git a/gcc/config/arm/arm-mve-builtins-shapes.h b/gcc/config/arm/arm-
> mve-builtins-shapes.h
> index a491369425c..43798fdde57 100644
> --- a/gcc/config/arm/arm-mve-builtins-shapes.h
> +++ b/gcc/config/arm/arm-mve-builtins-shapes.h
> @@ -34,6 +34,7 @@ namespace arm_mve
>    namespace shapes
>    {
> 
> +    extern const function_shape *const binary_opt_n;
>      extern const function_shape *const inherent;
>      extern const function_shape *const unary_convert;
> 
> --
> 2.34.1
  

Patch

diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-mve-builtins-shapes.cc
index ce476aa196e..033b304060a 100644
--- a/gcc/config/arm/arm-mve-builtins-shapes.cc
+++ b/gcc/config/arm/arm-mve-builtins-shapes.cc
@@ -338,6 +338,38 @@  struct overloaded_base : public function_shape
   }
 };
 
+/* <T0>_t vfoo[_t0](<T0>_t, <T0>_t)
+   <T0>_t vfoo[_n_t0](<T0>_t, <S0>_t)
+
+   i.e. the standard shape for binary operations that operate on
+   uniform types.
+
+   Example: vaddq.
+   int8x16_t [__arm_]vaddq[_s8](int8x16_t a, int8x16_t b)
+   int8x16_t [__arm_]vaddq[_n_s8](int8x16_t a, int8_t b)
+   int8x16_t [__arm_]vaddq_m[_s8](int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p)
+   int8x16_t [__arm_]vaddq_m[_n_s8](int8x16_t inactive, int8x16_t a, int8_t b, mve_pred16_t p)
+   int8x16_t [__arm_]vaddq_x[_s8](int8x16_t a, int8x16_t b, mve_pred16_t p)
+   int8x16_t [__arm_]vaddq_x[_n_s8](int8x16_t a, int8_t b, mve_pred16_t p)  */
+struct binary_opt_n_def : public overloaded_base<0>
+{
+  void
+  build (function_builder &b, const function_group_info &group,
+	 bool preserve_user_namespace) const override
+  {
+    b.add_overloaded_functions (group, MODE_none, preserve_user_namespace);
+    build_all (b, "v0,v0,v0", group, MODE_none, preserve_user_namespace);
+    build_all (b, "v0,v0,s0", group, MODE_n, preserve_user_namespace);
+  }
+
+  tree
+  resolve (function_resolver &r) const override
+  {
+    return r.resolve_uniform_opt_n (2);
+  }
+};
+SHAPE (binary_opt_n)
+
 /* <T0>[xN]_t vfoo_t0().
 
    Example: vuninitializedq.
diff --git a/gcc/config/arm/arm-mve-builtins-shapes.h b/gcc/config/arm/arm-mve-builtins-shapes.h
index a491369425c..43798fdde57 100644
--- a/gcc/config/arm/arm-mve-builtins-shapes.h
+++ b/gcc/config/arm/arm-mve-builtins-shapes.h
@@ -34,6 +34,7 @@  namespace arm_mve
   namespace shapes
   {
 
+    extern const function_shape *const binary_opt_n;
     extern const function_shape *const inherent;
     extern const function_shape *const unary_convert;