https://gcc.gnu.org/g:8080760951b563cedf7b68fcc119f7992bdb39fe
commit r15-6225-g8080760951b563cedf7b68fcc119f7992bdb39fe Author: Christophe Lyon <christophe.l...@linaro.org> Date: Thu Oct 10 16:35:23 2024 +0000 arm: [MVE intrinsics] add mode_after_pred helper in function_shape This new helper returns true if the mode suffix goes after the predicate suffix. This is true in most cases, so the base implementations in nonoverloaded_base and overloaded_base return true. For instance: vaddq_m_n_s32. This will be useful in later patches to implement vstr?q_scatter_offset_p (_p appears after _offset). gcc/ChangeLog: * config/arm/arm-mve-builtins-shapes.cc (struct nonoverloaded_base): Implement mode_after_pred. (struct overloaded_base): Likewise. * config/arm/arm-mve-builtins.cc (function_builder::get_name): Call mode_after_pred as needed. * config/arm/arm-mve-builtins.h (function_shape): Add mode_after_pred. Diff: --- gcc/config/arm/arm-mve-builtins-shapes.cc | 12 ++++++++++++ gcc/config/arm/arm-mve-builtins.cc | 9 ++++++++- gcc/config/arm/arm-mve-builtins.h | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-mve-builtins-shapes.cc index 12e62122ae4e..b5bd03a465bf 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.cc +++ b/gcc/config/arm/arm-mve-builtins-shapes.cc @@ -387,6 +387,12 @@ struct nonoverloaded_base : public function_shape return false; } + bool + mode_after_pred () const override + { + return true; + } + tree resolve (function_resolver &) const override { @@ -417,6 +423,12 @@ struct overloaded_base : public function_shape { return false; } + + bool + mode_after_pred () const override + { + return true; + } }; /* <T0>_t vfoo[_t0](<T0>_t, <T0>_t) diff --git a/gcc/config/arm/arm-mve-builtins.cc b/gcc/config/arm/arm-mve-builtins.cc index 36bd66882b5a..0d8def8c2a57 100644 --- a/gcc/config/arm/arm-mve-builtins.cc +++ b/gcc/config/arm/arm-mve-builtins.cc @@ -886,11 +886,18 @@ function_builder::get_name (const function_instance &instance, if (preserve_user_namespace) append_name ("__arm_"); append_name (instance.base_name); - append_name (pred_suffixes[instance.pred]); + + if (instance.shape->mode_after_pred ()) + append_name (pred_suffixes[instance.pred]); + if (!overloaded_p || instance.shape->explicit_mode_suffix_p (instance.pred, instance.mode_suffix_id)) append_name (instance.mode_suffix ().string); + + if (!instance.shape->mode_after_pred ()) + append_name (pred_suffixes[instance.pred]); + for (unsigned int i = 0; i < 2; ++i) if (!overloaded_p || instance.shape->explicit_type_suffix_p (i, instance.pred, diff --git a/gcc/config/arm/arm-mve-builtins.h b/gcc/config/arm/arm-mve-builtins.h index 2e48d91d5aa0..3e0796f7c09c 100644 --- a/gcc/config/arm/arm-mve-builtins.h +++ b/gcc/config/arm/arm-mve-builtins.h @@ -580,6 +580,7 @@ public: enum mode_suffix_index) const = 0; virtual bool skip_overload_p (enum predication_index, enum mode_suffix_index) const = 0; + virtual bool mode_after_pred () const = 0; /* Define all functions associated with the given group. */ virtual void build (function_builder &,