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   | 19 +++++++++++++++++++
 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, 37 insertions(+), 8 deletions(-)

diff --git a/gcc/config/arm/arm-mve-builtins-base.cc 
b/gcc/config/arm/arm-mve-builtins-base.cc
index f894f163d2e..c6386a56406 100644
--- a/gcc/config/arm/arm-mve-builtins-base.cc
+++ b/gcc/config/arm/arm-mve-builtins-base.cc
@@ -1224,6 +1224,24 @@ 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 {
@@ -1511,6 +1529,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 51a708957e5..e5a295265f6 100644
--- a/gcc/config/arm/arm-mve-builtins-base.def
+++ b/gcc/config/arm/arm-mve-builtins-base.def
@@ -114,6 +114,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 da5ad0c8aaa..285cb0c6957 100644
--- a/gcc/config/arm/arm-mve-builtins-base.h
+++ b/gcc/config/arm/arm-mve-builtins-base.h
@@ -145,6 +145,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 4b8cc244448..03f70f8ba16 100644
--- a/gcc/config/arm/arm-mve-builtins-shapes.cc
+++ b/gcc/config/arm/arm-mve-builtins-shapes.cc
@@ -2792,6 +2792,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 9b1d32a0056..4763eeeda32 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 7fc1cc3173f..9947420dcdb 100644
--- a/gcc/config/arm/arm_mve.h
+++ b/gcc/config/arm/arm_mve.h
@@ -48,7 +48,6 @@
 #define vuninitializedq(__v) __arm_vuninitializedq(__v)
 
 
-#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)
@@ -77,13 +76,6 @@
 #define asrl(__p0, __p1) __arm_asrl(__p0, __p1)
 #endif
 
-__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  uint64_t
 __attribute__ ((__always_inline__, __gnu_inline__, __artificial__))
 __arm_lsll (uint64_t value, int32_t shift)
-- 
2.34.1

Reply via email to