https://gcc.gnu.org/g:e0b23a99afac13b82958a39fa862c7d6a6da4510
commit r16-5285-ge0b23a99afac13b82958a39fa862c7d6a6da4510 Author: Christophe Lyon <[email protected]> Date: Wed Aug 20 16:04:06 2025 +0000 arm: [MVE intrinsics] rework vpnot Implement vpnot using the new MVE builtins framework. gcc/ChangeLog: * config/arm/arm-mve-builtins-base.cc (class mve_function_vpnot): New. (vpnot): New. * config/arm/arm-mve-builtins-base.def (vpnot): New. * config/arm/arm-mve-builtins-base.h (vpnot): New. * config/arm/arm-mve-builtins-shapes.cc (struct vpnot): New. * config/arm/arm-mve-builtins-shapes.h (vpnot): New. * config/arm/arm_mve.h (vpnot): Delete. (__arm_vpnot): Delete. Diff: --- gcc/config/arm/arm-mve-builtins-base.cc | 20 ++++++++++++++++++++ gcc/config/arm/arm-mve-builtins-base.def | 1 + gcc/config/arm/arm-mve-builtins-base.h | 1 + gcc/config/arm/arm-mve-builtins-shapes.cc | 15 +++++++++++++++ gcc/config/arm/arm-mve-builtins-shapes.h | 1 + gcc/config/arm/arm_mve.h | 8 -------- 6 files changed, 38 insertions(+), 8 deletions(-) diff --git a/gcc/config/arm/arm-mve-builtins-base.cc b/gcc/config/arm/arm-mve-builtins-base.cc index 4e0055ec4d4c..60fc2f364d66 100644 --- a/gcc/config/arm/arm-mve-builtins-base.cc +++ b/gcc/config/arm/arm-mve-builtins-base.cc @@ -1209,6 +1209,25 @@ public: } }; + +/* Map the function directly to mve_vpnotv16bi, and convert the result into + HImode like we do for vcmp. */ +class mve_function_vpnot : public function_base +{ +public: + CONSTEXPR mve_function_vpnot (void) + {} + + rtx + expand (function_expander &e) const override + { + rtx target = e.use_unpred_insn (CODE_FOR_mve_vpnotv16bi); + rtx HItarget = gen_reg_rtx (HImode); + emit_move_insn (HItarget, gen_lowpart (HImode, target)); + return HItarget; + } +}; + } /* end anonymous namespace */ namespace arm_mve { @@ -1497,6 +1516,7 @@ FUNCTION (vmulltq_poly, unspec_mve_function_exact_insn_vmull_poly, (VMULLTQ_POLY FUNCTION_WITH_RTX_M_N (vmulq, MULT, VMULQ) FUNCTION_WITH_RTX_M_N_NO_F (vmvnq, NOT, VMVNQ) FUNCTION (vnegq, unspec_based_mve_function_exact_insn, (NEG, NEG, NEG, -1, -1, -1, VNEGQ_M_S, -1, VNEGQ_M_F, -1, -1, -1)) +FUNCTION (vpnot, mve_function_vpnot, ) FUNCTION_WITHOUT_M_N (vpselq, VPSELQ) FUNCTION (vornq, unspec_based_mve_function_exact_insn_vorn, (-1, -1, VORNQ_M_S, VORNQ_M_U, VORNQ_M_F, -1, -1)) FUNCTION_WITH_RTX_M_N_NO_N_F (vorrq, IOR, VORRQ) diff --git a/gcc/config/arm/arm-mve-builtins-base.def b/gcc/config/arm/arm-mve-builtins-base.def index 5992ddb50491..6fb584b3d858 100644 --- a/gcc/config/arm/arm-mve-builtins-base.def +++ b/gcc/config/arm/arm-mve-builtins-base.def @@ -115,6 +115,7 @@ DEF_MVE_FUNCTION (vmvnq, mvn, all_integer, mx_or_none) DEF_MVE_FUNCTION (vnegq, unary, all_signed, mx_or_none) DEF_MVE_FUNCTION (vornq, binary_orrq, all_integer, mx_or_none) DEF_MVE_FUNCTION (vorrq, binary_orrq, all_integer, mx_or_none) +DEF_MVE_FUNCTION (vpnot, vpnot, none, none) DEF_MVE_FUNCTION (vpselq, vpsel, all_integer_with_64, none) DEF_MVE_FUNCTION (vqabsq, unary, all_signed, m_or_none) DEF_MVE_FUNCTION (vqaddq, binary_opt_n, all_integer, m_or_none) diff --git a/gcc/config/arm/arm-mve-builtins-base.h b/gcc/config/arm/arm-mve-builtins-base.h index 54d3dd7cd041..22dcd93992d8 100644 --- a/gcc/config/arm/arm-mve-builtins-base.h +++ b/gcc/config/arm/arm-mve-builtins-base.h @@ -146,6 +146,7 @@ extern const function_base *const vmvnq; extern const function_base *const vnegq; extern const function_base *const vornq; extern const function_base *const vorrq; +extern const function_base *const vpnot; extern const function_base *const vpselq; extern const function_base *const vqabsq; extern const function_base *const vqaddq; diff --git a/gcc/config/arm/arm-mve-builtins-shapes.cc b/gcc/config/arm/arm-mve-builtins-shapes.cc index f85b82af358a..02458c75755d 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.cc +++ b/gcc/config/arm/arm-mve-builtins-shapes.cc @@ -2740,6 +2740,21 @@ struct vidwdup_def : public overloaded_base<0> }; SHAPE (vidwdup) +/* mve_pred16_t foo_t0(mve_pred16_t) + + Example: vpnot. + mve_pred16_t [__arm_]vpnot(mve_pred16_t a) */ +struct vpnot_def : public nonoverloaded_base +{ + void + build (function_builder &b, const function_group_info &group, + bool preserve_user_namespace) const override + { + build_all (b, "p,p", group, MODE_none, preserve_user_namespace); + } +}; +SHAPE (vpnot) + /* <T0>_t vfoo[_t0](<T0>_t, <T0>_t, mve_pred16_t) i.e. a version of the standard ternary shape in which diff --git a/gcc/config/arm/arm-mve-builtins-shapes.h b/gcc/config/arm/arm-mve-builtins-shapes.h index f1838e6da423..89ef75c54436 100644 --- a/gcc/config/arm/arm-mve-builtins-shapes.h +++ b/gcc/config/arm/arm-mve-builtins-shapes.h @@ -92,6 +92,7 @@ namespace arm_mve extern const function_shape *const vcvtx; extern const function_shape *const viddup; extern const function_shape *const vidwdup; + extern const function_shape *const vpnot; extern const function_shape *const vpsel; extern const function_shape *const vshlc; diff --git a/gcc/config/arm/arm_mve.h b/gcc/config/arm/arm_mve.h index 50b3a52d34d0..32193f6edfdd 100644 --- a/gcc/config/arm/arm_mve.h +++ b/gcc/config/arm/arm_mve.h @@ -50,7 +50,6 @@ #define vgetq_lane(__a, __idx) __arm_vgetq_lane(__a, __idx) -#define vpnot(__a) __arm_vpnot(__a) #define vuninitializedq_u8(void) __arm_vuninitializedq_u8(void) #define vuninitializedq_u16(void) __arm_vuninitializedq_u16(void) #define vuninitializedq_u32(void) __arm_vuninitializedq_u32(void) @@ -109,13 +108,6 @@ __builtin_arm_lane_check (__ARM_NUM_LANES(__vec), \ __ARM_LANEQ(__vec, __idx)) -__extension__ extern __inline mve_pred16_t -__attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) -__arm_vpnot (mve_pred16_t __a) -{ - return __builtin_mve_vpnotv16bi (__a); -} - __extension__ extern __inline int16x8_t __attribute__ ((__always_inline__, __gnu_inline__, __artificial__)) __arm_vsetq_lane_s16 (int16_t __a, int16x8_t __b, const int __idx)
