diff mbox series

[committed] testsuite/i386: Add vector sat_sub testcases [PR112600]

Message ID CAFULd4bfD=9nKPpXmSTixCw9GuYaSv1U565RrkLK3ZT+NMP05A@mail.gmail.com
State New
Headers show
Series [committed] testsuite/i386: Add vector sat_sub testcases [PR112600] | expand

Commit Message

Uros Bizjak June 6, 2024, 5:46 p.m. UTC
PR middle-end/112600

gcc/testsuite/ChangeLog:

    * gcc.target/i386/pr112600-2a.c: New test.
    * gcc.target/i386/pr112600-2b.c: New test.

Tested on x86_64-linux-gnu {,-m32}.

Uros.
diff mbox series

Patch

diff --git a/gcc/testsuite/gcc.target/i386/pr112600-2a.c b/gcc/testsuite/gcc.target/i386/pr112600-2a.c
new file mode 100644
index 00000000000..4df38e5a720
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr112600-2a.c
@@ -0,0 +1,15 @@ 
+/* PR middle-end/112600 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -msse2" } */
+
+typedef unsigned char T;
+
+void foo (T *out, T *x, T *y, int n)
+{
+  int i;
+
+  for (i = 0; i < n; i++)
+    out[i] = (x[i] - y[i]) & (-(T)(x[i] >= y[i]));
+}
+
+/* { dg-final { scan-assembler "psubusb" } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr112600-2b.c b/gcc/testsuite/gcc.target/i386/pr112600-2b.c
new file mode 100644
index 00000000000..0f6345de704
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr112600-2b.c
@@ -0,0 +1,15 @@ 
+/* PR middle-end/112600 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -msse2" } */
+
+typedef unsigned short T;
+
+void foo (T *out, T *x, T *y, int n)
+{
+  int i;
+
+  for (i = 0; i < n; i++)
+    out[i] = (x[i] - y[i]) & (-(T)(x[i] >= y[i]));
+}
+
+/* { dg-final { scan-assembler "psubusw" } } */