Message ID | 20240904132650.2720446-36-christophe.lyon@linaro.org |
---|---|
State | New |
Headers | show |
Series | arm: [MVE intrinsics] Re-implement more intrinsics | expand |
On 04/09/2024 14:26, Christophe Lyon wrote: > Implement vsbcq vsbciq using the new MVE builtins framework. > > We re-use most of the code introduced by the previous patches. > > 2024-08-28 Christophe Lyon <christophe.lyon@linaro.org> > > gcc/ > > * config/arm/arm-mve-builtins-base.cc (class vadc_vsbc_impl): Add > support for vsbciq and vsbcq. > (vadciq, vadcq): Add new parameter. > (vsbciq): New. > (vsbcq): New. > * config/arm/arm-mve-builtins-base.def (vsbciq): New. > (vsbcq): New. > * config/arm/arm-mve-builtins-base.h (vsbciq): New. > (vsbcq): New. > * config/arm/arm_mve.h (vsbciq): Delete. > (vsbciq_m): Delete. > (vsbcq): Delete. > (vsbcq_m): Delete. > (vsbciq_s32): Delete. > (vsbciq_u32): Delete. > (vsbciq_m_s32): Delete. > (vsbciq_m_u32): Delete. > (vsbcq_s32): Delete. > (vsbcq_u32): Delete. > (vsbcq_m_s32): Delete. > (vsbcq_m_u32): Delete. > (__arm_vsbciq_s32): Delete. > (__arm_vsbciq_u32): Delete. > (__arm_vsbciq_m_s32): Delete. > (__arm_vsbciq_m_u32): Delete. > (__arm_vsbcq_s32): Delete. > (__arm_vsbcq_u32): Delete. > (__arm_vsbcq_m_s32): Delete. > (__arm_vsbcq_m_u32): Delete. > (__arm_vsbciq): Delete. > (__arm_vsbciq_m): Delete. > (__arm_vsbcq): Delete. > (__arm_vsbcq_m): Delete. OK. R. > --- > gcc/config/arm/arm-mve-builtins-base.cc | 56 +++++--- > gcc/config/arm/arm-mve-builtins-base.def | 2 + > gcc/config/arm/arm-mve-builtins-base.h | 2 + > gcc/config/arm/arm_mve.h | 170 ----------------------- > 4 files changed, 42 insertions(+), 188 deletions(-) > > diff --git a/gcc/config/arm/arm-mve-builtins-base.cc b/gcc/config/arm/arm-mve-builtins-base.cc > index 9c2e11356ef..02fccdcb71f 100644 > --- a/gcc/config/arm/arm-mve-builtins-base.cc > +++ b/gcc/config/arm/arm-mve-builtins-base.cc > @@ -559,12 +559,14 @@ public: > class vadc_vsbc_impl : public function_base > { > public: > - CONSTEXPR vadc_vsbc_impl (bool init_carry) > - : m_init_carry (init_carry) > + CONSTEXPR vadc_vsbc_impl (bool init_carry, bool add) > + : m_init_carry (init_carry), m_add (add) > {} > > /* Initialize carry with 0 (vadci). */ > bool m_init_carry; > + /* Add (true) or Sub (false). */ > + bool m_add; > > unsigned int > call_properties (const function_instance &) const override > @@ -647,26 +649,42 @@ public: > { > case PRED_none: > /* No predicate. */ > - unspec = m_init_carry > - ? (e.type_suffix (0).unsigned_p > - ? VADCIQ_U > - : VADCIQ_S) > - : (e.type_suffix (0).unsigned_p > - ? VADCQ_U > - : VADCQ_S); > + unspec = m_add > + ? (m_init_carry > + ? (e.type_suffix (0).unsigned_p > + ? VADCIQ_U > + : VADCIQ_S) > + : (e.type_suffix (0).unsigned_p > + ? VADCQ_U > + : VADCQ_S)) > + : (m_init_carry > + ? (e.type_suffix (0).unsigned_p > + ? VSBCIQ_U > + : VSBCIQ_S) > + : (e.type_suffix (0).unsigned_p > + ? VSBCQ_U > + : VSBCQ_S)); > code = code_for_mve_q_v4si (unspec, unspec); > insns = e.use_exact_insn (code); > break; > > case PRED_m: > /* "m" predicate. */ > - unspec = m_init_carry > - ? (e.type_suffix (0).unsigned_p > - ? VADCIQ_M_U > - : VADCIQ_M_S) > - : (e.type_suffix (0).unsigned_p > - ? VADCQ_M_U > - : VADCQ_M_S); > + unspec = m_add > + ? (m_init_carry > + ? (e.type_suffix (0).unsigned_p > + ? VADCIQ_M_U > + : VADCIQ_M_S) > + : (e.type_suffix (0).unsigned_p > + ? VADCQ_M_U > + : VADCQ_M_S)) > + : (m_init_carry > + ? (e.type_suffix (0).unsigned_p > + ? VSBCIQ_M_U > + : VSBCIQ_M_S) > + : (e.type_suffix (0).unsigned_p > + ? VSBCQ_M_U > + : VSBCQ_M_S)); > code = code_for_mve_q_m_v4si (unspec, unspec); > insns = e.use_cond_insn (code, 0); > break; > @@ -862,8 +880,8 @@ namespace arm_mve { > FUNCTION_PRED_P_S_U (vabavq, VABAVQ) > FUNCTION_WITHOUT_N (vabdq, VABDQ) > FUNCTION (vabsq, unspec_based_mve_function_exact_insn, (ABS, ABS, ABS, -1, -1, -1, VABSQ_M_S, -1, VABSQ_M_F, -1, -1, -1)) > -FUNCTION (vadciq, vadc_vsbc_impl, (true)) > -FUNCTION (vadcq, vadc_vsbc_impl, (false)) > +FUNCTION (vadciq, vadc_vsbc_impl, (true, true)) > +FUNCTION (vadcq, vadc_vsbc_impl, (false, true)) > FUNCTION_WITH_RTX_M_N (vaddq, PLUS, VADDQ) > FUNCTION_PRED_P_S_U (vaddlvaq, VADDLVAQ) > FUNCTION_PRED_P_S_U (vaddlvq, VADDLVQ) > @@ -1026,6 +1044,8 @@ FUNCTION_WITH_M_N_NO_F (vrshlq, VRSHLQ) > FUNCTION_ONLY_N_NO_F (vrshrnbq, VRSHRNBQ) > FUNCTION_ONLY_N_NO_F (vrshrntq, VRSHRNTQ) > FUNCTION_ONLY_N_NO_F (vrshrq, VRSHRQ) > +FUNCTION (vsbciq, vadc_vsbc_impl, (true, false)) > +FUNCTION (vsbcq, vadc_vsbc_impl, (false, false)) > FUNCTION (vshlcq, vshlc_impl,) > FUNCTION_ONLY_N_NO_F (vshllbq, VSHLLBQ) > FUNCTION_ONLY_N_NO_F (vshlltq, VSHLLTQ) > diff --git a/gcc/config/arm/arm-mve-builtins-base.def b/gcc/config/arm/arm-mve-builtins-base.def > index 37efa6bf13e..b8a8cf2c555 100644 > --- a/gcc/config/arm/arm-mve-builtins-base.def > +++ b/gcc/config/arm/arm-mve-builtins-base.def > @@ -154,6 +154,8 @@ DEF_MVE_FUNCTION (vrshlq, binary_round_lshift, all_integer, mx_or_none) > DEF_MVE_FUNCTION (vrshrnbq, binary_rshift_narrow, integer_16_32, m_or_none) > DEF_MVE_FUNCTION (vrshrntq, binary_rshift_narrow, integer_16_32, m_or_none) > DEF_MVE_FUNCTION (vrshrq, binary_rshift, all_integer, mx_or_none) > +DEF_MVE_FUNCTION (vsbciq, vadc_vsbc, integer_32, m_or_none) > +DEF_MVE_FUNCTION (vsbcq, vadc_vsbc, integer_32, m_or_none) > DEF_MVE_FUNCTION (vshlcq, vshlc, all_integer, m_or_none) > DEF_MVE_FUNCTION (vshllbq, binary_widen_n, integer_8_16, mx_or_none) > DEF_MVE_FUNCTION (vshlltq, binary_widen_n, integer_8_16, mx_or_none) > diff --git a/gcc/config/arm/arm-mve-builtins-base.h b/gcc/config/arm/arm-mve-builtins-base.h > index eb8423c3fe2..da630d48e11 100644 > --- a/gcc/config/arm/arm-mve-builtins-base.h > +++ b/gcc/config/arm/arm-mve-builtins-base.h > @@ -190,6 +190,8 @@ extern const function_base *const vrshlq; > extern const function_base *const vrshrnbq; > extern const function_base *const vrshrntq; > extern const function_base *const vrshrq; > +extern const function_base *const vsbciq; > +extern const function_base *const vsbcq; > extern const function_base *const vshlcq; > extern const function_base *const vshllbq; > extern const function_base *const vshlltq; > diff --git a/gcc/config/arm/arm_mve.h b/gcc/config/arm/arm_mve.h > index dd7b6f5cdab..34f024b29f4 100644 > --- a/gcc/config/arm/arm_mve.h > +++ b/gcc/config/arm/arm_mve.h > @@ -85,10 +85,6 @@ > #define vstrdq_scatter_base_wb_p(__addr, __offset, __value, __p) __arm_vstrdq_scatter_base_wb_p(__addr, __offset, __value, __p) > #define vstrwq_scatter_base_wb_p(__addr, __offset, __value, __p) __arm_vstrwq_scatter_base_wb_p(__addr, __offset, __value, __p) > #define vstrwq_scatter_base_wb(__addr, __offset, __value) __arm_vstrwq_scatter_base_wb(__addr, __offset, __value) > -#define vsbciq(__a, __b, __carry_out) __arm_vsbciq(__a, __b, __carry_out) > -#define vsbciq_m(__inactive, __a, __b, __carry_out, __p) __arm_vsbciq_m(__inactive, __a, __b, __carry_out, __p) > -#define vsbcq(__a, __b, __carry) __arm_vsbcq(__a, __b, __carry) > -#define vsbcq_m(__inactive, __a, __b, __carry, __p) __arm_vsbcq_m(__inactive, __a, __b, __carry, __p) > #define vst1q_p(__addr, __value, __p) __arm_vst1q_p(__addr, __value, __p) > #define vst2q(__addr, __value) __arm_vst2q(__addr, __value) > #define vld1q_z(__base, __p) __arm_vld1q_z(__base, __p) > @@ -317,14 +313,6 @@ > #define vstrwq_scatter_base_wb_s32(__addr, __offset, __value) __arm_vstrwq_scatter_base_wb_s32(__addr, __offset, __value) > #define vstrwq_scatter_base_wb_u32(__addr, __offset, __value) __arm_vstrwq_scatter_base_wb_u32(__addr, __offset, __value) > #define vstrwq_scatter_base_wb_f32(__addr, __offset, __value) __arm_vstrwq_scatter_base_wb_f32(__addr, __offset, __value) > -#define vsbciq_s32(__a, __b, __carry_out) __arm_vsbciq_s32(__a, __b, __carry_out) > -#define vsbciq_u32(__a, __b, __carry_out) __arm_vsbciq_u32(__a, __b, __carry_out) > -#define vsbciq_m_s32(__inactive, __a, __b, __carry_out, __p) __arm_vsbciq_m_s32(__inactive, __a, __b, __carry_out, __p) > -#define vsbciq_m_u32(__inactive, __a, __b, __carry_out, __p) __arm_vsbciq_m_u32(__inactive, __a, __b, __carry_out, __p) > -#define vsbcq_s32(__a, __b, __carry) __arm_vsbcq_s32(__a, __b, __carry) > -#define vsbcq_u32(__a, __b, __carry) __arm_vsbcq_u32(__a, __b, __carry) > -#define vsbcq_m_s32(__inactive, __a, __b, __carry, __p) __arm_vsbcq_m_s32(__inactive, __a, __b, __carry, __p) > -#define vsbcq_m_u32(__inactive, __a, __b, __carry, __p) __arm_vsbcq_m_u32(__inactive, __a, __b, __carry, __p) > #define vst1q_p_u8(__addr, __value, __p) __arm_vst1q_p_u8(__addr, __value, __p) > #define vst1q_p_s8(__addr, __value, __p) __arm_vst1q_p_s8(__addr, __value, __p) > #define vst2q_s8(__addr, __value) __arm_vst2q_s8(__addr, __value) > @@ -1678,82 +1666,6 @@ __arm_vstrwq_scatter_base_wb_u32 (uint32x4_t * __addr, const int __offset, uint3 > *__addr = __builtin_mve_vstrwq_scatter_base_wb_uv4si (*__addr, __offset, __value); > } > > -__extension__ extern __inline int32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbciq_s32 (int32x4_t __a, int32x4_t __b, unsigned * __carry_out) > -{ > - int32x4_t __res = __builtin_mve_vsbciq_sv4si (__a, __b); > - *__carry_out = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > - return __res; > -} > - > -__extension__ extern __inline uint32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbciq_u32 (uint32x4_t __a, uint32x4_t __b, unsigned * __carry_out) > -{ > - uint32x4_t __res = __builtin_mve_vsbciq_uv4si (__a, __b); > - *__carry_out = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > - return __res; > -} > - > -__extension__ extern __inline int32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbciq_m_s32 (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, unsigned * __carry_out, mve_pred16_t __p) > -{ > - int32x4_t __res = __builtin_mve_vsbciq_m_sv4si (__inactive, __a, __b, __p); > - *__carry_out = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > - return __res; > -} > - > -__extension__ extern __inline uint32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbciq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, unsigned * __carry_out, mve_pred16_t __p) > -{ > - uint32x4_t __res = __builtin_mve_vsbciq_m_uv4si (__inactive, __a, __b, __p); > - *__carry_out = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > - return __res; > -} > - > -__extension__ extern __inline int32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbcq_s32 (int32x4_t __a, int32x4_t __b, unsigned * __carry) > -{ > - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); > - int32x4_t __res = __builtin_mve_vsbcq_sv4si (__a, __b); > - *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > - return __res; > -} > - > -__extension__ extern __inline uint32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbcq_u32 (uint32x4_t __a, uint32x4_t __b, unsigned * __carry) > -{ > - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); > - uint32x4_t __res = __builtin_mve_vsbcq_uv4si (__a, __b); > - *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > - return __res; > -} > - > -__extension__ extern __inline int32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbcq_m_s32 (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, unsigned * __carry, mve_pred16_t __p) > -{ > - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); > - int32x4_t __res = __builtin_mve_vsbcq_m_sv4si (__inactive, __a, __b, __p); > - *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > - return __res; > -} > - > -__extension__ extern __inline uint32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbcq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, unsigned * __carry, mve_pred16_t __p) > -{ > - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); > - uint32x4_t __res = __builtin_mve_vsbcq_m_uv4si (__inactive, __a, __b, __p); > - *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; > - return __res; > -} > - > __extension__ extern __inline void > __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > __arm_vst1q_p_u8 (uint8_t * __addr, uint8x16_t __value, mve_pred16_t __p) > @@ -3554,62 +3466,6 @@ __arm_vstrwq_scatter_base_wb (uint32x4_t * __addr, const int __offset, uint32x4_ > __arm_vstrwq_scatter_base_wb_u32 (__addr, __offset, __value); > } > > -__extension__ extern __inline int32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbciq (int32x4_t __a, int32x4_t __b, unsigned * __carry_out) > -{ > - return __arm_vsbciq_s32 (__a, __b, __carry_out); > -} > - > -__extension__ extern __inline uint32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbciq (uint32x4_t __a, uint32x4_t __b, unsigned * __carry_out) > -{ > - return __arm_vsbciq_u32 (__a, __b, __carry_out); > -} > - > -__extension__ extern __inline int32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbciq_m (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, unsigned * __carry_out, mve_pred16_t __p) > -{ > - return __arm_vsbciq_m_s32 (__inactive, __a, __b, __carry_out, __p); > -} > - > -__extension__ extern __inline uint32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbciq_m (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, unsigned * __carry_out, mve_pred16_t __p) > -{ > - return __arm_vsbciq_m_u32 (__inactive, __a, __b, __carry_out, __p); > -} > - > -__extension__ extern __inline int32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbcq (int32x4_t __a, int32x4_t __b, unsigned * __carry) > -{ > - return __arm_vsbcq_s32 (__a, __b, __carry); > -} > - > -__extension__ extern __inline uint32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbcq (uint32x4_t __a, uint32x4_t __b, unsigned * __carry) > -{ > - return __arm_vsbcq_u32 (__a, __b, __carry); > -} > - > -__extension__ extern __inline int32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbcq_m (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, unsigned * __carry, mve_pred16_t __p) > -{ > - return __arm_vsbcq_m_s32 (__inactive, __a, __b, __carry, __p); > -} > - > -__extension__ extern __inline uint32x4_t > -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > -__arm_vsbcq_m (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, unsigned * __carry, mve_pred16_t __p) > -{ > - return __arm_vsbcq_m_u32 (__inactive, __a, __b, __carry, __p); > -} > - > __extension__ extern __inline void > __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) > __arm_vst1q_p (uint8_t * __addr, uint8x16_t __value, mve_pred16_t __p) > @@ -5171,32 +5027,6 @@ extern void *__ARM_undef; > int (*)[__ARM_mve_type_int64_t_ptr]: __arm_vldrdq_gather_shifted_offset_z_s64 (__ARM_mve_coerce_s64_ptr(p0, int64_t *), p1, p2), \ > int (*)[__ARM_mve_type_uint64_t_ptr]: __arm_vldrdq_gather_shifted_offset_z_u64 (__ARM_mve_coerce_u64_ptr(p0, uint64_t *), p1, p2))) > > -#define __arm_vsbciq_m(p0,p1,p2,p3,p4) ({ __typeof(p0) __p0 = (p0); \ > - __typeof(p1) __p1 = (p1); \ > - __typeof(p2) __p2 = (p2); \ > - _Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \ > - int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vsbciq_m_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32x4_t), p3, p4), \ > - int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t]: __arm_vsbciq_m_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32x4_t), p3, p4));}) > - > -#define __arm_vsbciq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \ > - __typeof(p1) __p1 = (p1); \ > - _Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \ > - int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vsbciq_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), p2), \ > - int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t]: __arm_vsbciq_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), p2));}) > - > -#define __arm_vsbcq_m(p0,p1,p2,p3,p4) ({ __typeof(p0) __p0 = (p0); \ > - __typeof(p1) __p1 = (p1); \ > - __typeof(p2) __p2 = (p2); \ > - _Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \ > - int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vsbcq_m_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32x4_t), p3, p4), \ > - int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t]: __arm_vsbcq_m_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32x4_t), p3, p4));}) > - > -#define __arm_vsbcq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \ > - __typeof(p1) __p1 = (p1); \ > - _Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \ > - int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vsbcq_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), p2), \ > - int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t]: __arm_vsbcq_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), p2));}) > - > #define __arm_vldrbq_gather_offset_z(p0,p1,p2) ({ __typeof(p1) __p1 = (p1); \ > _Generic( (int (*)[__ARM_mve_typeid(p0)][__ARM_mve_typeid(__p1)])0, \ > int (*)[__ARM_mve_type_int8_t_ptr][__ARM_mve_type_uint8x16_t]: __arm_vldrbq_gather_offset_z_s8 (__ARM_mve_coerce_s8_ptr(p0, int8_t *), __ARM_mve_coerce(__p1, uint8x16_t), p2), \
diff --git a/gcc/config/arm/arm-mve-builtins-base.cc b/gcc/config/arm/arm-mve-builtins-base.cc index 9c2e11356ef..02fccdcb71f 100644 --- a/gcc/config/arm/arm-mve-builtins-base.cc +++ b/gcc/config/arm/arm-mve-builtins-base.cc @@ -559,12 +559,14 @@ public: class vadc_vsbc_impl : public function_base { public: - CONSTEXPR vadc_vsbc_impl (bool init_carry) - : m_init_carry (init_carry) + CONSTEXPR vadc_vsbc_impl (bool init_carry, bool add) + : m_init_carry (init_carry), m_add (add) {} /* Initialize carry with 0 (vadci). */ bool m_init_carry; + /* Add (true) or Sub (false). */ + bool m_add; unsigned int call_properties (const function_instance &) const override @@ -647,26 +649,42 @@ public: { case PRED_none: /* No predicate. */ - unspec = m_init_carry - ? (e.type_suffix (0).unsigned_p - ? VADCIQ_U - : VADCIQ_S) - : (e.type_suffix (0).unsigned_p - ? VADCQ_U - : VADCQ_S); + unspec = m_add + ? (m_init_carry + ? (e.type_suffix (0).unsigned_p + ? VADCIQ_U + : VADCIQ_S) + : (e.type_suffix (0).unsigned_p + ? VADCQ_U + : VADCQ_S)) + : (m_init_carry + ? (e.type_suffix (0).unsigned_p + ? VSBCIQ_U + : VSBCIQ_S) + : (e.type_suffix (0).unsigned_p + ? VSBCQ_U + : VSBCQ_S)); code = code_for_mve_q_v4si (unspec, unspec); insns = e.use_exact_insn (code); break; case PRED_m: /* "m" predicate. */ - unspec = m_init_carry - ? (e.type_suffix (0).unsigned_p - ? VADCIQ_M_U - : VADCIQ_M_S) - : (e.type_suffix (0).unsigned_p - ? VADCQ_M_U - : VADCQ_M_S); + unspec = m_add + ? (m_init_carry + ? (e.type_suffix (0).unsigned_p + ? VADCIQ_M_U + : VADCIQ_M_S) + : (e.type_suffix (0).unsigned_p + ? VADCQ_M_U + : VADCQ_M_S)) + : (m_init_carry + ? (e.type_suffix (0).unsigned_p + ? VSBCIQ_M_U + : VSBCIQ_M_S) + : (e.type_suffix (0).unsigned_p + ? VSBCQ_M_U + : VSBCQ_M_S)); code = code_for_mve_q_m_v4si (unspec, unspec); insns = e.use_cond_insn (code, 0); break; @@ -862,8 +880,8 @@ namespace arm_mve { FUNCTION_PRED_P_S_U (vabavq, VABAVQ) FUNCTION_WITHOUT_N (vabdq, VABDQ) FUNCTION (vabsq, unspec_based_mve_function_exact_insn, (ABS, ABS, ABS, -1, -1, -1, VABSQ_M_S, -1, VABSQ_M_F, -1, -1, -1)) -FUNCTION (vadciq, vadc_vsbc_impl, (true)) -FUNCTION (vadcq, vadc_vsbc_impl, (false)) +FUNCTION (vadciq, vadc_vsbc_impl, (true, true)) +FUNCTION (vadcq, vadc_vsbc_impl, (false, true)) FUNCTION_WITH_RTX_M_N (vaddq, PLUS, VADDQ) FUNCTION_PRED_P_S_U (vaddlvaq, VADDLVAQ) FUNCTION_PRED_P_S_U (vaddlvq, VADDLVQ) @@ -1026,6 +1044,8 @@ FUNCTION_WITH_M_N_NO_F (vrshlq, VRSHLQ) FUNCTION_ONLY_N_NO_F (vrshrnbq, VRSHRNBQ) FUNCTION_ONLY_N_NO_F (vrshrntq, VRSHRNTQ) FUNCTION_ONLY_N_NO_F (vrshrq, VRSHRQ) +FUNCTION (vsbciq, vadc_vsbc_impl, (true, false)) +FUNCTION (vsbcq, vadc_vsbc_impl, (false, false)) FUNCTION (vshlcq, vshlc_impl,) FUNCTION_ONLY_N_NO_F (vshllbq, VSHLLBQ) FUNCTION_ONLY_N_NO_F (vshlltq, VSHLLTQ) diff --git a/gcc/config/arm/arm-mve-builtins-base.def b/gcc/config/arm/arm-mve-builtins-base.def index 37efa6bf13e..b8a8cf2c555 100644 --- a/gcc/config/arm/arm-mve-builtins-base.def +++ b/gcc/config/arm/arm-mve-builtins-base.def @@ -154,6 +154,8 @@ DEF_MVE_FUNCTION (vrshlq, binary_round_lshift, all_integer, mx_or_none) DEF_MVE_FUNCTION (vrshrnbq, binary_rshift_narrow, integer_16_32, m_or_none) DEF_MVE_FUNCTION (vrshrntq, binary_rshift_narrow, integer_16_32, m_or_none) DEF_MVE_FUNCTION (vrshrq, binary_rshift, all_integer, mx_or_none) +DEF_MVE_FUNCTION (vsbciq, vadc_vsbc, integer_32, m_or_none) +DEF_MVE_FUNCTION (vsbcq, vadc_vsbc, integer_32, m_or_none) DEF_MVE_FUNCTION (vshlcq, vshlc, all_integer, m_or_none) DEF_MVE_FUNCTION (vshllbq, binary_widen_n, integer_8_16, mx_or_none) DEF_MVE_FUNCTION (vshlltq, binary_widen_n, integer_8_16, mx_or_none) diff --git a/gcc/config/arm/arm-mve-builtins-base.h b/gcc/config/arm/arm-mve-builtins-base.h index eb8423c3fe2..da630d48e11 100644 --- a/gcc/config/arm/arm-mve-builtins-base.h +++ b/gcc/config/arm/arm-mve-builtins-base.h @@ -190,6 +190,8 @@ extern const function_base *const vrshlq; extern const function_base *const vrshrnbq; extern const function_base *const vrshrntq; extern const function_base *const vrshrq; +extern const function_base *const vsbciq; +extern const function_base *const vsbcq; extern const function_base *const vshlcq; extern const function_base *const vshllbq; extern const function_base *const vshlltq; diff --git a/gcc/config/arm/arm_mve.h b/gcc/config/arm/arm_mve.h index dd7b6f5cdab..34f024b29f4 100644 --- a/gcc/config/arm/arm_mve.h +++ b/gcc/config/arm/arm_mve.h @@ -85,10 +85,6 @@ #define vstrdq_scatter_base_wb_p(__addr, __offset, __value, __p) __arm_vstrdq_scatter_base_wb_p(__addr, __offset, __value, __p) #define vstrwq_scatter_base_wb_p(__addr, __offset, __value, __p) __arm_vstrwq_scatter_base_wb_p(__addr, __offset, __value, __p) #define vstrwq_scatter_base_wb(__addr, __offset, __value) __arm_vstrwq_scatter_base_wb(__addr, __offset, __value) -#define vsbciq(__a, __b, __carry_out) __arm_vsbciq(__a, __b, __carry_out) -#define vsbciq_m(__inactive, __a, __b, __carry_out, __p) __arm_vsbciq_m(__inactive, __a, __b, __carry_out, __p) -#define vsbcq(__a, __b, __carry) __arm_vsbcq(__a, __b, __carry) -#define vsbcq_m(__inactive, __a, __b, __carry, __p) __arm_vsbcq_m(__inactive, __a, __b, __carry, __p) #define vst1q_p(__addr, __value, __p) __arm_vst1q_p(__addr, __value, __p) #define vst2q(__addr, __value) __arm_vst2q(__addr, __value) #define vld1q_z(__base, __p) __arm_vld1q_z(__base, __p) @@ -317,14 +313,6 @@ #define vstrwq_scatter_base_wb_s32(__addr, __offset, __value) __arm_vstrwq_scatter_base_wb_s32(__addr, __offset, __value) #define vstrwq_scatter_base_wb_u32(__addr, __offset, __value) __arm_vstrwq_scatter_base_wb_u32(__addr, __offset, __value) #define vstrwq_scatter_base_wb_f32(__addr, __offset, __value) __arm_vstrwq_scatter_base_wb_f32(__addr, __offset, __value) -#define vsbciq_s32(__a, __b, __carry_out) __arm_vsbciq_s32(__a, __b, __carry_out) -#define vsbciq_u32(__a, __b, __carry_out) __arm_vsbciq_u32(__a, __b, __carry_out) -#define vsbciq_m_s32(__inactive, __a, __b, __carry_out, __p) __arm_vsbciq_m_s32(__inactive, __a, __b, __carry_out, __p) -#define vsbciq_m_u32(__inactive, __a, __b, __carry_out, __p) __arm_vsbciq_m_u32(__inactive, __a, __b, __carry_out, __p) -#define vsbcq_s32(__a, __b, __carry) __arm_vsbcq_s32(__a, __b, __carry) -#define vsbcq_u32(__a, __b, __carry) __arm_vsbcq_u32(__a, __b, __carry) -#define vsbcq_m_s32(__inactive, __a, __b, __carry, __p) __arm_vsbcq_m_s32(__inactive, __a, __b, __carry, __p) -#define vsbcq_m_u32(__inactive, __a, __b, __carry, __p) __arm_vsbcq_m_u32(__inactive, __a, __b, __carry, __p) #define vst1q_p_u8(__addr, __value, __p) __arm_vst1q_p_u8(__addr, __value, __p) #define vst1q_p_s8(__addr, __value, __p) __arm_vst1q_p_s8(__addr, __value, __p) #define vst2q_s8(__addr, __value) __arm_vst2q_s8(__addr, __value) @@ -1678,82 +1666,6 @@ __arm_vstrwq_scatter_base_wb_u32 (uint32x4_t * __addr, const int __offset, uint3 *__addr = __builtin_mve_vstrwq_scatter_base_wb_uv4si (*__addr, __offset, __value); } -__extension__ extern __inline int32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbciq_s32 (int32x4_t __a, int32x4_t __b, unsigned * __carry_out) -{ - int32x4_t __res = __builtin_mve_vsbciq_sv4si (__a, __b); - *__carry_out = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; - return __res; -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbciq_u32 (uint32x4_t __a, uint32x4_t __b, unsigned * __carry_out) -{ - uint32x4_t __res = __builtin_mve_vsbciq_uv4si (__a, __b); - *__carry_out = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; - return __res; -} - -__extension__ extern __inline int32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbciq_m_s32 (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, unsigned * __carry_out, mve_pred16_t __p) -{ - int32x4_t __res = __builtin_mve_vsbciq_m_sv4si (__inactive, __a, __b, __p); - *__carry_out = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; - return __res; -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbciq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, unsigned * __carry_out, mve_pred16_t __p) -{ - uint32x4_t __res = __builtin_mve_vsbciq_m_uv4si (__inactive, __a, __b, __p); - *__carry_out = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; - return __res; -} - -__extension__ extern __inline int32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbcq_s32 (int32x4_t __a, int32x4_t __b, unsigned * __carry) -{ - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); - int32x4_t __res = __builtin_mve_vsbcq_sv4si (__a, __b); - *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; - return __res; -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbcq_u32 (uint32x4_t __a, uint32x4_t __b, unsigned * __carry) -{ - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); - uint32x4_t __res = __builtin_mve_vsbcq_uv4si (__a, __b); - *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; - return __res; -} - -__extension__ extern __inline int32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbcq_m_s32 (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, unsigned * __carry, mve_pred16_t __p) -{ - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); - int32x4_t __res = __builtin_mve_vsbcq_m_sv4si (__inactive, __a, __b, __p); - *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; - return __res; -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbcq_m_u32 (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, unsigned * __carry, mve_pred16_t __p) -{ - __builtin_arm_set_fpscr_nzcvqc((__builtin_arm_get_fpscr_nzcvqc () & ~0x20000000u) | ((*__carry & 0x1u) << 29)); - uint32x4_t __res = __builtin_mve_vsbcq_m_uv4si (__inactive, __a, __b, __p); - *__carry = (__builtin_arm_get_fpscr_nzcvqc () >> 29) & 0x1u; - return __res; -} - __extension__ extern __inline void __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vst1q_p_u8 (uint8_t * __addr, uint8x16_t __value, mve_pred16_t __p) @@ -3554,62 +3466,6 @@ __arm_vstrwq_scatter_base_wb (uint32x4_t * __addr, const int __offset, uint32x4_ __arm_vstrwq_scatter_base_wb_u32 (__addr, __offset, __value); } -__extension__ extern __inline int32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbciq (int32x4_t __a, int32x4_t __b, unsigned * __carry_out) -{ - return __arm_vsbciq_s32 (__a, __b, __carry_out); -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbciq (uint32x4_t __a, uint32x4_t __b, unsigned * __carry_out) -{ - return __arm_vsbciq_u32 (__a, __b, __carry_out); -} - -__extension__ extern __inline int32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbciq_m (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, unsigned * __carry_out, mve_pred16_t __p) -{ - return __arm_vsbciq_m_s32 (__inactive, __a, __b, __carry_out, __p); -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbciq_m (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, unsigned * __carry_out, mve_pred16_t __p) -{ - return __arm_vsbciq_m_u32 (__inactive, __a, __b, __carry_out, __p); -} - -__extension__ extern __inline int32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbcq (int32x4_t __a, int32x4_t __b, unsigned * __carry) -{ - return __arm_vsbcq_s32 (__a, __b, __carry); -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbcq (uint32x4_t __a, uint32x4_t __b, unsigned * __carry) -{ - return __arm_vsbcq_u32 (__a, __b, __carry); -} - -__extension__ extern __inline int32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbcq_m (int32x4_t __inactive, int32x4_t __a, int32x4_t __b, unsigned * __carry, mve_pred16_t __p) -{ - return __arm_vsbcq_m_s32 (__inactive, __a, __b, __carry, __p); -} - -__extension__ extern __inline uint32x4_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vsbcq_m (uint32x4_t __inactive, uint32x4_t __a, uint32x4_t __b, unsigned * __carry, mve_pred16_t __p) -{ - return __arm_vsbcq_m_u32 (__inactive, __a, __b, __carry, __p); -} - __extension__ extern __inline void __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vst1q_p (uint8_t * __addr, uint8x16_t __value, mve_pred16_t __p) @@ -5171,32 +5027,6 @@ extern void *__ARM_undef; int (*)[__ARM_mve_type_int64_t_ptr]: __arm_vldrdq_gather_shifted_offset_z_s64 (__ARM_mve_coerce_s64_ptr(p0, int64_t *), p1, p2), \ int (*)[__ARM_mve_type_uint64_t_ptr]: __arm_vldrdq_gather_shifted_offset_z_u64 (__ARM_mve_coerce_u64_ptr(p0, uint64_t *), p1, p2))) -#define __arm_vsbciq_m(p0,p1,p2,p3,p4) ({ __typeof(p0) __p0 = (p0); \ - __typeof(p1) __p1 = (p1); \ - __typeof(p2) __p2 = (p2); \ - _Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \ - int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vsbciq_m_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32x4_t), p3, p4), \ - int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t]: __arm_vsbciq_m_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32x4_t), p3, p4));}) - -#define __arm_vsbciq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \ - __typeof(p1) __p1 = (p1); \ - _Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \ - int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vsbciq_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), p2), \ - int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t]: __arm_vsbciq_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), p2));}) - -#define __arm_vsbcq_m(p0,p1,p2,p3,p4) ({ __typeof(p0) __p0 = (p0); \ - __typeof(p1) __p1 = (p1); \ - __typeof(p2) __p2 = (p2); \ - _Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)][__ARM_mve_typeid(__p2)])0, \ - int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vsbcq_m_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), __ARM_mve_coerce(__p2, int32x4_t), p3, p4), \ - int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t]: __arm_vsbcq_m_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), __ARM_mve_coerce(__p2, uint32x4_t), p3, p4));}) - -#define __arm_vsbcq(p0,p1,p2) ({ __typeof(p0) __p0 = (p0); \ - __typeof(p1) __p1 = (p1); \ - _Generic( (int (*)[__ARM_mve_typeid(__p0)][__ARM_mve_typeid(__p1)])0, \ - int (*)[__ARM_mve_type_int32x4_t][__ARM_mve_type_int32x4_t]: __arm_vsbcq_s32 (__ARM_mve_coerce(__p0, int32x4_t), __ARM_mve_coerce(__p1, int32x4_t), p2), \ - int (*)[__ARM_mve_type_uint32x4_t][__ARM_mve_type_uint32x4_t]: __arm_vsbcq_u32 (__ARM_mve_coerce(__p0, uint32x4_t), __ARM_mve_coerce(__p1, uint32x4_t), p2));}) - #define __arm_vldrbq_gather_offset_z(p0,p1,p2) ({ __typeof(p1) __p1 = (p1); \ _Generic( (int (*)[__ARM_mve_typeid(p0)][__ARM_mve_typeid(__p1)])0, \ int (*)[__ARM_mve_type_int8_t_ptr][__ARM_mve_type_uint8x16_t]: __arm_vldrbq_gather_offset_z_s8 (__ARM_mve_coerce_s8_ptr(p0, int8_t *), __ARM_mve_coerce(__p1, uint8x16_t), p2), \