public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kewen Lin <linkw@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-5569] rs6000/test: Add emulated gather test case
Date: Mon, 29 Nov 2021 02:02:00 +0000 (GMT)	[thread overview]
Message-ID: <20211129020200.829343858C2C@sourceware.org> (raw)

https://gcc.gnu.org/g:300dbea12693e365c89971527ca14cb0242def64

commit r12-5569-g300dbea12693e365c89971527ca14cb0242def64
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Sun Nov 28 19:59:59 2021 -0600

    rs6000/test: Add emulated gather test case
    
    As verified, the emulated gather capability of vectorizer
    (r12-2733) can help to speed up SPEC2017 510.parest_r on
    Power8/9/10 by 5% ~ 9% with option sets Ofast unroll and
    Ofast lto.
    
    This patch is to add a test case similar to the one in i386
    to add testing coverage for 510.parest_r hotspots.
    
    btw, different from the one in i386, this uses unsigned int
    as INDEXTYPE since the unpack support for unsigned int
    (r12-3134) also matters for the hotspots vectorization.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/powerpc/vect-gather-1.c: New test.

Diff:
---
 gcc/testsuite/gcc.target/powerpc/vect-gather-1.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gcc/testsuite/gcc.target/powerpc/vect-gather-1.c b/gcc/testsuite/gcc.target/powerpc/vect-gather-1.c
new file mode 100644
index 00000000000..bf98045ab03
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/vect-gather-1.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* Profitable from Power8 since it supports efficient unaligned load.  */
+/* { dg-options "-Ofast -mdejagnu-cpu=power8 -fdump-tree-vect-details -fdump-tree-forwprop4" } */
+
+#ifndef INDEXTYPE
+#define INDEXTYPE unsigned int
+#endif
+double vmul(INDEXTYPE *rowstart, INDEXTYPE *rowend,
+	    double *luval, double *dst)
+{
+  double res = 0;
+  for (const INDEXTYPE * col = rowstart; col != rowend; ++col, ++luval)
+        res += *luval * dst[*col];
+  return res;
+}
+
+/* With gather emulation this should be profitable to vectorize from Power8.  */
+/* { dg-final { scan-tree-dump "loop vectorized" "vect" } } */
+/* The index vector loads and promotions should be scalar after forwprop.  */
+/* { dg-final { scan-tree-dump-not "vec_unpack" "forwprop4" } } */


                 reply	other threads:[~2021-11-29  2:02 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=20211129020200.829343858C2C@sourceware.org \
    --to=linkw@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).