public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: H.J. Lu <hjl@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-2795] Add tests for PR tree-optimization/88531
Date: Sat,  7 Aug 2021 14:35:15 +0000 (GMT)	[thread overview]
Message-ID: <20210807143515.581063858404@sourceware.org> (raw)

https://gcc.gnu.org/g:6866f4819ad8e6e62fef2177520f9fb217dfa353

commit r12-2795-g6866f4819ad8e6e62fef2177520f9fb217dfa353
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sat Aug 7 07:29:04 2021 -0700

    Add tests for PR tree-optimization/88531
    
            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.

Diff:
---
 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(+)

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 } } */


                 reply	other threads:[~2021-08-07 14:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210807143515.581063858404@sourceware.org \
    --to=hjl@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).