]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: [MVE intrinsics] rework vpnot
authorChristophe Lyon <christophe.lyon@linaro.org>
Wed, 20 Aug 2025 16:04:06 +0000 (16:04 +0000)
committerChristophe Lyon <christophe.lyon@linaro.org>
Fri, 14 Nov 2025 20:55:28 +0000 (20:55 +0000)
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.

gcc/config/arm/arm-mve-builtins-base.cc
gcc/config/arm/arm-mve-builtins-base.def
gcc/config/arm/arm-mve-builtins-base.h
gcc/config/arm/arm-mve-builtins-shapes.cc
gcc/config/arm/arm-mve-builtins-shapes.h
gcc/config/arm/arm_mve.h

index 4e0055ec4d4c4112609dd2532657eaee8535198e..60fc2f364d6680ef7ae2014ce48206ddfa130c5f 100644 (file)
@@ -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)
index 5992ddb504916b6f2a4f9b0f353892991ffe40fb..6fb584b3d8581b37485b40abb0b7b5c474b425ac 100644 (file)
@@ -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)
index 54d3dd7cd041c78efda4177a825662236c0324ca..22dcd93992d8a440f6271c580c534eb49026940f 100644 (file)
@@ -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;
index f85b82af358afe6705e63340d2b403ff2dce2b1a..02458c75755d406357f1683e8c36b786e064364f 100644 (file)
@@ -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
index f1838e6da423812fa273eea0fc02710908b43b97..89ef75c54436d0af7494664a0bab1393ab4782ba 100644 (file)
@@ -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;
 
index 50b3a52d34d0625e9dfbde0d3f2e3c7b79f5f2bc..32193f6edfdd7d222bbfa830e3f7e64a570e5951 100644 (file)
@@ -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)
   __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)