[01/16] arm: [MVE intrinsics] add binary_maxvminv shape

Message ID 20230509121937.206183-1-christophe.lyon@arm.com
State Accepted
Headers
Series [01/16] arm: [MVE intrinsics] add binary_maxvminv shape |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Christophe Lyon May 9, 2023, 12:19 p.m. UTC
  This patch adds the binary_maxvminv shape description.

2022-09-08  Christophe Lyon  <christophe.lyon@arm.com>

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

Comments

Kyrylo Tkachov May 9, 2023, 1:50 p.m. UTC | #1
Hi Christophe,

> -----Original Message-----
> From: Christophe Lyon <christophe.lyon@arm.com>
> Sent: Tuesday, May 9, 2023 1:19 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 01/16] arm: [MVE intrinsics] add binary_maxvminv shape
> 
> This patch adds the binary_maxvminv shape description.

This patch series is fairly mechanical (that's not to say simple!) and in line with the other series in this area.
You obviously know what you're doing here so I'm comfortable approving it.
I did have a look at the patches individually and with the comment on patch 06/16 addressed this series is ok for trunk.
Thanks,
Kyrill

> 
> 2022-09-08  Christophe Lyon  <christophe.lyon@arm.com>
> 
> 	gcc/
> 	* config/arm/arm-mve-builtins-shapes.cc (binary_maxvminv): New.
> 	* config/arm/arm-mve-builtins-shapes.h (binary_maxvminv): New.
> ---
>  gcc/config/arm/arm-mve-builtins-shapes.cc | 30 +++++++++++++++++++++++
>  gcc/config/arm/arm-mve-builtins-shapes.h  |  1 +
>  2 files changed, 31 insertions(+)
> 
> diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-
> mve-builtins-shapes.cc
> index 1d43b8871bf..19c3c47a20e 100644
> --- a/gcc/config/arm/arm-mve-builtins-shapes.cc
> +++ b/gcc/config/arm/arm-mve-builtins-shapes.cc
> @@ -401,6 +401,36 @@ struct binary_rshift_def : public
> overloaded_base<0>
>  };
>  SHAPE (binary_rshift)
> 
> +/* <S0>_t vfoo[_<t0>](<S0>_t, <T0>_t)
> +
> +   Example: vmaxvq.
> +   int8_t [__arm_]vmaxvq[_s8](int8_t a, int8x16_t b)
> +   int8_t [__arm_]vmaxvq_p[_s8](int8_t a, int8x16_t b, mve_pred16_t p)  */
> +struct binary_maxvminv_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, "s0,s0,v0", group, MODE_none, preserve_user_namespace);
> +  }
> +
> +  tree
> +  resolve (function_resolver &r) const override
> +  {
> +    unsigned int i, nargs;
> +    type_suffix_index type;
> +    if (!r.check_gp_argument (2, i, nargs)
> +	|| !r.require_derived_scalar_type (0, r.SAME_TYPE_CLASS)
> +	|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES)
> +      return error_mark_node;
> +
> +    return r.resolve_to (r.mode_suffix_id, type);
> +  }
> +};
> +SHAPE (binary_maxvminv)
> +
>  /* <T0:half>_t vfoo[_t0](<T0:half>_t, <T0>_t)
> 
>     Example: vmovnbq.
> diff --git a/gcc/config/arm/arm-mve-builtins-shapes.h b/gcc/config/arm/arm-
> mve-builtins-shapes.h
> index dd2597dc6f5..9debf1d8733 100644
> --- a/gcc/config/arm/arm-mve-builtins-shapes.h
> +++ b/gcc/config/arm/arm-mve-builtins-shapes.h
> @@ -37,6 +37,7 @@ namespace arm_mve
>      extern const function_shape *const binary;
>      extern const function_shape *const binary_lshift;
>      extern const function_shape *const binary_lshift_r;
> +    extern const function_shape *const binary_maxvminv;
>      extern const function_shape *const binary_move_narrow;
>      extern const function_shape *const binary_move_narrow_unsigned;
>      extern const function_shape *const binary_opt_n;
> --
> 2.34.1
  
Christophe Lyon May 9, 2023, 6:30 p.m. UTC | #2
On 5/9/23 15:50, Kyrylo Tkachov wrote:
> Hi Christophe,
> 
>> -----Original Message-----
>> From: Christophe Lyon <christophe.lyon@arm.com>
>> Sent: Tuesday, May 9, 2023 1:19 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 01/16] arm: [MVE intrinsics] add binary_maxvminv shape
>>
>> This patch adds the binary_maxvminv shape description.
> 
> This patch series is fairly mechanical (that's not to say simple!) and in line with the other series in this area.

Yeah it took me a bit of time & thinking to put the series in a 
mechanical shape, hopefully easy to review.

> You obviously know what you're doing here so I'm comfortable approving it.
> I did have a look at the patches individually and with the comment on patch 06/16 addressed this series is ok for trunk.

Thanks,

Christophe

> Thanks,
> Kyrill
> 
>>
>> 2022-09-08  Christophe Lyon  <christophe.lyon@arm.com>
>>
>> 	gcc/
>> 	* config/arm/arm-mve-builtins-shapes.cc (binary_maxvminv): New.
>> 	* config/arm/arm-mve-builtins-shapes.h (binary_maxvminv): New.
>> ---
>>   gcc/config/arm/arm-mve-builtins-shapes.cc | 30 +++++++++++++++++++++++
>>   gcc/config/arm/arm-mve-builtins-shapes.h  |  1 +
>>   2 files changed, 31 insertions(+)
>>
>> diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-
>> mve-builtins-shapes.cc
>> index 1d43b8871bf..19c3c47a20e 100644
>> --- a/gcc/config/arm/arm-mve-builtins-shapes.cc
>> +++ b/gcc/config/arm/arm-mve-builtins-shapes.cc
>> @@ -401,6 +401,36 @@ struct binary_rshift_def : public
>> overloaded_base<0>
>>   };
>>   SHAPE (binary_rshift)
>>
>> +/* <S0>_t vfoo[_<t0>](<S0>_t, <T0>_t)
>> +
>> +   Example: vmaxvq.
>> +   int8_t [__arm_]vmaxvq[_s8](int8_t a, int8x16_t b)
>> +   int8_t [__arm_]vmaxvq_p[_s8](int8_t a, int8x16_t b, mve_pred16_t p)  */
>> +struct binary_maxvminv_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, "s0,s0,v0", group, MODE_none, preserve_user_namespace);
>> +  }
>> +
>> +  tree
>> +  resolve (function_resolver &r) const override
>> +  {
>> +    unsigned int i, nargs;
>> +    type_suffix_index type;
>> +    if (!r.check_gp_argument (2, i, nargs)
>> +	|| !r.require_derived_scalar_type (0, r.SAME_TYPE_CLASS)
>> +	|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES)
>> +      return error_mark_node;
>> +
>> +    return r.resolve_to (r.mode_suffix_id, type);
>> +  }
>> +};
>> +SHAPE (binary_maxvminv)
>> +
>>   /* <T0:half>_t vfoo[_t0](<T0:half>_t, <T0>_t)
>>
>>      Example: vmovnbq.
>> diff --git a/gcc/config/arm/arm-mve-builtins-shapes.h b/gcc/config/arm/arm-
>> mve-builtins-shapes.h
>> index dd2597dc6f5..9debf1d8733 100644
>> --- a/gcc/config/arm/arm-mve-builtins-shapes.h
>> +++ b/gcc/config/arm/arm-mve-builtins-shapes.h
>> @@ -37,6 +37,7 @@ namespace arm_mve
>>       extern const function_shape *const binary;
>>       extern const function_shape *const binary_lshift;
>>       extern const function_shape *const binary_lshift_r;
>> +    extern const function_shape *const binary_maxvminv;
>>       extern const function_shape *const binary_move_narrow;
>>       extern const function_shape *const binary_move_narrow_unsigned;
>>       extern const function_shape *const binary_opt_n;
>> --
>> 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 1d43b8871bf..19c3c47a20e 100644
--- a/gcc/config/arm/arm-mve-builtins-shapes.cc
+++ b/gcc/config/arm/arm-mve-builtins-shapes.cc
@@ -401,6 +401,36 @@  struct binary_rshift_def : public overloaded_base<0>
 };
 SHAPE (binary_rshift)
 
+/* <S0>_t vfoo[_<t0>](<S0>_t, <T0>_t)
+
+   Example: vmaxvq.
+   int8_t [__arm_]vmaxvq[_s8](int8_t a, int8x16_t b)
+   int8_t [__arm_]vmaxvq_p[_s8](int8_t a, int8x16_t b, mve_pred16_t p)  */
+struct binary_maxvminv_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, "s0,s0,v0", group, MODE_none, preserve_user_namespace);
+  }
+
+  tree
+  resolve (function_resolver &r) const override
+  {
+    unsigned int i, nargs;
+    type_suffix_index type;
+    if (!r.check_gp_argument (2, i, nargs)
+	|| !r.require_derived_scalar_type (0, r.SAME_TYPE_CLASS)
+	|| (type = r.infer_vector_type (1)) == NUM_TYPE_SUFFIXES)
+      return error_mark_node;
+
+    return r.resolve_to (r.mode_suffix_id, type);
+  }
+};
+SHAPE (binary_maxvminv)
+
 /* <T0:half>_t vfoo[_t0](<T0:half>_t, <T0>_t)
 
    Example: vmovnbq.
diff --git a/gcc/config/arm/arm-mve-builtins-shapes.h b/gcc/config/arm/arm-mve-builtins-shapes.h
index dd2597dc6f5..9debf1d8733 100644
--- a/gcc/config/arm/arm-mve-builtins-shapes.h
+++ b/gcc/config/arm/arm-mve-builtins-shapes.h
@@ -37,6 +37,7 @@  namespace arm_mve
     extern const function_shape *const binary;
     extern const function_shape *const binary_lshift;
     extern const function_shape *const binary_lshift_r;
+    extern const function_shape *const binary_maxvminv;
     extern const function_shape *const binary_move_narrow;
     extern const function_shape *const binary_move_narrow_unsigned;
     extern const function_shape *const binary_opt_n;