]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
s390: Don't emulate vec_cmpgtuv1tiv1ti for VXE3 [PR122781]
authorStefan Schulze Frielinghaus <stefansf@gcc.gnu.org>
Wed, 21 Jan 2026 15:00:59 +0000 (16:00 +0100)
committerStefan Schulze Frielinghaus <stefansf@gcc.gnu.org>
Wed, 21 Jan 2026 15:00:59 +0000 (16:00 +0100)
Starting with VXE3, 128-bit integer compares are natively supported.
For older machines those compares are emulated via
*vec_cmpeq<mode><mode>_nocc_emu and *vec_cmpgt<mode><mode>_nocc_emu and
*vec_cmpgtu<mode><mode>_nocc_emu.  The latter was missing !TARGET_VXE3
in the condition which resulted in emulating unsigned greater-than
compares instead of making use of the new instructions enabled by
r15-7051.

PR target/122781

gcc/ChangeLog:

* config/s390/vector.md: Don't emulate vec_cmpgtu for 128-bit
integers for VXE3.

gcc/testsuite/ChangeLog:

* gcc.target/s390/vxe3/vcmp-1.c: New test.

gcc/config/s390/vector.md
gcc/testsuite/gcc.target/s390/vxe3/vcmp-1.c [new file with mode: 0644]

index 4b4957ec1ade28aa7173ce757ce5f85f359977b9..f0be6f10c1acd33aa07d97d22ecca08d91845dae 100644 (file)
   [(set (match_operand:VI_HW_T              0 "register_operand" "=v")
        (gtu:VI_HW_T (match_operand:VI_HW_T 1 "register_operand"  "v")
                     (match_operand:VI_HW_T 2 "register_operand"  "v")))]
-  "TARGET_VX"
+  "TARGET_VX && !TARGET_VXE3"
   "#"
   "&& can_create_pseudo_p ()"
   [(set (match_dup 3)
diff --git a/gcc/testsuite/gcc.target/s390/vxe3/vcmp-1.c b/gcc/testsuite/gcc.target/s390/vxe3/vcmp-1.c
new file mode 100644 (file)
index 0000000..8fbc0ec
--- /dev/null
@@ -0,0 +1,42 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target int128 } */
+/* { dg-final { check-function-bodies "**" "" "" } } */
+
+typedef __int128 __attribute__ ((vector_size (16))) V1TI;
+typedef unsigned __int128 __attribute__ ((vector_size (16))) UV1TI;
+
+/*
+** cmpeq:
+**     vceqq   %v24,%v24,%v26
+**     br      %r14
+*/
+
+V1TI
+cmpeq (V1TI x, V1TI y)
+{
+  return x == y;
+}
+
+/*
+** cmpgt:
+**     vchq    %v24,%v24,%v26
+**     br      %r14
+*/
+
+V1TI
+cmpgt (V1TI x, V1TI y)
+{
+  return x > y;
+}
+
+/*
+** cmpgtu:
+**     vchlq   %v24,%v24,%v26
+**     br      %r14
+*/
+
+V1TI
+cmpgtu (UV1TI x, UV1TI y)
+{
+  return x > y;
+}