This patch continues the work of making ACLE intrinsics use VNx16BI
for svbool_t results.  It deals with the non-widening integer forms
of svcmp*.  The handling of the PTEST patterns is similar to that
for the earlier svwhile* patch.

Unfortunately, on its own, this triggers a failure in the
pred_clobber_*.c tests.  The problem is that, after the patch,
we have a comparison instruction followed by a move into p0.
Combine combines the instructions together, so that the destination
of the comparison is the hard register p0 rather than a pseudo.
This defeats IRA's make_early_clobber_and_input_conflicts, which
requires the source and destination to be pseudo registers.

Before the patch, there was a subreg move between the comparison
and the move into p0, so it was that subreg move that ended up
with a hard register destination.

Arguably the fix for PR87600 should be extended to destination
registers as well as source registers, but in the meantime,
the patch just disables combine for these tests.  The tests are
really testing the constraints and register allocation.

gcc/
        * config/aarch64/aarch64-sve.md (@aarch64_pred_cmp<cmp_op><mode>_acle)
        (*aarch64_pred_cmp<cmp_op><mode>_acle, *cmp<cmp_op><mode>_acle_cc)
        (*cmp<cmp_op><mode>_acle_and): New patterns that yield VNx16BI
        results for all element types.
        * config/aarch64/aarch64-sve-builtins-base.cc
        (svcmp_impl::expand): Use them.
        (svcmp_wide_impl::expand): Likewise when implementing an svcmp_wide
        against an in-range constant.

gcc/testsuite/
        * gcc.target/aarch64/sve/pred_clobber_1.c: Disable combine.
        * gcc.target/aarch64/sve/pred_clobber_2.c: Likewise.
        * gcc.target/aarch64/sve/pred_clobber_3.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmpeq_2.c: Add more cases.
        * gcc.target/aarch64/sve/acle/general/cmpeq_4.c: New test.
        * gcc.target/aarch64/sve/acle/general/cmpge_1.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmpge_2.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmpge_3.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmpge_4.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmpgt_1.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmpgt_2.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmpgt_3.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmpgt_4.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmple_1.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmple_2.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmple_3.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmple_4.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmplt_1.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmplt_2.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmplt_3.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmplt_4.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmpne_1.c: Likewise.
        * gcc.target/aarch64/sve/acle/general/cmpne_2.c: Likewise.
---
 .../aarch64/aarch64-sve-builtins-base.cc      |   4 +-
 gcc/config/aarch64/aarch64-sve.md             | 146 +++++++++++++++
 .../aarch64/sve/acle/general/cmpeq_2.c        | 106 ++++++++++-
 .../aarch64/sve/acle/general/cmpeq_4.c        | 157 ++++++++++++++++
 .../aarch64/sve/acle/general/cmpge_1.c        | 140 +++++++++++++++
 .../aarch64/sve/acle/general/cmpge_2.c        | 140 +++++++++++++++
 .../aarch64/sve/acle/general/cmpge_3.c        | 169 ++++++++++++++++++
 .../aarch64/sve/acle/general/cmpge_4.c        | 169 ++++++++++++++++++
 .../aarch64/sve/acle/general/cmpgt_1.c        | 140 +++++++++++++++
 .../aarch64/sve/acle/general/cmpgt_2.c        | 140 +++++++++++++++
 .../aarch64/sve/acle/general/cmpgt_3.c        | 157 ++++++++++++++++
 .../aarch64/sve/acle/general/cmpgt_4.c        | 157 ++++++++++++++++
 .../aarch64/sve/acle/general/cmple_1.c        | 140 +++++++++++++++
 .../aarch64/sve/acle/general/cmple_2.c        | 140 +++++++++++++++
 .../aarch64/sve/acle/general/cmple_3.c        | 157 ++++++++++++++++
 .../aarch64/sve/acle/general/cmple_4.c        | 157 ++++++++++++++++
 .../aarch64/sve/acle/general/cmplt_1.c        | 140 +++++++++++++++
 .../aarch64/sve/acle/general/cmplt_2.c        | 140 +++++++++++++++
 .../aarch64/sve/acle/general/cmplt_3.c        | 169 ++++++++++++++++++
 .../aarch64/sve/acle/general/cmplt_4.c        | 169 ++++++++++++++++++
 .../aarch64/sve/acle/general/cmpne_1.c        | 140 +++++++++++++++
 .../aarch64/sve/acle/general/cmpne_2.c        | 157 ++++++++++++++++
 .../gcc.target/aarch64/sve/pred_clobber_1.c   |   2 +-
 .../gcc.target/aarch64/sve/pred_clobber_2.c   |   2 +-
 .../gcc.target/aarch64/sve/pred_clobber_3.c   |   2 +-
 25 files changed, 3133 insertions(+), 7 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpeq_4.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_1.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_2.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_3.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_4.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_1.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_2.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_3.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_4.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_1.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_2.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_3.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_4.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_1.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_2.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_3.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_4.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpne_1.c
 create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpne_2.c

diff --git a/gcc/config/aarch64/aarch64-sve-builtins-base.cc 
b/gcc/config/aarch64/aarch64-sve-builtins-base.cc
index d484bb28afa..ddb25acd2a6 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins-base.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins-base.cc
@@ -497,7 +497,7 @@ public:
       {
        bool unsigned_p = e.type_suffix (0).unsigned_p;
        rtx_code code = get_rtx_code (m_code, unsigned_p);
-       return e.use_exact_insn (code_for_aarch64_pred_cmp (code, mode));
+       return e.use_exact_insn (code_for_aarch64_pred_cmp_acle (code, mode));
       }
 
     insn_code icode = code_for_aarch64_pred_fcm (m_unspec_for_fp, mode);
@@ -542,7 +542,7 @@ public:
 
     /* If the argument is a constant that the unwidened comparisons
        can handle directly, use them instead.  */
-    insn_code icode = code_for_aarch64_pred_cmp (code, mode);
+    insn_code icode = code_for_aarch64_pred_cmp_acle (code, mode);
     rtx op2 = unwrap_const_vec_duplicate (e.args[3]);
     if (CONSTANT_P (op2)
        && insn_data[icode].operand[4].predicate (op2, DImode))
diff --git a/gcc/config/aarch64/aarch64-sve.md 
b/gcc/config/aarch64/aarch64-sve.md
index 766d050b636..5486bafb4a6 100644
--- a/gcc/config/aarch64/aarch64-sve.md
+++ b/gcc/config/aarch64/aarch64-sve.md
@@ -8353,6 +8353,71 @@ (define_insn "@aarch64_pred_cmp<cmp_op><mode>"
   }
 )
 
