From: Christophe Lyon Date: Mon, 20 Feb 2023 14:04:29 +0000 (+0000) Subject: arm: [MVE intrinsics] add binary_orrq shape X-Git-Tag: basepoints/gcc-15~9695 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=566094741d98ba746f37a651e30d60595f57c11e;p=thirdparty%2Fgcc.git arm: [MVE intrinsics] add binary_orrq shape patch adds the binary_orrq shape description. MODE_n intrinsics use a set of predicates (preds_m_or_none) different the MODE_none ones, so we explicitly reference preds_m_or_none from the shape, thus we need to make it a global array. 2022-09-08 Christophe Lyon gcc/ * config/arm/arm-mve-builtins-shapes.cc (binary_orrq): New. * config/arm/arm-mve-builtins-shapes.h (binary_orrq): New. * config/arm/arm-mve-builtins.cc (preds_m_or_none): Remove static. * config/arm/arm-mve-builtins.h (preds_m_or_none): Declare. --- diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-mve-builtins-shapes.cc index e69faae4e2c0..e2f0984e4a0a 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.cc +++ b/gcc/config/arm/arm-mve-builtins-shapes.cc @@ -397,6 +397,67 @@ struct binary_opt_n_def : public overloaded_base<0> }; SHAPE (binary_opt_n) +/* _t vfoo[t0](_t, _t) + _t vfoo[_n_t0](_t, _t) + + Where the _n form only supports s16/s32/u16/u32 types as for vorrq. + + Example: vorrq. + int16x8_t [__arm_]vorrq[_s16](int16x8_t a, int16x8_t b) + int16x8_t [__arm_]vorrq_m[_s16](int16x8_t inactive, int16x8_t a, int16x8_t b, mve_pred16_t p) + int16x8_t [__arm_]vorrq_x[_s16](int16x8_t a, int16x8_t b, mve_pred16_t p) + int16x8_t [__arm_]vorrq[_n_s16](int16x8_t a, const int16_t imm) + int16x8_t [__arm_]vorrq_m_n[_s16](int16x8_t a, const int16_t imm, mve_pred16_t p) */ +struct binary_orrq_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,v0", group, MODE_none, preserve_user_namespace); + build_16_32 (b, "v0,v0,s0", 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); + } +}; +SHAPE (binary_orrq) + /* [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 b00ee5eb57af..618b32260500 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.h +++ b/gcc/config/arm/arm-mve-builtins-shapes.h @@ -36,6 +36,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 inherent; extern const function_shape *const unary_convert; diff --git a/gcc/config/arm/arm-mve-builtins.cc b/gcc/config/arm/arm-mve-builtins.cc index e409a029346a..c74e890bd3df 100644 --- a/gcc/config/arm/arm-mve-builtins.cc +++ b/gcc/config/arm/arm-mve-builtins.cc @@ -285,7 +285,7 @@ static const predication_index preds_none[] = { PRED_none, NUM_PREDS }; /* Used by functions that have the m (merging) predicated form, and in addition have an unpredicated form. */ -static const predication_index preds_m_or_none[] = { +const predication_index preds_m_or_none[] = { PRED_m, PRED_none, NUM_PREDS }; diff --git a/gcc/config/arm/arm-mve-builtins.h b/gcc/config/arm/arm-mve-builtins.h index a20d2fb5d86c..c9b51a0c77bc 100644 --- a/gcc/config/arm/arm-mve-builtins.h +++ b/gcc/config/arm/arm-mve-builtins.h @@ -135,6 +135,9 @@ enum predication_index NUM_PREDS }; +/* Some shapes need access to some predicate sets. */ +extern const predication_index preds_m_or_none[]; + /* Classifies element types, based on type suffixes with the bit count removed. */ enum type_class_index