aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKewen Lin <linkw@linux.ibm.com>2021-11-28 19:59:59 -0600
committerKewen Lin <linkw@linux.ibm.com>2021-11-28 19:59:59 -0600
commit300dbea12693e365c89971527ca14cb0242def64 (patch)
treee63cc02d5be7635d07df83bc936919071eb7b7cf
parent68332ab7ec58a89660db82569c5f4c2251d59741 (diff)
downloadgcc-300dbea12693e365c89971527ca14cb0242def64.zip
gcc-300dbea12693e365c89971527ca14cb0242def64.tar.gz
gcc-300dbea12693e365c89971527ca14cb0242def64.tar.bz2
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.
-rw-r--r--gcc/testsuite/gcc.target/powerpc/vect-gather-1.c20
1 files changed, 20 insertions, 0 deletions
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 0000000..bf98045
--- /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" } } */