+;; Likewise, but yield a VNx16BI result regardless of the element width.
+;; The .b case is equivalent to the above.
+(define_expand "@aarch64_pred_cmp<cmp_op><mode>_acle"
+  [(parallel
+     [(set (match_operand:<VPRED> 0 "register_operand")
+          (unspec:<VPRED>
+            [(match_operand:<VPRED> 1 "register_operand")
+             (match_operand:SI 2 "aarch64_sve_ptrue_flag")
+             (SVE_INT_CMP:<VPRED>
+               (match_operand:VNx16QI_ONLY 3 "register_operand")
+               (match_operand:VNx16QI_ONLY 4 
"aarch64_sve_cmp_<sve_imm_con>_operand"))]
+            UNSPEC_PRED_Z))
+      (clobber (reg:CC_NZC CC_REGNUM))])]
+  "TARGET_SVE"
+)
+
+;; For wider elements, bitcast the predicate result to a VNx16BI and use
+;; an (and ...) to indicate that only every second, fourth, or eighth bit
+;; is set.
+(define_expand "@aarch64_pred_cmp<cmp_op><mode>_acle"
+  [(parallel
+     [(set (match_operand:VNx16BI 0 "register_operand")
+          (and:VNx16BI
+            (subreg:VNx16BI
+              (unspec:<VPRED>
+                [(match_operand:<VPRED> 1 "register_operand")
+                 (match_operand:SI 2 "aarch64_sve_ptrue_flag")
+                 (SVE_INT_CMP:<VPRED>
+                   (match_operand:SVE_FULL_HSDI 3 "register_operand")
+                   (match_operand:SVE_FULL_HSDI 4 
"aarch64_sve_cmp_<sve_imm_con>_operand"))]
+                UNSPEC_PRED_Z)
+              0)
+            (match_dup 5)))
+      (clobber (reg:CC_NZC CC_REGNUM))])]
+  "TARGET_SVE"
+  {
+    operands[5] = aarch64_ptrue_all (GET_MODE_UNIT_SIZE (<MODE>mode));
+  }
+)
+
+(define_insn "*aarch64_pred_cmp<cmp_op><mode>_acle"
+  [(set (match_operand:VNx16BI 0 "register_operand")
+       (and:VNx16BI
+         (subreg:VNx16BI
+           (unspec:<VPRED>
+             [(match_operand:<VPRED> 1 "register_operand")
+              (match_operand:SI 2 "aarch64_sve_ptrue_flag")
+              (SVE_INT_CMP:<VPRED>
+                (match_operand:SVE_FULL_HSDI 3 "register_operand")
+                (match_operand:SVE_FULL_HSDI 4 
"aarch64_sve_cmp_<sve_imm_con>_operand"))]
+             UNSPEC_PRED_Z)
+           0)
+         (match_operand:<VPRED> 5 "aarch64_ptrue_all_operand")))
+   (clobber (reg:CC_NZC CC_REGNUM))]
+  "TARGET_SVE"
+  {@ [ cons: =0 , 1  , 3 , 4            ; attrs: pred_clobber ]
+     [ &Upa     , Upl, w , <sve_imm_con>; yes                 ] 
cmp<cmp_op>\t%0.<Vetype>, %1/z, %3.<Vetype>, #%4
+     [ ?Upl     , 0  , w , <sve_imm_con>; yes                 ] ^
+     [ Upa      , Upl, w , <sve_imm_con>; no                  ] ^
+     [ &Upa     , Upl, w , w            ; yes                 ] 
cmp<cmp_op>\t%0.<Vetype>, %1/z, %3.<Vetype>, %4.<Vetype>
+     [ ?Upl     , 0  , w , w            ; yes                 ] ^
+     [ Upa      , Upl, w , w            ; no                  ] ^
+  }
+)
+
 ;; Predicated integer comparisons in which both the flag and predicate
 ;; results are interesting.
 (define_insn_and_rewrite "*cmp<cmp_op><mode>_cc"
@@ -8394,6 +8459,49 @@ (define_insn_and_rewrite "*cmp<cmp_op><mode>_cc"
   }
 )
 
+(define_insn_and_rewrite "*cmp<cmp_op><mode>_acle_cc"
+  [(set (reg:CC_NZC CC_REGNUM)
+       (unspec:CC_NZC
+         [(match_operand:VNx16BI 1 "register_operand")
+          (match_operand 4)
+          (match_operand:SI 5 "aarch64_sve_ptrue_flag")
+          (unspec:<VPRED>
+            [(match_operand 6)
+             (match_operand:SI 7 "aarch64_sve_ptrue_flag")
+             (SVE_INT_CMP:<VPRED>
+               (match_operand:SVE_FULL_HSDI 2 "register_operand")
+               (match_operand:SVE_FULL_HSDI 3 
"aarch64_sve_cmp_<sve_imm_con>_operand"))]
+            UNSPEC_PRED_Z)]
+         UNSPEC_PTEST))
+   (set (match_operand:VNx16BI 0 "register_operand")
+       (and:VNx16BI
+         (subreg:VNx16BI
+           (unspec:<VPRED>
+             [(match_dup 6)
+              (match_dup 7)
+              (SVE_INT_CMP:<VPRED>
+                (match_dup 2)
+                (match_dup 3))]
+             UNSPEC_PRED_Z)
+           0)
+         (match_operand:<VPRED> 8 "aarch64_ptrue_all_operand")))]
+  "TARGET_SVE
+   && aarch64_sve_same_pred_for_ptest_p (&operands[4], &operands[6])"
+  {@ [ cons: =0 , 1   , 2 , 3            ; attrs: pred_clobber ]
+     [ &Upa     ,  Upl, w , <sve_imm_con>; yes                 ] 
cmp<cmp_op>\t%0.<Vetype>, %1/z, %2.<Vetype>, #%3
+     [ ?Upl     ,  0  , w , <sve_imm_con>; yes                 ] ^
+     [ Upa      ,  Upl, w , <sve_imm_con>; no                  ] ^
+     [ &Upa     ,  Upl, w , w            ; yes                 ] 
cmp<cmp_op>\t%0.<Vetype>, %1/z, %2.<Vetype>, %3.<Vetype>
+     [ ?Upl     ,  0  , w , w            ; yes                 ] ^
+     [ Upa      ,  Upl, w , w            ; no                  ] ^
+  }
+  "&& !rtx_equal_p (operands[4], operands[6])"
+  {
+    operands[6] = copy_rtx (operands[4]);
+    operands[7] = operands[5];
+  }
+)
+
 ;; Predicated integer comparisons in which only the flags result is
 ;; interesting.
 (define_insn_and_rewrite "*cmp<cmp_op><mode>_ptest"
@@ -8459,6 +8567,44 @@ (define_insn_and_split "*cmp<cmp_op><mode>_and"
       (clobber (reg:CC_NZC CC_REGNUM))])]
 )
 
