From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gcc.dg/vect/slp-2.c | 145 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/slp-2.c (limited to 'gcc/testsuite/gcc.dg/vect/slp-2.c') diff --git a/gcc/testsuite/gcc.dg/vect/slp-2.c b/gcc/testsuite/gcc.dg/vect/slp-2.c new file mode 100644 index 000000000..69e1ed5e0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-2.c @@ -0,0 +1,145 @@ +/* { dg-require-effective-target vect_int } */ + +#include +#include "tree-vect.h" + +#define N 128 + +int +main1 (unsigned short a0, unsigned short a1, unsigned short a2, + unsigned short a3, unsigned short a4, unsigned short a5, + unsigned short a6, unsigned short a7, unsigned short a8, + unsigned short a9, unsigned short a10, unsigned short a11, + unsigned short a12, unsigned short a13, unsigned short a14, + unsigned short a15) +{ + int i; + unsigned short out[N*16]; + + for (i = 0; i < N; i++) + { + out[i*4] = a8; + out[i*4 + 1] = a1; + out[i*4 + 2] = a2; + out[i*4 + 3] = a3; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i*4] != a8 + || out[i*4 + 1] != a1 + || out[i*4 + 2] != a2 + || out[i*4 + 3] != a3) + abort (); + } + + for (i = 0; i < N; i++) + { + out[i*16] = a8; + out[i*16 + 1] = a7; + out[i*16 + 2] = a1; + out[i*16 + 3] = a2; + out[i*16 + 4] = a8; + out[i*16 + 5] = a5; + out[i*16 + 6] = a5; + out[i*16 + 7] = a4; + out[i*16 + 8] = a12; + out[i*16 + 9] = a13; + out[i*16 + 10] = a14; + out[i*16 + 11] = a15; + out[i*16 + 12] = a6; + out[i*16 + 13] = a9; + out[i*16 + 14] = a0; + out[i*16 + 15] = a7; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i*16] != a8 + || out[i*16 + 1] != a7 + || out[i*16 + 2] != a1 + || out[i*16 + 3] != a2 + || out[i*16 + 4] != a8 + || out[i*16 + 5] != a5 + || out[i*16 + 6] != a5 + || out[i*16 + 7] != a4 + || out[i*16 + 8] != a12 + || out[i*16 + 9] != a13 + || out[i*16 + 10] != a14 + || out[i*16 + 11] != a15 + || out[i*16 + 12] != a6 + || out[i*16 + 13] != a9 + || out[i*16 + 14] != a0 + || out[i*16 + 15] != a7) + abort (); + } + + /* SLP with unrolling by 8. */ + for (i = 0; i < N; i++) + { + out[i*3] = a8; + out[i*3 + 1] = a1; + out[i*3 + 2] = a2; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i*3] != a8 + || out[i*3 + 1] != a1 + || out[i*3 + 2] != a2) + abort (); + } + + /* SLP with unrolling by 8. */ + for (i = 0; i < N; i++) + { + out[i*11] = a8; + out[i*11 + 1] = a7; + out[i*11 + 2] = a1; + out[i*11 + 3] = a2; + out[i*11 + 4] = a8; + out[i*11 + 5] = a5; + out[i*11 + 6] = a5; + out[i*11 + 7] = a4; + out[i*11 + 8] = a12; + out[i*11 + 9] = a13; + out[i*11 + 10] = a14; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + if (out[i*11] != a8 + || out[i*11 + 1] != a7 + || out[i*11 + 2] != a1 + || out[i*11 + 3] != a2 + || out[i*11 + 4] != a8 + || out[i*11 + 5] != a5 + || out[i*11 + 6] != a5 + || out[i*11 + 7] != a4 + || out[i*11 + 8] != a12 + || out[i*11 + 9] != a13 + || out[i*11 + 10] != a14) + abort (); + } + + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + -- cgit v1.2.3