[PATCH] Add tests for PR tree-optimization/88531

H.J. Lu hjl.tools@gmail.com
Sat Aug 7 14:32:15 GMT 2021


	PR tree-optimization/88531
	* gcc.target/i386/pr88531-1a.c: New test.
	* gcc.target/i386/pr88531-1b.c: Likewise.
	* gcc.target/i386/pr88531-1c.c: Likewise.
	* gcc.target/i386/pr88531-2a.c: Likewise.
	* gcc.target/i386/pr88531-2b.c: Likewise.
	* gcc.target/i386/pr88531-2c.c: Likewise.
---
 gcc/testsuite/gcc.target/i386/pr88531-1a.c | 19 +++++++++++++++++++
 gcc/testsuite/gcc.target/i386/pr88531-1b.c |  8 ++++++++
 gcc/testsuite/gcc.target/i386/pr88531-1c.c |  8 ++++++++
 gcc/testsuite/gcc.target/i386/pr88531-2a.c | 19 +++++++++++++++++++
 gcc/testsuite/gcc.target/i386/pr88531-2b.c |  6 ++++++
 gcc/testsuite/gcc.target/i386/pr88531-2c.c |  6 ++++++
 6 files changed, 66 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr88531-1a.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr88531-1b.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr88531-1c.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr88531-2a.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr88531-2b.c
 create mode 100644 gcc/testsuite/gcc.target/i386/pr88531-2c.c

diff --git a/gcc/testsuite/gcc.target/i386/pr88531-1a.c b/gcc/testsuite/gcc.target/i386/pr88531-1a.c
new file mode 100644
index 00000000000..d1c29b2c990
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr88531-1a.c
@@ -0,0 +1,19 @@
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-O3 -march=x86-64 -mfpmath=sse" } */
+
+#include <stdint.h>
+
+#define loop_t uint32_t
+#define idx_t uint32_t
+
+void loop(double * const __restrict__ dst,
+          double const * const __restrict__ src,
+          idx_t const * const __restrict__ idx,
+          loop_t const begin,
+          loop_t const end)
+{
+  for (loop_t i = begin; i < end; ++i)
+    dst[i] = 42.0 * src[idx[i]];
+}
+
+/* { dg-final { scan-assembler-times "mulpd" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr88531-1b.c b/gcc/testsuite/gcc.target/i386/pr88531-1b.c
new file mode 100644
index 00000000000..812c8a10fab
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr88531-1b.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake -mfpmath=sse" } */
+
+#include "pr88531-1a.c"
+
+/* { dg-final { scan-assembler-times "vgatherdpd" 4 { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler-times "vgatherqpd" 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "vmulpd" 4 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr88531-1c.c b/gcc/testsuite/gcc.target/i386/pr88531-1c.c
new file mode 100644
index 00000000000..43fc5913ed3
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr88531-1c.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake-avx512 -mfpmath=sse" } */
+
+#include "pr88531-1a.c"
+
+/* { dg-final { scan-assembler-times "vgatherdpd" 4 { target { ! lp64 } } } } */
+/* { dg-final { scan-assembler-times "vgatherqpd" 4 { target lp64 } } } */
+/* { dg-final { scan-assembler-times "vmulpd" 4 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr88531-2a.c b/gcc/testsuite/gcc.target/i386/pr88531-2a.c
new file mode 100644
index 00000000000..8ab2b1385eb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr88531-2a.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=x86-64 -mfpmath=sse" } */
+
+#include <stdint.h>
+
+#define loop_t uint32_t
+#define idx_t uint32_t
+
+void loop(float * const __restrict__ dst,
+          float const * const __restrict__ src,
+          idx_t const * const __restrict__ idx,
+          loop_t const begin,
+          loop_t const end)
+{
+  for (loop_t i = begin; i < end; ++i)
+    dst[i] = 42.0 * src[idx[i]];
+}
+
+/* { dg-final { scan-assembler-times "mulps" 1 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr88531-2b.c b/gcc/testsuite/gcc.target/i386/pr88531-2b.c
new file mode 100644
index 00000000000..011607c3d54
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr88531-2b.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake -mfpmath=sse" } */
+
+#include "pr88531-2a.c"
+
+/* { dg-final { scan-assembler-times "vmulps" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr88531-2c.c b/gcc/testsuite/gcc.target/i386/pr88531-2c.c
new file mode 100644
index 00000000000..0f7ec3832f8
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr88531-2c.c
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -march=skylake-avx512 -mfpmath=sse" } */
+
+#include "pr88531-2a.c"
+
+/* { dg-final { scan-assembler-times "vmulps" 2 } } */
-- 
2.31.1



More information about the Gcc-patches mailing list