* [PATCH] New SLP reduction testcase
@ 2015-05-27 14:00 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2015-05-27 14:00 UTC (permalink / raw)
To: gcc-patches
To cover the case where we need two vectors.
Tested on x86_64-unknown-linux-gnu, applied.
Richard.
2015-05-27 Richard Biener <rguenther@suse.de>
* gcc.dg/vect/slp-reduc-7.c: New testcase.
Index: gcc/testsuite/gcc.dg/vect/slp-reduc-7.c
===================================================================
--- gcc/testsuite/gcc.dg/vect/slp-reduc-7.c (revision 0)
+++ gcc/testsuite/gcc.dg/vect/slp-reduc-7.c (working copy)
@@ -0,0 +1,60 @@
+/* { dg-require-effective-target vect_int } */
+
+#include <stdarg.h>
+#include "tree-vect.h"
+
+#define N 32
+
+unsigned int ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,
+ 0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
+unsigned int uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
+ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
+
+/* Vectorization of reduction using loop-aware SLP (with two copies). */
+
+__attribute__ ((noinline))
+int main1 (int n, int res0, int res1, int res2, int res3,
+ int res4, int res5, int res6, int res7)
+{
+ int i;
+ unsigned int udiff0 = 5, udiff1 = 10, udiff2 = 20, udiff3 = 30;
+ unsigned int udiff4 = 45, udiff5 = 50, udiff6 = 60, udiff7 = 70;
+
+ for (i = 0; i < n; i++) {
+ udiff7 += (ub[8*i + 7] - uc[8*i + 7]);
+ udiff6 += (ub[8*i + 6] - uc[8*i + 6]);
+ udiff5 += (ub[8*i + 5] - uc[8*i + 5]);
+ udiff4 += (ub[8*i + 4] - uc[8*i + 4]);
+ udiff3 += (ub[8*i + 3] - uc[8*i + 3]);
+ udiff2 += (ub[8*i + 2] - uc[8*i + 2]);
+ udiff1 += (ub[8*i + 1] - uc[8*i + 1]);
+ udiff0 += (ub[8*i] - uc[8*i]);
+ }
+
+ /* Check results: */
+ if (udiff0 != res0
+ || udiff1 != res1
+ || udiff2 != res2
+ || udiff3 != res3
+ || udiff4 != res4
+ || udiff5 != res5
+ || udiff6 != res6
+ || udiff7 != res7)
+ abort ();
+
+ return 0;
+}
+
+int main (void)
+{
+ check_vect ();
+
+ main1 (N/8, 37, 50, 68, 86, 109, 122, 140, 158);
+ main1 (N/8 - 1, 21, 32, 48, 64, 85, 96, 112, 128);
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_add } } } */
+/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_no_int_add } } } */
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-05-27 13:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-27 14:00 [PATCH] New SLP reduction testcase Richard Biener
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).