]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
s390: Split tests for 31bit support
authorJuergen Christ <jchrist@linux.ibm.com>
Tue, 8 Jul 2025 09:26:38 +0000 (11:26 +0200)
committerJuergen Christ <jchrist@linux.ibm.com>
Tue, 8 Jul 2025 09:30:51 +0000 (11:30 +0200)
The new vector pattern tests used int128 without guard.  This causes
failure on 31bit targets.  Split the tests such that the tests
requiring 128 bit support are only executed on targets supporting
them.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>
gcc/testsuite/ChangeLog:

* gcc.target/s390/vector/pattern-avg-1.c: Split test.
* gcc.target/s390/vector/pattern-mulh-1.c: Split test.
* gcc.target/s390/vector/pattern-avg-2.c: New test.
* gcc.target/s390/vector/pattern-mulh-2.c: New test.

gcc/testsuite/gcc.target/s390/vector/pattern-avg-1.c
gcc/testsuite/gcc.target/s390/vector/pattern-avg-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/s390/vector/pattern-mulh-1.c
gcc/testsuite/gcc.target/s390/vector/pattern-mulh-2.c [new file with mode: 0644]

index a15301aabe54a998c5c5dcaec06e8701cf10f1e0..30c6ed47684627a70ef9b77b0f7d3202dd41e7c2 100644 (file)
@@ -21,6 +21,5 @@
 TEST(char,short,16)
 TEST(short,int,8)
 TEST(int,long,4)
-TEST(long,__int128,2)
 
-/* { dg-final { scan-tree-dump-times "\.AVG_CEIL" 8 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\.AVG_CEIL" 6 "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/pattern-avg-2.c b/gcc/testsuite/gcc.target/s390/vector/pattern-avg-2.c
new file mode 100644 (file)
index 0000000..1cc614e
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -mzarch -march=z16 -ftree-vectorize -fdump-tree-optimized" } */
+
+#define TEST(T1,T2,N)                                                   \
+  void                                                                  \
+  avg##T1 (signed T1 *__restrict res, signed T1 *__restrict a,          \
+           signed T1 *__restrict b)                                     \
+  {                                                                     \
+    for (int i = 0; i < N; ++i)                                         \
+      res[i] = ((signed T2)a[i] + b[i] + 1) >> 1;                       \
+  }                                                                     \
+                                                                        \
+  void                                                                  \
+  uavg##T1 (unsigned T1 *__restrict res, unsigned T1 *__restrict a,     \
+            unsigned T1 *__restrict b)                                  \
+  {                                                                     \
+    for (int i = 0; i < N; ++i)                                         \
+      res[i] = ((unsigned T2)a[i] + b[i] + 1) >> 1;                     \
+  }
+
+TEST(long,__int128,2)
+
+/* { dg-final { scan-tree-dump-times "\.AVG_CEIL" 2 "optimized" } } */
index cd8e4e7d7a0926e480f18b0a9801b3879bfa89b7..f71ef06c8252161a63a9f459ce5f0152eef361b1 100644 (file)
@@ -24,6 +24,5 @@
 TEST(char,short,16,8)
 TEST(short,int,8,16)
 TEST(int,long,4,32)
-TEST(long,__int128,2,64)
 
-/* { dg-final { scan-tree-dump-times "\.MULH" 8 "optimized" } } */
+/* { dg-final { scan-tree-dump-times "\.MULH" 6 "optimized" } } */
diff --git a/gcc/testsuite/gcc.target/s390/vector/pattern-mulh-2.c b/gcc/testsuite/gcc.target/s390/vector/pattern-mulh-2.c
new file mode 100644 (file)
index 0000000..6ac6855
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do compile { target int128 } } */
+/* { dg-options "-O3 -mzarch -march=arch15 -ftree-vectorize -fdump-tree-optimized" } */
+
+#define TEST(T1,T2,N,S)                                                 \
+  void                                                                  \
+  mulh##T1 (signed T1 *__restrict res,                                  \
+            signed T1 *__restrict l,                                    \
+            signed T1 *__restrict r)                                    \
+  {                                                                     \
+    for (int i = 0; i < N; ++i)                                         \
+      res[i] = (signed T1) (((signed T2)l[i] * (signed T2)r[i]) >> S);  \
+  }                                                                     \
+                                                                        \
+  void                                                                  \
+  umulh##T1 (unsigned T1 *__restrict res,                               \
+             unsigned T1 *__restrict l,                                 \
+             unsigned T1 *__restrict r)                                 \
+  {                                                                     \
+    for (int i = 0; i < N; ++i)                                         \
+      res[i] = (unsigned T1)                                            \
+        (((unsigned T2)l[i] * (unsigned T2)r[i]) >> S);                 \
+  }
+
+TEST(long,__int128,2,64)
+
+/* { dg-final { scan-tree-dump-times "\.MULH" 2 "optimized" } } */