From: Richard Biener Date: Wed, 27 May 2015 13:50:50 +0000 (+0000) Subject: slp-reduc-7.c: New testcase. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d586cedd4c86b8a57827e10fd3ec532fe6fa15ae;p=gcc.git slp-reduc-7.c: New testcase. 2015-05-27 Richard Biener * gcc.dg/vect/slp-reduc-7.c: New testcase. From-SVN: r223756 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4119cb8be62..5b9be3fa2db 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-05-27 Richard Biener + + * gcc.dg/vect/slp-reduc-7.c: New testcase. + 2015-05-27 Honggyu Kim PR target/65358 diff --git a/gcc/testsuite/gcc.dg/vect/slp-reduc-7.c b/gcc/testsuite/gcc.dg/vect/slp-reduc-7.c new file mode 100644 index 00000000000..113785e3015 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-reduc-7.c @@ -0,0 +1,60 @@ +/* { dg-require-effective-target vect_int } */ + +#include +#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" } } */ +