[09/23] arm: [MVE intrinsics] add support for MODE_r

Message ID 20230505083930.101210-9-christophe.lyon@arm.com
State Accepted
Headers
Series [01/23] arm: [MVE intrinsics] add binary_round_lshift shape |

Checks

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

Commit Message

Christophe Lyon May 5, 2023, 8:39 a.m. UTC
  2022-09-08  Christophe Lyon <christophe.lyon@arm.com>

	gcc/
	* config/arm/arm-mve-builtins.cc (has_inactive_argument)
	(finish_opt_n_resolution): Handle MODE_r.
	* config/arm/arm-mve-builtins.def (r): New mode.
---
 gcc/config/arm/arm-mve-builtins.cc  | 8 ++++++--
 gcc/config/arm/arm-mve-builtins.def | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)
  

Comments

Kyrylo Tkachov May 5, 2023, 10:55 a.m. UTC | #1
> -----Original Message-----
> From: Christophe Lyon <christophe.lyon@arm.com>
> Sent: Friday, May 5, 2023 9:39 AM
> 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 09/23] arm: [MVE intrinsics] add support for MODE_r
> 

This is missing a description of what MODE_r is.
I've deduced what it is from looking at the next 3 patches in the series, but I think this patch should have at least a one-sentence summary.
Therefore ok with a cover letter.
Thanks,
Kyrill

> 2022-09-08  Christophe Lyon <christophe.lyon@arm.com>
> 
> 	gcc/
> 	* config/arm/arm-mve-builtins.cc (has_inactive_argument)
> 	(finish_opt_n_resolution): Handle MODE_r.
> 	* config/arm/arm-mve-builtins.def (r): New mode.
> ---
>  gcc/config/arm/arm-mve-builtins.cc  | 8 ++++++--
>  gcc/config/arm/arm-mve-builtins.def | 1 +
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/gcc/config/arm/arm-mve-builtins.cc b/gcc/config/arm/arm-mve-
> builtins.cc
> index 91b3ae71f94..c25b1be9903 100644
> --- a/gcc/config/arm/arm-mve-builtins.cc
> +++ b/gcc/config/arm/arm-mve-builtins.cc
> @@ -669,7 +669,8 @@ function_instance::has_inactive_argument () const
>    if (pred != PRED_m)
>      return false;
> 
> -  if ((base == functions::vorrq && mode_suffix_id == MODE_n)
> +  if (mode_suffix_id == MODE_r
> +      || (base == functions::vorrq && mode_suffix_id == MODE_n)
>        || (base == functions::vqrshlq && mode_suffix_id == MODE_n)
>        || (base == functions::vrshlq && mode_suffix_id == MODE_n))
>      return false;
> @@ -1522,7 +1523,10 @@ finish_opt_n_resolution (unsigned int argno,
> unsigned int first_argno,
>  {
>    if (inferred_type == NUM_TYPE_SUFFIXES)
>      inferred_type = first_type;
> -  tree scalar_form = lookup_form (MODE_n, inferred_type);
> +  mode_suffix_index scalar_mode = MODE_n;
> +  if (mode_suffix_id == MODE_r)
> +    scalar_mode = MODE_r;
> +  tree scalar_form = lookup_form (scalar_mode, inferred_type);
> 
>    /* Allow the final argument to be scalar, if an _n form exists.  */
>    if (scalar_argument_p (argno))
> diff --git a/gcc/config/arm/arm-mve-builtins.def b/gcc/config/arm/arm-mve-
> builtins.def
> index 49d07364fa2..e3f37876210 100644
> --- a/gcc/config/arm/arm-mve-builtins.def
> +++ b/gcc/config/arm/arm-mve-builtins.def
> @@ -35,6 +35,7 @@
> 
>  DEF_MVE_MODE (n, none, none, none)
>  DEF_MVE_MODE (offset, none, none, bytes)
> +DEF_MVE_MODE (r, none, none, none)
> 
>  #define REQUIRES_FLOAT false
>  DEF_MVE_TYPE (mve_pred16_t, boolean_type_node)
> --
> 2.34.1
  

Patch

diff --git a/gcc/config/arm/arm-mve-builtins.cc b/gcc/config/arm/arm-mve-builtins.cc
index 91b3ae71f94..c25b1be9903 100644
--- a/gcc/config/arm/arm-mve-builtins.cc
+++ b/gcc/config/arm/arm-mve-builtins.cc
@@ -669,7 +669,8 @@  function_instance::has_inactive_argument () const
   if (pred != PRED_m)
     return false;
 
-  if ((base == functions::vorrq && mode_suffix_id == MODE_n)
+  if (mode_suffix_id == MODE_r
+      || (base == functions::vorrq && mode_suffix_id == MODE_n)
       || (base == functions::vqrshlq && mode_suffix_id == MODE_n)
       || (base == functions::vrshlq && mode_suffix_id == MODE_n))
     return false;
@@ -1522,7 +1523,10 @@  finish_opt_n_resolution (unsigned int argno, unsigned int first_argno,
 {
   if (inferred_type == NUM_TYPE_SUFFIXES)
     inferred_type = first_type;
-  tree scalar_form = lookup_form (MODE_n, inferred_type);
+  mode_suffix_index scalar_mode = MODE_n;
+  if (mode_suffix_id == MODE_r)
+    scalar_mode = MODE_r;
+  tree scalar_form = lookup_form (scalar_mode, inferred_type);
 
   /* Allow the final argument to be scalar, if an _n form exists.  */
   if (scalar_argument_p (argno))
diff --git a/gcc/config/arm/arm-mve-builtins.def b/gcc/config/arm/arm-mve-builtins.def
index 49d07364fa2..e3f37876210 100644
--- a/gcc/config/arm/arm-mve-builtins.def
+++ b/gcc/config/arm/arm-mve-builtins.def
@@ -35,6 +35,7 @@ 
 
 DEF_MVE_MODE (n, none, none, none)
 DEF_MVE_MODE (offset, none, none, bytes)
+DEF_MVE_MODE (r, none, none, none)
 
 #define REQUIRES_FLOAT false
 DEF_MVE_TYPE (mve_pred16_t, boolean_type_node)