+(define_insn_and_split "*cmp<cmp_op><mode>_acle_and"
+  [(set (match_operand:VNx16BI 0 "register_operand" "=Upa, Upa")
+       (and:VNx16BI
+         (and:VNx16BI
+           (subreg:VNx16BI
+             (unspec:<VPRED>
+               [(match_operand 4)
+                (const_int SVE_KNOWN_PTRUE)
+                (SVE_INT_CMP:<VPRED>
+                  (match_operand:SVE_FULL_HSDI 2 "register_operand" "w, w")
+                  (match_operand:SVE_FULL_HSDI 3 
"aarch64_sve_cmp_<sve_imm_con>_operand" "<sve_imm_con>, w"))]
+               UNSPEC_PRED_Z)
+             0)
+           (match_operand:VNx16BI 1 "register_operand" "Upl, Upl"))
+          (match_operand:<VPRED> 5 "aarch64_ptrue_all_operand")))
+   (clobber (reg:CC_NZC CC_REGNUM))]
+  "TARGET_SVE"
+  "#"
+  "&& 1"
+  [(parallel
+     [(set (match_dup 0)
+          (and:VNx16BI
+            (subreg:VNx16BI
+              (unspec:<VPRED>
+                [(match_dup 1)
+                 (const_int SVE_MAYBE_NOT_PTRUE)
+                 (SVE_INT_CMP:<VPRED>
+                   (match_dup 2)
+                   (match_dup 3))]
+                UNSPEC_PRED_Z)
+              0)
+            (match_dup 5)))
+      (clobber (reg:CC_NZC CC_REGNUM))])]
+  {
+    operands[1] = gen_lowpart (<VPRED>mode, operands[1]);
+  }
+)
+
 ;; Predicated integer wide comparisons.
 (define_insn "@aarch64_pred_cmp<cmp_op><mode>_wide"
   [(set (match_operand:<VPRED> 0 "register_operand")
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpeq_2.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpeq_2.c
index 028d37516cc..df98d27c28e 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpeq_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpeq_2.c
@@ -33,6 +33,108 @@ test4 (svbool_t pg, svint8_t x, int *any)
   return svptest_any (pg, res);
 }
 
-/* { dg-final { scan-assembler-times {\tcmpeq\t} 4 } } */
-/* { dg-final { scan-assembler-times {\tcmpeq\t[^\n]*, #10} 2 } } */
+void
+test5 (svint16_t x, svint16_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpeq (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test6 (svint16_t x, svint16_t y)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpeq (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test7 (svint16_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpeq (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test8 (svint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpeq (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test9 (svint32_t x, svint32_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpeq (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test10 (svint32_t x, svint32_t y)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpeq (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test11 (svint32_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpeq (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test12 (svint32_t x)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpeq (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test13 (svint64_t x, svint64_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpeq (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test14 (svint64_t x, svint64_t y)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpeq (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test15 (svint64_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpeq (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test16 (svint64_t x)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpeq (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+/* { dg-final { scan-assembler-times {\tcmpeq\t} 16 } } */
+/* { dg-final { scan-assembler-times {\tcmpeq\t[^\n]*, #10} 8 } } */
 /* { dg-final { scan-assembler-not {\tptest\t} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpeq_4.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpeq_4.c
new file mode 100644
index 00000000000..8e4b9310915
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpeq_4.c
@@ -0,0 +1,157 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <arm_sve.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** test1:
+**     cmpeq   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test1 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpeq (pg, x, y), p0);
+}
+
+/*
+** test2:
+**     cmpeq   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test2 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpeq (pg, x, y), p0);
+}
+
+/*
+** test3:
+**     cmpeq   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test3 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpeq (pg, x, y), pg);
+}
+
+/*
+** test4:
+**     cmpeq   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test4 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpeq (pg, x, 10), p0);
+}
+
+/*
+** test5:
+**     cmpeq   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test5 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpeq (pg, x, 10), p0);
+}
+
+/*
+** test6:
+**     cmpeq   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test6 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpeq (pg, x, 10), pg);
+}
+
+/*
+** test7:
+**     cmpeq   p0\.h, p0/z, z0\.h, z1\.h
+**     ret
+*/
+svbool_t
+test7 (svbool_t p0, svint16_t x, svint16_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpeq (pg, x, y), p0);
+}
+
+/*
+** test8:
+**     cmpeq   p0\.h, p0/z, z0\.h, #10
+**     ret
+*/
+svbool_t
+test8 (svbool_t p0, svint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpeq (pg, x, 10), p0);
+}
+
+/*
+** test9:
+**     cmpeq   p0\.s, p0/z, z0\.s, z1\.s
+**     ret
+*/
+svbool_t
+test9 (svbool_t p0, svint32_t x, svint32_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpeq (pg, x, y), p0);
+}
+
+/*
+** test10:
+**     cmpeq   p0\.s, p0/z, z0\.s, #10
+**     ret
+*/
+svbool_t
+test10 (svbool_t p0, svint32_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpeq (pg, x, 10), p0);
+}
+
+/*
+** test11:
+**     cmpeq   p0\.d, p0/z, z0\.d, z1\.d
+**     ret
+*/
+svbool_t
+test11 (svbool_t p0, svint64_t x, svint64_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpeq (pg, x, y), p0);
+}
+
+/*
+** test12:
+**     cmpeq   p0\.d, p0/z, z0\.d, #10
+**     ret
+*/
+svbool_t
+test12 (svbool_t p0, svint64_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpeq (pg, x, 10), p0);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_1.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_1.c
new file mode 100644
index 00000000000..f6bb3c8155a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_1.c
@@ -0,0 +1,140 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+void
+test1 (svbool_t pg, svint8_t x, svint8_t y, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmpge (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test2 (svbool_t pg, svint8_t x, svint8_t y, int *any)
+{
+  svbool_t res = svcmpge (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test3 (svbool_t pg, svint8_t x, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmpge (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test4 (svbool_t pg, svint8_t x, int *any)
+{
+  svbool_t res = svcmpge (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test5 (svint16_t x, svint16_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpge (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test6 (svint16_t x, svint16_t y)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpge (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test7 (svint16_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpge (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test8 (svint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpge (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test9 (svint32_t x, svint32_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpge (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test10 (svint32_t x, svint32_t y)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpge (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test11 (svint32_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpge (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test12 (svint32_t x)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpge (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test13 (svint64_t x, svint64_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpge (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test14 (svint64_t x, svint64_t y)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpge (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test15 (svint64_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpge (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test16 (svint64_t x)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpge (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+/* { dg-final { scan-assembler-times {\tcmpge\t} 16 } } */
+/* { dg-final { scan-assembler-times {\tcmpge\t[^\n]*, #10} 8 } } */
+/* { dg-final { scan-assembler-not {\tptest\t} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_2.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_2.c
new file mode 100644
index 00000000000..fc92291e975
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_2.c
@@ -0,0 +1,140 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+void
+test1 (svbool_t pg, svuint8_t x, svuint8_t y, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmpge (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test2 (svbool_t pg, svuint8_t x, svuint8_t y, int *any)
+{
+  svbool_t res = svcmpge (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test3 (svbool_t pg, svuint8_t x, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmpge (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test4 (svbool_t pg, svuint8_t x, int *any)
+{
+  svbool_t res = svcmpge (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test5 (svuint16_t x, svuint16_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpge (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test6 (svuint16_t x, svuint16_t y)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpge (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test7 (svuint16_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpge (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test8 (svuint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpge (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test9 (svuint32_t x, svuint32_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpge (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test10 (svuint32_t x, svuint32_t y)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpge (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test11 (svuint32_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpge (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test12 (svuint32_t x)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpge (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test13 (svuint64_t x, svuint64_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpge (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test14 (svuint64_t x, svuint64_t y)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpge (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test15 (svuint64_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpge (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test16 (svuint64_t x)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpge (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+/* { dg-final { scan-assembler-times {\tcmphs\t} 16 } } */
+/* { dg-final { scan-assembler-times {\tcmphs\t[^\n]*, #10} 8 } } */
+/* { dg-final { scan-assembler-not {\tptest\t} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_3.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_3.c
new file mode 100644
index 00000000000..6d50df5d2fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_3.c
@@ -0,0 +1,169 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <arm_sve.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** test1:
+**     cmpge   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test1 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpge (pg, x, y), p0);
+}
+
+/*
+** test2:
+**     cmpge   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test2 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpge (pg, x, y), p0);
+}
+
+/*
+** test3:
+**     cmpge   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test3 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpge (pg, x, y), pg);
+}
+
+/*
+** test4:
+** (
+**     cmpge   p0\.b, p0/z, z0\.b, #10
+** |
+**     cmpgt   p0\.b, p0/z, z0\.b, #9
+** )
+**     ret
+*/
+svbool_t
+test4 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpge (pg, x, 10), p0);
+}
+
+/*
+** test5:
+** (
+**     cmpge   p0\.b, p0/z, z0\.b, #10
+** |
+**     cmpgt   p0\.b, p0/z, z0\.b, #9
+** )
+**     ret
+*/
+svbool_t
+test5 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpge (pg, x, 10), p0);
+}
+
+/*
+** test6:
+** (
+**     cmpge   p0\.b, p0/z, z0\.b, #10
+** |
+**     cmpgt   p0\.b, p0/z, z0\.b, #9
+** )
+**     ret
+*/
+svbool_t
+test6 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpge (pg, x, 10), pg);
+}
+
+/*
+** test7:
+**     cmpge   p0\.h, p0/z, z0\.h, z1\.h
+**     ret
+*/
+svbool_t
+test7 (svbool_t p0, svint16_t x, svint16_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpge (pg, x, y), p0);
+}
+
+/*
+** test8:
+**     cmpge   p0\.h, p0/z, z0\.h, #10
+**     ret
+*/
+svbool_t
+test8 (svbool_t p0, svint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpge (pg, x, 10), p0);
+}
+
+/*
+** test9:
+**     cmpge   p0\.s, p0/z, z0\.s, z1\.s
+**     ret
+*/
+svbool_t
+test9 (svbool_t p0, svint32_t x, svint32_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpge (pg, x, y), p0);
+}
+
+/*
+** test10:
+**     cmpge   p0\.s, p0/z, z0\.s, #10
+**     ret
+*/
+svbool_t
+test10 (svbool_t p0, svint32_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpge (pg, x, 10), p0);
+}
+
+/*
+** test11:
+**     cmpge   p0\.d, p0/z, z0\.d, z1\.d
+**     ret
+*/
+svbool_t
+test11 (svbool_t p0, svint64_t x, svint64_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpge (pg, x, y), p0);
+}
+
+/*
+** test12:
+**     cmpge   p0\.d, p0/z, z0\.d, #10
+**     ret
+*/
+svbool_t
+test12 (svbool_t p0, svint64_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpge (pg, x, 10), p0);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_4.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_4.c
new file mode 100644
index 00000000000..2430e80b5d0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpge_4.c
@@ -0,0 +1,169 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <arm_sve.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** test1:
+**     cmphs   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test1 (svbool_t p0, svuint8_t x, svuint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpge (pg, x, y), p0);
+}
+
+/*
+** test2:
+**     cmphs   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test2 (svbool_t p0, svuint8_t x, svuint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpge (pg, x, y), p0);
+}
+
+/*
+** test3:
+**     cmphs   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test3 (svbool_t p0, svuint8_t x, svuint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpge (pg, x, y), pg);
+}
+
+/*
+** test4:
+** (
+**     cmphs   p0\.b, p0/z, z0\.b, #10
+** |
+**     cmphi   p0\.b, p0/z, z0\.b, #9
+** )
+**     ret
+*/
+svbool_t
+test4 (svbool_t p0, svuint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpge (pg, x, 10), p0);
+}
+
+/*
+** test5:
+** (
+**     cmphs   p0\.b, p0/z, z0\.b, #10
+** |
+**     cmphi   p0\.b, p0/z, z0\.b, #9
+** )
+**     ret
+*/
+svbool_t
+test5 (svbool_t p0, svuint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpge (pg, x, 10), p0);
+}
+
+/*
+** test6:
+** (
+**     cmphs   p0\.b, p0/z, z0\.b, #10
+** |
+**     cmphi   p0\.b, p0/z, z0\.b, #9
+** )
+**     ret
+*/
+svbool_t
+test6 (svbool_t p0, svuint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpge (pg, x, 10), pg);
+}
+
+/*
+** test7:
+**     cmphs   p0\.h, p0/z, z0\.h, z1\.h
+**     ret
+*/
+svbool_t
+test7 (svbool_t p0, svuint16_t x, svuint16_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpge (pg, x, y), p0);
+}
+
+/*
+** test8:
+**     cmphs   p0\.h, p0/z, z0\.h, #10
+**     ret
+*/
+svbool_t
+test8 (svbool_t p0, svuint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpge (pg, x, 10), p0);
+}
+
+/*
+** test9:
+**     cmphs   p0\.s, p0/z, z0\.s, z1\.s
+**     ret
+*/
+svbool_t
+test9 (svbool_t p0, svuint32_t x, svuint32_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpge (pg, x, y), p0);
+}
+
+/*
+** test10:
+**     cmphs   p0\.s, p0/z, z0\.s, #10
+**     ret
+*/
+svbool_t
+test10 (svbool_t p0, svuint32_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpge (pg, x, 10), p0);
+}
+
+/*
+** test11:
+**     cmphs   p0\.d, p0/z, z0\.d, z1\.d
+**     ret
+*/
+svbool_t
+test11 (svbool_t p0, svuint64_t x, svuint64_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpge (pg, x, y), p0);
+}
+
+/*
+** test12:
+**     cmphs   p0\.d, p0/z, z0\.d, #10
+**     ret
+*/
+svbool_t
+test12 (svbool_t p0, svuint64_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpge (pg, x, 10), p0);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_1.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_1.c
new file mode 100644
index 00000000000..6c28d6f7898
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_1.c
@@ -0,0 +1,140 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+void
+test1 (svbool_t pg, svint8_t x, svint8_t y, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmpgt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test2 (svbool_t pg, svint8_t x, svint8_t y, int *any)
+{
+  svbool_t res = svcmpgt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test3 (svbool_t pg, svint8_t x, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmpgt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test4 (svbool_t pg, svint8_t x, int *any)
+{
+  svbool_t res = svcmpgt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test5 (svint16_t x, svint16_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpgt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test6 (svint16_t x, svint16_t y)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpgt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test7 (svint16_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpgt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test8 (svint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpgt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test9 (svint32_t x, svint32_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpgt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test10 (svint32_t x, svint32_t y)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpgt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test11 (svint32_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpgt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test12 (svint32_t x)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpgt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test13 (svint64_t x, svint64_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpgt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test14 (svint64_t x, svint64_t y)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpgt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test15 (svint64_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpgt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test16 (svint64_t x)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpgt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+/* { dg-final { scan-assembler-times {\tcmpgt\t} 16 } } */
+/* { dg-final { scan-assembler-times {\tcmpgt\t[^\n]*, #10} 8 } } */
+/* { dg-final { scan-assembler-not {\tptest\t} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_2.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_2.c
new file mode 100644
index 00000000000..21604849c09
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_2.c
@@ -0,0 +1,140 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+void
+test1 (svbool_t pg, svuint8_t x, svuint8_t y, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmpgt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test2 (svbool_t pg, svuint8_t x, svuint8_t y, int *any)
+{
+  svbool_t res = svcmpgt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test3 (svbool_t pg, svuint8_t x, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmpgt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test4 (svbool_t pg, svuint8_t x, int *any)
+{
+  svbool_t res = svcmpgt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test5 (svuint16_t x, svuint16_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpgt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test6 (svuint16_t x, svuint16_t y)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpgt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test7 (svuint16_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpgt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test8 (svuint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpgt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test9 (svuint32_t x, svuint32_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpgt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test10 (svuint32_t x, svuint32_t y)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpgt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test11 (svuint32_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpgt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test12 (svuint32_t x)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpgt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test13 (svuint64_t x, svuint64_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpgt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test14 (svuint64_t x, svuint64_t y)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpgt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test15 (svuint64_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpgt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test16 (svuint64_t x)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpgt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+/* { dg-final { scan-assembler-times {\tcmphi\t} 16 } } */
+/* { dg-final { scan-assembler-times {\tcmphi\t[^\n]*, #10} 8 } } */
+/* { dg-final { scan-assembler-not {\tptest\t} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_3.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_3.c
new file mode 100644
index 00000000000..cc48b7e7452
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_3.c
@@ -0,0 +1,157 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <arm_sve.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** test1:
+**     cmpgt   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test1 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpgt (pg, x, y), p0);
+}
+
+/*
+** test2:
+**     cmpgt   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test2 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpgt (pg, x, y), p0);
+}
+
+/*
+** test3:
+**     cmpgt   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test3 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpgt (pg, x, y), pg);
+}
+
+/*
+** test4:
+**     cmpgt   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test4 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpgt (pg, x, 10), p0);
+}
+
+/*
+** test5:
+**     cmpgt   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test5 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpgt (pg, x, 10), p0);
+}
+
+/*
+** test6:
+**     cmpgt   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test6 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpgt (pg, x, 10), pg);
+}
+
+/*
+** test7:
+**     cmpgt   p0\.h, p0/z, z0\.h, z1\.h
+**     ret
+*/
+svbool_t
+test7 (svbool_t p0, svint16_t x, svint16_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpgt (pg, x, y), p0);
+}
+
+/*
+** test8:
+**     cmpgt   p0\.h, p0/z, z0\.h, #10
+**     ret
+*/
+svbool_t
+test8 (svbool_t p0, svint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpgt (pg, x, 10), p0);
+}
+
+/*
+** test9:
+**     cmpgt   p0\.s, p0/z, z0\.s, z1\.s
+**     ret
+*/
+svbool_t
+test9 (svbool_t p0, svint32_t x, svint32_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpgt (pg, x, y), p0);
+}
+
+/*
+** test10:
+**     cmpgt   p0\.s, p0/z, z0\.s, #10
+**     ret
+*/
+svbool_t
+test10 (svbool_t p0, svint32_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpgt (pg, x, 10), p0);
+}
+
+/*
+** test11:
+**     cmpgt   p0\.d, p0/z, z0\.d, z1\.d
+**     ret
+*/
+svbool_t
+test11 (svbool_t p0, svint64_t x, svint64_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpgt (pg, x, y), p0);
+}
+
+/*
+** test12:
+**     cmpgt   p0\.d, p0/z, z0\.d, #10
+**     ret
+*/
+svbool_t
+test12 (svbool_t p0, svint64_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpgt (pg, x, 10), p0);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_4.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_4.c
new file mode 100644
index 00000000000..bd49fe836ef
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpgt_4.c
@@ -0,0 +1,157 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <arm_sve.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** test1:
+**     cmphi   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test1 (svbool_t p0, svuint8_t x, svuint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpgt (pg, x, y), p0);
+}
+
+/*
+** test2:
+**     cmphi   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test2 (svbool_t p0, svuint8_t x, svuint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpgt (pg, x, y), p0);
+}
+
+/*
+** test3:
+**     cmphi   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test3 (svbool_t p0, svuint8_t x, svuint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpgt (pg, x, y), pg);
+}
+
+/*
+** test4:
+**     cmphi   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test4 (svbool_t p0, svuint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpgt (pg, x, 10), p0);
+}
+
+/*
+** test5:
+**     cmphi   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test5 (svbool_t p0, svuint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpgt (pg, x, 10), p0);
+}
+
+/*
+** test6:
+**     cmphi   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test6 (svbool_t p0, svuint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpgt (pg, x, 10), pg);
+}
+
+/*
+** test7:
+**     cmphi   p0\.h, p0/z, z0\.h, z1\.h
+**     ret
+*/
+svbool_t
+test7 (svbool_t p0, svuint16_t x, svuint16_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpgt (pg, x, y), p0);
+}
+
+/*
+** test8:
+**     cmphi   p0\.h, p0/z, z0\.h, #10
+**     ret
+*/
+svbool_t
+test8 (svbool_t p0, svuint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpgt (pg, x, 10), p0);
+}
+
+/*
+** test9:
+**     cmphi   p0\.s, p0/z, z0\.s, z1\.s
+**     ret
+*/
+svbool_t
+test9 (svbool_t p0, svuint32_t x, svuint32_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpgt (pg, x, y), p0);
+}
+
+/*
+** test10:
+**     cmphi   p0\.s, p0/z, z0\.s, #10
+**     ret
+*/
+svbool_t
+test10 (svbool_t p0, svuint32_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpgt (pg, x, 10), p0);
+}
+
+/*
+** test11:
+**     cmphi   p0\.d, p0/z, z0\.d, z1\.d
+**     ret
+*/
+svbool_t
+test11 (svbool_t p0, svuint64_t x, svuint64_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpgt (pg, x, y), p0);
+}
+
+/*
+** test12:
+**     cmphi   p0\.d, p0/z, z0\.d, #10
+**     ret
+*/
+svbool_t
+test12 (svbool_t p0, svuint64_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpgt (pg, x, 10), p0);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_1.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_1.c
new file mode 100644
index 00000000000..f2d7d2b4dfe
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_1.c
@@ -0,0 +1,140 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+void
+test1 (svbool_t pg, svint8_t x, svint8_t y, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmple (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test2 (svbool_t pg, svint8_t x, svint8_t y, int *any)
+{
+  svbool_t res = svcmple (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test3 (svbool_t pg, svint8_t x, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmple (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test4 (svbool_t pg, svint8_t x, int *any)
+{
+  svbool_t res = svcmple (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test5 (svint16_t x, svint16_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmple (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test6 (svint16_t x, svint16_t y)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmple (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test7 (svint16_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmple (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test8 (svint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmple (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test9 (svint32_t x, svint32_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmple (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test10 (svint32_t x, svint32_t y)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmple (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test11 (svint32_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmple (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test12 (svint32_t x)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmple (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test13 (svint64_t x, svint64_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmple (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test14 (svint64_t x, svint64_t y)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmple (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test15 (svint64_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmple (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test16 (svint64_t x)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmple (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+/* { dg-final { scan-assembler-times {\tcmple\t} 16 } } */
+/* { dg-final { scan-assembler-times {\tcmple\t[^\n]*, #10} 8 } } */
+/* { dg-final { scan-assembler-not {\tptest\t} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_2.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_2.c
new file mode 100644
index 00000000000..9d13d7af491
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_2.c
@@ -0,0 +1,140 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+void
+test1 (svbool_t pg, svuint8_t x, svuint8_t y, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmple (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test2 (svbool_t pg, svuint8_t x, svuint8_t y, int *any)
+{
+  svbool_t res = svcmple (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test3 (svbool_t pg, svuint8_t x, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmple (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test4 (svbool_t pg, svuint8_t x, int *any)
+{
+  svbool_t res = svcmple (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test5 (svuint16_t x, svuint16_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmple (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test6 (svuint16_t x, svuint16_t y)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmple (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test7 (svuint16_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmple (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test8 (svuint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmple (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test9 (svuint32_t x, svuint32_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmple (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test10 (svuint32_t x, svuint32_t y)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmple (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test11 (svuint32_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmple (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test12 (svuint32_t x)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmple (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test13 (svuint64_t x, svuint64_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmple (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test14 (svuint64_t x, svuint64_t y)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmple (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test15 (svuint64_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmple (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test16 (svuint64_t x)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmple (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+/* { dg-final { scan-assembler-times {\tcmpls\t} 16 } } */
+/* { dg-final { scan-assembler-times {\tcmpls\t[^\n]*, #10} 8 } } */
+/* { dg-final { scan-assembler-not {\tptest\t} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_3.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_3.c
new file mode 100644
index 00000000000..7a9326c6069
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_3.c
@@ -0,0 +1,157 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <arm_sve.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** test1:
+**     cmple   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test1 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmple (pg, x, y), p0);
+}
+
+/*
+** test2:
+**     cmple   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test2 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmple (pg, x, y), p0);
+}
+
+/*
+** test3:
+**     cmple   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test3 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmple (pg, x, y), pg);
+}
+
+/*
+** test4:
+**     cmple   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test4 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmple (pg, x, 10), p0);
+}
+
+/*
+** test5:
+**     cmple   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test5 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmple (pg, x, 10), p0);
+}
+
+/*
+** test6:
+**     cmple   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test6 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmple (pg, x, 10), pg);
+}
+
+/*
+** test7:
+**     cmple   p0\.h, p0/z, z0\.h, z1\.h
+**     ret
+*/
+svbool_t
+test7 (svbool_t p0, svint16_t x, svint16_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmple (pg, x, y), p0);
+}
+
+/*
+** test8:
+**     cmple   p0\.h, p0/z, z0\.h, #10
+**     ret
+*/
+svbool_t
+test8 (svbool_t p0, svint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmple (pg, x, 10), p0);
+}
+
+/*
+** test9:
+**     cmple   p0\.s, p0/z, z0\.s, z1\.s
+**     ret
+*/
+svbool_t
+test9 (svbool_t p0, svint32_t x, svint32_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmple (pg, x, y), p0);
+}
+
+/*
+** test10:
+**     cmple   p0\.s, p0/z, z0\.s, #10
+**     ret
+*/
+svbool_t
+test10 (svbool_t p0, svint32_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmple (pg, x, 10), p0);
+}
+
+/*
+** test11:
+**     cmple   p0\.d, p0/z, z0\.d, z1\.d
+**     ret
+*/
+svbool_t
+test11 (svbool_t p0, svint64_t x, svint64_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmple (pg, x, y), p0);
+}
+
+/*
+** test12:
+**     cmple   p0\.d, p0/z, z0\.d, #10
+**     ret
+*/
+svbool_t
+test12 (svbool_t p0, svint64_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmple (pg, x, 10), p0);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_4.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_4.c
new file mode 100644
index 00000000000..aca4385cdfb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmple_4.c
@@ -0,0 +1,157 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <arm_sve.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** test1:
+**     cmpls   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test1 (svbool_t p0, svuint8_t x, svuint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmple (pg, x, y), p0);
+}
+
+/*
+** test2:
+**     cmpls   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test2 (svbool_t p0, svuint8_t x, svuint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmple (pg, x, y), p0);
+}
+
+/*
+** test3:
+**     cmpls   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test3 (svbool_t p0, svuint8_t x, svuint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmple (pg, x, y), pg);
+}
+
+/*
+** test4:
+**     cmpls   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test4 (svbool_t p0, svuint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmple (pg, x, 10), p0);
+}
+
+/*
+** test5:
+**     cmpls   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test5 (svbool_t p0, svuint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmple (pg, x, 10), p0);
+}
+
+/*
+** test6:
+**     cmpls   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test6 (svbool_t p0, svuint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmple (pg, x, 10), pg);
+}
+
+/*
+** test7:
+**     cmpls   p0\.h, p0/z, z0\.h, z1\.h
+**     ret
+*/
+svbool_t
+test7 (svbool_t p0, svuint16_t x, svuint16_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmple (pg, x, y), p0);
+}
+
+/*
+** test8:
+**     cmpls   p0\.h, p0/z, z0\.h, #10
+**     ret
+*/
+svbool_t
+test8 (svbool_t p0, svuint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmple (pg, x, 10), p0);
+}
+
+/*
+** test9:
+**     cmpls   p0\.s, p0/z, z0\.s, z1\.s
+**     ret
+*/
+svbool_t
+test9 (svbool_t p0, svuint32_t x, svuint32_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmple (pg, x, y), p0);
+}
+
+/*
+** test10:
+**     cmpls   p0\.s, p0/z, z0\.s, #10
+**     ret
+*/
+svbool_t
+test10 (svbool_t p0, svuint32_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmple (pg, x, 10), p0);
+}
+
+/*
+** test11:
+**     cmpls   p0\.d, p0/z, z0\.d, z1\.d
+**     ret
+*/
+svbool_t
+test11 (svbool_t p0, svuint64_t x, svuint64_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmple (pg, x, y), p0);
+}
+
+/*
+** test12:
+**     cmpls   p0\.d, p0/z, z0\.d, #10
+**     ret
+*/
+svbool_t
+test12 (svbool_t p0, svuint64_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmple (pg, x, 10), p0);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_1.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_1.c
new file mode 100644
index 00000000000..a15bb4aa748
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_1.c
@@ -0,0 +1,140 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+void
+test1 (svbool_t pg, svint8_t x, svint8_t y, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmplt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test2 (svbool_t pg, svint8_t x, svint8_t y, int *any)
+{
+  svbool_t res = svcmplt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test3 (svbool_t pg, svint8_t x, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmplt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test4 (svbool_t pg, svint8_t x, int *any)
+{
+  svbool_t res = svcmplt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test5 (svint16_t x, svint16_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmplt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test6 (svint16_t x, svint16_t y)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmplt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test7 (svint16_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmplt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test8 (svint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmplt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test9 (svint32_t x, svint32_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmplt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test10 (svint32_t x, svint32_t y)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmplt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test11 (svint32_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmplt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test12 (svint32_t x)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmplt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test13 (svint64_t x, svint64_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmplt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test14 (svint64_t x, svint64_t y)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmplt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test15 (svint64_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmplt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test16 (svint64_t x)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmplt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+/* { dg-final { scan-assembler-times {\tcmplt\t} 16 } } */
+/* { dg-final { scan-assembler-times {\tcmplt\t[^\n]*, #10} 8 } } */
+/* { dg-final { scan-assembler-not {\tptest\t} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_2.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_2.c
new file mode 100644
index 00000000000..43c53a168b2
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_2.c
@@ -0,0 +1,140 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+void
+test1 (svbool_t pg, svuint8_t x, svuint8_t y, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmplt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test2 (svbool_t pg, svuint8_t x, svuint8_t y, int *any)
+{
+  svbool_t res = svcmplt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test3 (svbool_t pg, svuint8_t x, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmplt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test4 (svbool_t pg, svuint8_t x, int *any)
+{
+  svbool_t res = svcmplt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test5 (svuint16_t x, svuint16_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmplt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test6 (svuint16_t x, svuint16_t y)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmplt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test7 (svuint16_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmplt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test8 (svuint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmplt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test9 (svuint32_t x, svuint32_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmplt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test10 (svuint32_t x, svuint32_t y)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmplt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test11 (svuint32_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmplt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test12 (svuint32_t x)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmplt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test13 (svuint64_t x, svuint64_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmplt (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test14 (svuint64_t x, svuint64_t y)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmplt (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test15 (svuint64_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmplt (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test16 (svuint64_t x)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmplt (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+/* { dg-final { scan-assembler-times {\tcmplo\t} 16 } } */
+/* { dg-final { scan-assembler-times {\tcmplo\t[^\n]*, #10} 8 } } */
+/* { dg-final { scan-assembler-not {\tptest\t} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_3.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_3.c
new file mode 100644
index 00000000000..bddbbebb3c1
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_3.c
@@ -0,0 +1,169 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <arm_sve.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** test1:
+**     cmplt   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test1 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmplt (pg, x, y), p0);
+}
+
+/*
+** test2:
+**     cmplt   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test2 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmplt (pg, x, y), p0);
+}
+
+/*
+** test3:
+**     cmplt   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test3 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmplt (pg, x, y), pg);
+}
+
+/*
+** test4:
+** (
+**     cmplt   p0\.b, p0/z, z0\.b, #10
+** |
+**     cmple   p0\.b, p0/z, z0\.b, #9
+** )
+**     ret
+*/
+svbool_t
+test4 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmplt (pg, x, 10), p0);
+}
+
+/*
+** test5:
+** (
+**     cmplt   p0\.b, p0/z, z0\.b, #10
+** |
+**     cmple   p0\.b, p0/z, z0\.b, #9
+** )
+**     ret
+*/
+svbool_t
+test5 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmplt (pg, x, 10), p0);
+}
+
+/*
+** test6:
+** (
+**     cmplt   p0\.b, p0/z, z0\.b, #10
+** |
+**     cmple   p0\.b, p0/z, z0\.b, #9
+** )
+**     ret
+*/
+svbool_t
+test6 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmplt (pg, x, 10), pg);
+}
+
+/*
+** test7:
+**     cmplt   p0\.h, p0/z, z0\.h, z1\.h
+**     ret
+*/
+svbool_t
+test7 (svbool_t p0, svint16_t x, svint16_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmplt (pg, x, y), p0);
+}
+
+/*
+** test8:
+**     cmplt   p0\.h, p0/z, z0\.h, #10
+**     ret
+*/
+svbool_t
+test8 (svbool_t p0, svint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmplt (pg, x, 10), p0);
+}
+
+/*
+** test9:
+**     cmplt   p0\.s, p0/z, z0\.s, z1\.s
+**     ret
+*/
+svbool_t
+test9 (svbool_t p0, svint32_t x, svint32_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmplt (pg, x, y), p0);
+}
+
+/*
+** test10:
+**     cmplt   p0\.s, p0/z, z0\.s, #10
+**     ret
+*/
+svbool_t
+test10 (svbool_t p0, svint32_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmplt (pg, x, 10), p0);
+}
+
+/*
+** test11:
+**     cmplt   p0\.d, p0/z, z0\.d, z1\.d
+**     ret
+*/
+svbool_t
+test11 (svbool_t p0, svint64_t x, svint64_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmplt (pg, x, y), p0);
+}
+
+/*
+** test12:
+**     cmplt   p0\.d, p0/z, z0\.d, #10
+**     ret
+*/
+svbool_t
+test12 (svbool_t p0, svint64_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmplt (pg, x, 10), p0);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_4.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_4.c
new file mode 100644
index 00000000000..b71c8e9d005
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmplt_4.c
@@ -0,0 +1,169 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <arm_sve.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** test1:
+**     cmplo   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test1 (svbool_t p0, svuint8_t x, svuint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmplt (pg, x, y), p0);
+}
+
+/*
+** test2:
+**     cmplo   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test2 (svbool_t p0, svuint8_t x, svuint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmplt (pg, x, y), p0);
+}
+
+/*
+** test3:
+**     cmplo   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test3 (svbool_t p0, svuint8_t x, svuint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmplt (pg, x, y), pg);
+}
+
+/*
+** test4:
+** (
+**     cmplo   p0\.b, p0/z, z0\.b, #10
+** |
+**     cmpls   p0\.b, p0/z, z0\.b, #9
+** )
+**     ret
+*/
+svbool_t
+test4 (svbool_t p0, svuint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmplt (pg, x, 10), p0);
+}
+
+/*
+** test5:
+** (
+**     cmplo   p0\.b, p0/z, z0\.b, #10
+** |
+**     cmpls   p0\.b, p0/z, z0\.b, #9
+** )
+**     ret
+*/
+svbool_t
+test5 (svbool_t p0, svuint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmplt (pg, x, 10), p0);
+}
+
+/*
+** test6:
+** (
+**     cmplo   p0\.b, p0/z, z0\.b, #10
+** |
+**     cmpls   p0\.b, p0/z, z0\.b, #9
+** )
+**     ret
+*/
+svbool_t
+test6 (svbool_t p0, svuint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmplt (pg, x, 10), pg);
+}
+
+/*
+** test7:
+**     cmplo   p0\.h, p0/z, z0\.h, z1\.h
+**     ret
+*/
+svbool_t
+test7 (svbool_t p0, svuint16_t x, svuint16_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmplt (pg, x, y), p0);
+}
+
+/*
+** test8:
+**     cmplo   p0\.h, p0/z, z0\.h, #10
+**     ret
+*/
+svbool_t
+test8 (svbool_t p0, svuint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmplt (pg, x, 10), p0);
+}
+
+/*
+** test9:
+**     cmplo   p0\.s, p0/z, z0\.s, z1\.s
+**     ret
+*/
+svbool_t
+test9 (svbool_t p0, svuint32_t x, svuint32_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmplt (pg, x, y), p0);
+}
+
+/*
+** test10:
+**     cmplo   p0\.s, p0/z, z0\.s, #10
+**     ret
+*/
+svbool_t
+test10 (svbool_t p0, svuint32_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmplt (pg, x, 10), p0);
+}
+
+/*
+** test11:
+**     cmplo   p0\.d, p0/z, z0\.d, z1\.d
+**     ret
+*/
+svbool_t
+test11 (svbool_t p0, svuint64_t x, svuint64_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmplt (pg, x, y), p0);
+}
+
+/*
+** test12:
+**     cmplo   p0\.d, p0/z, z0\.d, #10
+**     ret
+*/
+svbool_t
+test12 (svbool_t p0, svuint64_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmplt (pg, x, 10), p0);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpne_1.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpne_1.c
new file mode 100644
index 00000000000..61f7718ff8c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpne_1.c
@@ -0,0 +1,140 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+#include <arm_sve.h>
+
+void
+test1 (svbool_t pg, svint8_t x, svint8_t y, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmpne (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test2 (svbool_t pg, svint8_t x, svint8_t y, int *any)
+{
+  svbool_t res = svcmpne (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test3 (svbool_t pg, svint8_t x, int *any, svbool_t *ptr)
+{
+  svbool_t res = svcmpne (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test4 (svbool_t pg, svint8_t x, int *any)
+{
+  svbool_t res = svcmpne (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test5 (svint16_t x, svint16_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpne (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test6 (svint16_t x, svint16_t y)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpne (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test7 (svint16_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpne (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test8 (svint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  svbool_t res = svcmpne (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test9 (svint32_t x, svint32_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpne (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test10 (svint32_t x, svint32_t y)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpne (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test11 (svint32_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpne (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test12 (svint32_t x)
+{
+  svbool_t pg = svptrue_b32 ();
+  svbool_t res = svcmpne (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+void
+test13 (svint64_t x, svint64_t y, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpne (pg, x, y);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test14 (svint64_t x, svint64_t y)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpne (pg, x, y);
+  return svptest_any (pg, res);
+}
+
+void
+test15 (svint64_t x, int *any, svbool_t *ptr)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpne (pg, x, 10);
+  *any = svptest_any (pg, res);
+  *ptr = res;
+}
+
+int
+test16 (svint64_t x)
+{
+  svbool_t pg = svptrue_b64 ();
+  svbool_t res = svcmpne (pg, x, 10);
+  return svptest_any (pg, res);
+}
+
+/* { dg-final { scan-assembler-times {\tcmpne\t} 16 } } */
+/* { dg-final { scan-assembler-times {\tcmpne\t[^\n]*, #10} 8 } } */
+/* { dg-final { scan-assembler-not {\tptest\t} } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpne_2.c 
b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpne_2.c
new file mode 100644
index 00000000000..53cedb37396
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/cmpne_2.c
@@ -0,0 +1,157 @@
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-final { check-function-bodies "**" "" } } */
+
+#include <arm_sve.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+** test1:
+**     cmpne   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test1 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpne (pg, x, y), p0);
+}
+
+/*
+** test2:
+**     cmpne   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test2 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpne (pg, x, y), p0);
+}
+
+/*
+** test3:
+**     cmpne   p0\.b, p0/z, z0\.b, z1\.b
+**     ret
+*/
+svbool_t
+test3 (svbool_t p0, svint8_t x, svint8_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpne (pg, x, y), pg);
+}
+
+/*
+** test4:
+**     cmpne   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test4 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpne (pg, x, 10), p0);
+}
+
+/*
+** test5:
+**     cmpne   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test5 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpne (pg, x, 10), p0);
+}
+
+/*
+** test6:
+**     cmpne   p0\.b, p0/z, z0\.b, #10
+**     ret
+*/
+svbool_t
+test6 (svbool_t p0, svint8_t x)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (p0, svcmpne (pg, x, 10), pg);
+}
+
+/*
+** test7:
+**     cmpne   p0\.h, p0/z, z0\.h, z1\.h
+**     ret
+*/
+svbool_t
+test7 (svbool_t p0, svint16_t x, svint16_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpne (pg, x, y), p0);
+}
+
+/*
+** test8:
+**     cmpne   p0\.h, p0/z, z0\.h, #10
+**     ret
+*/
+svbool_t
+test8 (svbool_t p0, svint16_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpne (pg, x, 10), p0);
+}
+
+/*
+** test9:
+**     cmpne   p0\.s, p0/z, z0\.s, z1\.s
+**     ret
+*/
+svbool_t
+test9 (svbool_t p0, svint32_t x, svint32_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpne (pg, x, y), p0);
+}
+
+/*
+** test10:
+**     cmpne   p0\.s, p0/z, z0\.s, #10
+**     ret
+*/
+svbool_t
+test10 (svbool_t p0, svint32_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpne (pg, x, 10), p0);
+}
+
+/*
+** test11:
+**     cmpne   p0\.d, p0/z, z0\.d, z1\.d
+**     ret
+*/
+svbool_t
+test11 (svbool_t p0, svint64_t x, svint64_t y)
+{
+  svbool_t pg = svptrue_b8 ();
+  return svand_z (pg, svcmpne (pg, x, y), p0);
+}
+
+/*
+** test12:
+**     cmpne   p0\.d, p0/z, z0\.d, #10
+**     ret
+*/
+svbool_t
+test12 (svbool_t p0, svint64_t x)
+{
+  svbool_t pg = svptrue_b16 ();
+  return svand_z (pg, svcmpne (pg, x, 10), p0);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_1.c 
b/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_1.c
index 38dfdd43d81..e777f0306ed 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_1.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_1.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -mcpu=neoverse-n2" } */
+/* { dg-options "-O2 -mcpu=neoverse-n2 -fdisable-rtl-combine" } */
 /* { dg-final { check-function-bodies "**" "" } } */
 
 #pragma GCC target "+sve"
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_2.c 
b/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_2.c
index 45363cca925..41182e10e89 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_2.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_2.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -mcpu=neoverse-v2" } */
+/* { dg-options "-O2 -mcpu=neoverse-v2 -fdisable-rtl-combine" } */
 /* { dg-final { check-function-bodies "**" "" } } */
 
 #pragma GCC target "+sve"
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_3.c 
b/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_3.c
index c50a5815cc0..04a90238c69 100644
--- a/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_3.c
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pred_clobber_3.c
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -mcpu=neoverse-v1" } */
+/* { dg-options "-O2 -mcpu=neoverse-v1 -fdisable-rtl-combine" } */
 /* { dg-final { check-function-bodies "**" "" } } */
 
 #pragma GCC target "+sve"
-- 
2.43.0

Reply via email to