> -----Original Message----- > From: Christophe Lyon <christophe.l...@arm.com> > Sent: Tuesday, April 18, 2023 2:46 PM > To: gcc-patches@gcc.gnu.org; Kyrylo Tkachov <kyrylo.tkac...@arm.com>; > Richard Earnshaw <richard.earns...@arm.com>; Richard Sandiford > <richard.sandif...@arm.com> > Cc: Christophe Lyon <christophe.l...@arm.com> > Subject: [PATCH 14/22] arm: [MVE intrinsics] add > unspec_mve_function_exact_insn > > Introduce a function that will be used to build intrinsics which use > UNSPECS for the versions. > Ok. Thanks, Kyrill > 2022-09-08 Christophe Lyon <christophe.l...@arm.com> > > gcc/ > * config/arm/arm-mve-builtins-functions.h (class > unspec_mve_function_exact_insn): New. > --- > gcc/config/arm/arm-mve-builtins-functions.h | 151 ++++++++++++++++++++ > 1 file changed, 151 insertions(+) > > diff --git a/gcc/config/arm/arm-mve-builtins-functions.h > b/gcc/config/arm/arm-mve-builtins-functions.h > index 6d992b270b0..5abf913d182 100644 > --- a/gcc/config/arm/arm-mve-builtins-functions.h > +++ b/gcc/config/arm/arm-mve-builtins-functions.h > @@ -225,6 +225,157 @@ public: > } > }; > > +/* Map the function directly to CODE (UNSPEC, M) where M is the vector > + mode associated with type suffix 0. */ > +class unspec_mve_function_exact_insn : public function_base > +{ > +public: > + CONSTEXPR unspec_mve_function_exact_insn (int unspec_for_sint, > + int unspec_for_uint, > + int unspec_for_fp, > + int unspec_for_n_sint, > + int unspec_for_n_uint, > + int unspec_for_n_fp, > + int unspec_for_m_sint, > + int unspec_for_m_uint, > + int unspec_for_m_fp, > + int unspec_for_m_n_sint, > + int unspec_for_m_n_uint, > + int unspec_for_m_n_fp) > + : m_unspec_for_sint (unspec_for_sint), > + m_unspec_for_uint (unspec_for_uint), > + m_unspec_for_fp (unspec_for_fp), > + m_unspec_for_n_sint (unspec_for_n_sint), > + m_unspec_for_n_uint (unspec_for_n_uint), > + m_unspec_for_n_fp (unspec_for_n_fp), > + m_unspec_for_m_sint (unspec_for_m_sint), > + m_unspec_for_m_uint (unspec_for_m_uint), > + m_unspec_for_m_fp (unspec_for_m_fp), > + m_unspec_for_m_n_sint (unspec_for_m_n_sint), > + m_unspec_for_m_n_uint (unspec_for_m_n_uint), > + m_unspec_for_m_n_fp (unspec_for_m_n_fp) > + {} > + > + /* The unspec code associated with signed-integer, unsigned-integer > + and floating-point operations respectively. It covers the cases > + with the _n suffix, and/or the _m predicate. */ > + int m_unspec_for_sint; > + int m_unspec_for_uint; > + int m_unspec_for_fp; > + int m_unspec_for_n_sint; > + int m_unspec_for_n_uint; > + int m_unspec_for_n_fp; > + int m_unspec_for_m_sint; > + int m_unspec_for_m_uint; > + int m_unspec_for_m_fp; > + int m_unspec_for_m_n_sint; > + int m_unspec_for_m_n_uint; > + int m_unspec_for_m_n_fp; > + > + rtx > + expand (function_expander &e) const override > + { > + insn_code code; > + switch (e.pred) > + { > + case PRED_none: > + switch (e.mode_suffix_id) > + { > + case MODE_none: > + /* No predicate, no suffix. */ > + if (e.type_suffix (0).integer_p) > + if (e.type_suffix (0).unsigned_p) > + code = code_for_mve_q (m_unspec_for_uint, > m_unspec_for_uint, e.vector_mode (0)); > + else > + code = code_for_mve_q (m_unspec_for_sint, > m_unspec_for_sint, e.vector_mode (0)); > + else > + code = code_for_mve_q_f (m_unspec_for_fp, e.vector_mode (0)); > + break; > + > + case MODE_n: > + /* No predicate, _n suffix. */ > + if (e.type_suffix (0).integer_p) > + if (e.type_suffix (0).unsigned_p) > + code = code_for_mve_q_n (m_unspec_for_n_uint, > m_unspec_for_n_uint, e.vector_mode (0)); > + else > + code = code_for_mve_q_n (m_unspec_for_n_sint, > m_unspec_for_n_sint, e.vector_mode (0)); > + else > + code = code_for_mve_q_n_f (m_unspec_for_n_fp, e.vector_mode > (0)); > + break; > + > + default: > + gcc_unreachable (); > + } > + return e.use_exact_insn (code); > + > + case PRED_m: > + switch (e.mode_suffix_id) > + { > + case MODE_none: > + /* No suffix, "m" predicate. */ > + if (e.type_suffix (0).integer_p) > + if (e.type_suffix (0).unsigned_p) > + code = code_for_mve_q_m (m_unspec_for_m_uint, > m_unspec_for_m_uint, e.vector_mode (0)); > + else > + code = code_for_mve_q_m (m_unspec_for_m_sint, > m_unspec_for_m_sint, e.vector_mode (0)); > + else > + code = code_for_mve_q_m_f (m_unspec_for_m_fp, > e.vector_mode (0)); > + break; > + > + case MODE_n: > + /* _n suffix, "m" predicate. */ > + if (e.type_suffix (0).integer_p) > + if (e.type_suffix (0).unsigned_p) > + code = code_for_mve_q_m_n (m_unspec_for_m_n_uint, > m_unspec_for_m_n_uint, e.vector_mode (0)); > + else > + code = code_for_mve_q_m_n (m_unspec_for_m_n_sint, > m_unspec_for_m_n_sint, e.vector_mode (0)); > + else > + code = code_for_mve_q_m_n_f (m_unspec_for_m_n_fp, > e.vector_mode (0)); > + break; > + > + default: > + gcc_unreachable (); > + } > + return e.use_cond_insn (code, 0); > + > + case PRED_x: > + switch (e.mode_suffix_id) > + { > + case MODE_none: > + /* No suffix, "x" predicate. */ > + if (e.type_suffix (0).integer_p) > + if (e.type_suffix (0).unsigned_p) > + code = code_for_mve_q_m (m_unspec_for_m_uint, > m_unspec_for_m_uint, e.vector_mode (0)); > + else > + code = code_for_mve_q_m (m_unspec_for_m_sint, > m_unspec_for_m_sint, e.vector_mode (0)); > + else > + code = code_for_mve_q_m_f (m_unspec_for_m_fp, > e.vector_mode (0)); > + break; > + > + case MODE_n: > + /* _n suffix, "x" predicate. */ > + if (e.type_suffix (0).integer_p) > + if (e.type_suffix (0).unsigned_p) > + code = code_for_mve_q_m_n (m_unspec_for_m_n_uint, > m_unspec_for_m_n_uint, e.vector_mode (0)); > + else > + code = code_for_mve_q_m_n (m_unspec_for_m_n_sint, > m_unspec_for_m_n_sint, e.vector_mode (0)); > + else > + code = code_for_mve_q_m_n_f (m_unspec_for_m_n_fp, > e.vector_mode (0)); > + break; > + > + default: > + gcc_unreachable (); > + } > + return e.use_pred_x_insn (code); > + > + default: > + gcc_unreachable (); > + } > + > + gcc_unreachable (); > + } > +}; > + > } /* end namespace arm_mve */ > > /* Declare the global function base NAME, creating it from an instance > -- > 2.34.1
RE: [PATCH 14/22] arm: [MVE intrinsics] add unspec_mve_function_exact_insn
Kyrylo Tkachov via Gcc-patches Wed, 03 May 2023 01:40:38 -0700
- [PATCH 00/22] arm: New framework for MVE i... Christophe Lyon via Gcc-patches
- [PATCH 01/22] arm: move builtin funct... Christophe Lyon via Gcc-patches
- RE: [PATCH 01/22] arm: move built... Kyrylo Tkachov via Gcc-patches
- [PATCH 02/22] arm: [MVE intrinsics] A... Christophe Lyon via Gcc-patches
- [PATCH 14/22] arm: [MVE intrinsics] a... Christophe Lyon via Gcc-patches
- RE: [PATCH 14/22] arm: [MVE intri... Kyrylo Tkachov via Gcc-patches
- [PATCH 03/22] arm: [MVE intrinsics] R... Christophe Lyon via Gcc-patches
- RE: [PATCH 03/22] arm: [MVE intri... Kyrylo Tkachov via Gcc-patches
- Re: [PATCH 03/22] arm: [MVE i... Christophe Lyon via Gcc-patches
- RE: [PATCH 03/22] arm: [M... Kyrylo Tkachov via Gcc-patches
- Re: [PATCH 03/22] ar... Christophe Lyon via Gcc-patches
- [PATCH v2 03/22]... Christophe Lyon via Gcc-patches
- RE: [PATCH v... Kyrylo Tkachov via Gcc-patches
- [PATCH 04/22] arm: [MVE intrinsics] R... Christophe Lyon via Gcc-patches
- RE: [PATCH 04/22] arm: [MVE intri... Kyrylo Tkachov via Gcc-patches
- [PATCH 05/22] arm: [MVE intrinsics] a... Christophe Lyon via Gcc-patches