[01/23] arm: [MVE intrinsics] add binary_round_lshift shape
Checks
Commit Message
This patch adds the binary_round_lshift shape description.
2022-09-08 Christophe Lyon <christophe.lyon@arm.com>
gcc/
* config/arm/arm-mve-builtins-shapes.cc (binary_round_lshift): New.
* config/arm/arm-mve-builtins-shapes.h (binary_round_lshift): New.
---
gcc/config/arm/arm-mve-builtins-shapes.cc | 61 +++++++++++++++++++++++
gcc/config/arm/arm-mve-builtins-shapes.h | 1 +
2 files changed, 62 insertions(+)
Comments
> -----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 01/23] arm: [MVE intrinsics] add binary_round_lshift shape
>
> This patch adds the binary_round_lshift shape description.
>
Ok.
I expect the series to be mostly okay given that it follows the schemes introduced in the previous series, but I'll review each patch individually anyway to make sure.
Thanks again for working on this.
Kyrill
> 2022-09-08 Christophe Lyon <christophe.lyon@arm.com>
>
> gcc/
> * config/arm/arm-mve-builtins-shapes.cc (binary_round_lshift): New.
> * config/arm/arm-mve-builtins-shapes.h (binary_round_lshift): New.
> ---
> gcc/config/arm/arm-mve-builtins-shapes.cc | 61 +++++++++++++++++++++++
> gcc/config/arm/arm-mve-builtins-shapes.h | 1 +
> 2 files changed, 62 insertions(+)
>
> diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-
> mve-builtins-shapes.cc
> index 5e6681c784a..28a2d66ddd1 100644
> --- a/gcc/config/arm/arm-mve-builtins-shapes.cc
> +++ b/gcc/config/arm/arm-mve-builtins-shapes.cc
> @@ -458,6 +458,67 @@ struct binary_orrq_def : public overloaded_base<0>
> };
> SHAPE (binary_orrq)
>
> +/* <T0>_t vfoo[t0](<T0>_t, <T0>_t)
> + <T0>_t vfoo[_n_t0](<T0>_t, int32_t)
> +
> + Shape for rounding shift left operations.
> +
> + Example: vrshlq.
> + int8x16_t [__arm_]vrshlq[_n_s8](int8x16_t a, int32_t b)
> + int8x16_t [__arm_]vrshlq_m_n[_s8](int8x16_t a, int32_t b, mve_pred16_t
> p)
> + int8x16_t [__arm_]vrshlq[_s8](int8x16_t a, int8x16_t b)
> + int8x16_t [__arm_]vrshlq_m[_s8](int8x16_t inactive, int8x16_t a, int8x16_t
> b, mve_pred16_t p)
> + int8x16_t [__arm_]vrshlq_x[_s8](int8x16_t a, int8x16_t b, mve_pred16_t p)
> */
> +struct binary_round_lshift_def : public overloaded_base<0>
> +{
> + bool
> + explicit_mode_suffix_p (enum predication_index pred, enum
> mode_suffix_index mode) const override
> + {
> + return ((mode == MODE_n)
> + && (pred == PRED_m));
> + }
> +
> + bool
> + skip_overload_p (enum predication_index pred, enum mode_suffix_index
> mode) const override
> + {
> + switch (mode)
> + {
> + case MODE_none:
> + return false;
> +
> + /* For MODE_n, share the overloaded instance with MODE_none,
> except for PRED_m. */
> + case MODE_n:
> + return pred != PRED_m;
> +
> + default:
> + gcc_unreachable ();
> + }
> + }
> +
> + 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);
> + b.add_overloaded_functions (group, MODE_n,
> preserve_user_namespace);
> + build_all (b, "v0,v0,vs0", group, MODE_none, preserve_user_namespace);
> + build_all (b, "v0,v0,ss32", group, MODE_n, preserve_user_namespace,
> false, preds_m_or_none);
> + }
> +
> + tree
> + resolve (function_resolver &r) const override
> + {
> + unsigned int i, nargs;
> + type_suffix_index type;
> + if (!r.check_gp_argument (2, i, nargs)
> + || (type = r.infer_vector_type (0)) == NUM_TYPE_SUFFIXES)
> + return error_mark_node;
> +
> + return r.finish_opt_n_resolution (i, 0, type, TYPE_signed);
> + }
> +};
> +SHAPE (binary_round_lshift)
> +
> /* <T0>xN_t vfoo[_t0](uint64_t, uint64_t)
>
> where there are N arguments in total.
> diff --git a/gcc/config/arm/arm-mve-builtins-shapes.h b/gcc/config/arm/arm-
> mve-builtins-shapes.h
> index 3305d12877a..cef081aa8ec 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_opt_n;
> extern const function_shape *const binary_orrq;
> + extern const function_shape *const binary_round_lshift;
> extern const function_shape *const create;
> extern const function_shape *const inherent;
> extern const function_shape *const unary_convert;
> --
> 2.34.1
@@ -458,6 +458,67 @@ struct binary_orrq_def : public overloaded_base<0>
};
SHAPE (binary_orrq)
+/* <T0>_t vfoo[t0](<T0>_t, <T0>_t)
+ <T0>_t vfoo[_n_t0](<T0>_t, int32_t)
+
+ Shape for rounding shift left operations.
+
+ Example: vrshlq.
+ int8x16_t [__arm_]vrshlq[_n_s8](int8x16_t a, int32_t b)
+ int8x16_t [__arm_]vrshlq_m_n[_s8](int8x16_t a, int32_t b, mve_pred16_t p)
+ int8x16_t [__arm_]vrshlq[_s8](int8x16_t a, int8x16_t b)
+ int8x16_t [__arm_]vrshlq_m[_s8](int8x16_t inactive, int8x16_t a, int8x16_t b, mve_pred16_t p)
+ int8x16_t [__arm_]vrshlq_x[_s8](int8x16_t a, int8x16_t b, mve_pred16_t p) */
+struct binary_round_lshift_def : public overloaded_base<0>
+{
+ bool
+ explicit_mode_suffix_p (enum predication_index pred, enum mode_suffix_index mode) const override
+ {
+ return ((mode == MODE_n)
+ && (pred == PRED_m));
+ }
+
+ bool
+ skip_overload_p (enum predication_index pred, enum mode_suffix_index mode) const override
+ {
+ switch (mode)
+ {
+ case MODE_none:
+ return false;
+
+ /* For MODE_n, share the overloaded instance with MODE_none, except for PRED_m. */
+ case MODE_n:
+ return pred != PRED_m;
+
+ default:
+ gcc_unreachable ();
+ }
+ }
+
+ 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);
+ b.add_overloaded_functions (group, MODE_n, preserve_user_namespace);
+ build_all (b, "v0,v0,vs0", group, MODE_none, preserve_user_namespace);
+ build_all (b, "v0,v0,ss32", group, MODE_n, preserve_user_namespace, false, preds_m_or_none);
+ }
+
+ tree
+ resolve (function_resolver &r) const override
+ {
+ unsigned int i, nargs;
+ type_suffix_index type;
+ if (!r.check_gp_argument (2, i, nargs)
+ || (type = r.infer_vector_type (0)) == NUM_TYPE_SUFFIXES)
+ return error_mark_node;
+
+ return r.finish_opt_n_resolution (i, 0, type, TYPE_signed);
+ }
+};
+SHAPE (binary_round_lshift)
+
/* <T0>xN_t vfoo[_t0](uint64_t, uint64_t)
where there are N arguments in total.
@@ -37,6 +37,7 @@ namespace arm_mve
extern const function_shape *const binary;
extern const function_shape *const binary_opt_n;
extern const function_shape *const binary_orrq;
+ extern const function_shape *const binary_round_lshift;
extern const function_shape *const create;
extern const function_shape *const inherent;
extern const function_shape *const unary_convert;