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-21.c | 207 +++++++++++++++++++++++++++++++++++++ 1 file changed, 207 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/vect/slp-21.c (limited to 'gcc/testsuite/gcc.dg/vect/slp-21.c') diff --git a/gcc/testsuite/gcc.dg/vect/slp-21.c b/gcc/testsuite/gcc.dg/vect/slp-21.c new file mode 100644 index 000000000..b4f4e24e0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/slp-21.c @@ -0,0 +1,207 @@ +/* { dg-require-effective-target vect_int } */ + +#include +#include "tree-vect.h" + +#define N 128 + +int +main1 () +{ + unsigned short i; + unsigned short out[N*8], out2[N*8], b0, b1, b2, b3, b4, a0, a1, a2, a3, b5; + unsigned short in[N*8]; + + for (i = 0; i < N*8; i++) + { + in[i] = i; + } + + /* Different operations in both cases - vectorization with interleaving. */ + for (i = 0; i < N; i++) + { + a0 = in[i*4]; + a1 = in[i*4 + 1]; + a2 = in[i*4 + 2]; + a3 = in[i*4 + 3]; + + b0 = a0 * 8; + b1 = a1 + 7; + b2 = a2 + 6; + b3 = a3 * 5; + + b4 = a2 + 4; + b5 = a3 + 3; + + out[i*4] = b0; + out[i*4 + 1] = b1; + out[i*4 + 2] = b2; + out[i*4 + 3] = b3; + + out2[i*4] = b0; + out2[i*4 + 1] = b1; + out2[i*4 + 2] = b4; + out2[i*4 + 3] = b5; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + a0 = in[i*4]; + a1 = in[i*4 + 1]; + a2 = in[i*4 + 2]; + a3 = in[i*4 + 3]; + + b0 = a0 * 8; + b1 = a1 + 7; + b2 = a2 + 6; + b3 = a3 * 5; + + b4 = a2 + 4; + b5 = a3 + 3; + + if (out[i*4] != b0 + || out[i*4 + 1] != b1 + || out[i*4 + 2] != b2 + || out[i*4 + 3] != b3) + abort (); + + if (out2[i*4] != b0 + || out2[i*4 + 1] != b1 + || out2[i*4 + 2] != b4 + || out2[i*4 + 3] != b5) + abort (); + } + + /* Different operations in the first case - vectorization with interleaving. */ + for (i = 0; i < N; i++) + { + a0 = in[i*4]; + a1 = in[i*4 + 1]; + a2 = in[i*4 + 2]; + a3 = in[i*4 + 3]; + + b0 = a0 + 8; + b1 = a1 + 7; + b2 = a2 + 6; + b3 = a3 * 5; + + b4 = a2 + 4; + b5 = a3 + 3; + + out[i*4] = b0; + out[i*4 + 1] = b1; + out[i*4 + 2] = b2; + out[i*4 + 3] = b3; + + out2[i*4] = b0; + out2[i*4 + 1] = b1; + out2[i*4 + 2] = b4; + out2[i*4 + 3] = b5; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + a0 = in[i*4]; + a1 = in[i*4 + 1]; + a2 = in[i*4 + 2]; + a3 = in[i*4 + 3]; + + b0 = a0 + 8; + b1 = a1 + 7; + b2 = a2 + 6; + b3 = a3 * 5; + + b4 = a2 + 4; + b5 = a3 + 3; + + if (out[i*4] != b0 + || out[i*4 + 1] != b1 + || out[i*4 + 2] != b2 + || out[i*4 + 3] != b3) + abort (); + + if (out2[i*4] != b0 + || out2[i*4 + 1] != b1 + || out2[i*4 + 2] != b4 + || out2[i*4 + 3] != b5) + abort (); + } + + + /* Different operations in the second case - vectorization with interleaving. */ + for (i = 0; i < N; i++) + { + a0 = in[i*4]; + a1 = in[i*4 + 1]; + a2 = in[i*4 + 2]; + a3 = in[i*4 + 3]; + + b0 = a0 + 8; + b1 = a1 + 7; + b2 = a2 + 6; + b3 = a3 + 5; + + b4 = a2 * 4; + b5 = a3 + 3; + + out[i*4] = b0; + out[i*4 + 1] = b1; + out[i*4 + 2] = b2; + out[i*4 + 3] = b3; + + out2[i*4] = b0; + out2[i*4 + 1] = b1; + out2[i*4 + 2] = b4; + out2[i*4 + 3] = b5; + } + + /* check results: */ + for (i = 0; i < N; i++) + { + a0 = in[i*4]; + a1 = in[i*4 + 1]; + a2 = in[i*4 + 2]; + a3 = in[i*4 + 3]; + + b0 = a0 + 8; + b1 = a1 + 7; + b2 = a2 + 6; + b3 = a3 + 5; + + b4 = a2 * 4; + b5 = a3 + 3; + + if (out[i*4] != b0 + || out[i*4 + 1] != b1 + || out[i*4 + 2] != b2 + || out[i*4 + 3] != b3) + abort (); + + if (out2[i*4] != b0 + || out2[i*4 + 1] != b1 + || out2[i*4 + 2] != b4 + || out2[i*4 + 3] != b5) + abort (); + } + + + return 0; +} + +int main (void) +{ + check_vect (); + + main1 (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" { target { vect_strided || vect_extract_even_odd } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { ! { vect_strided || vect_extract_even_odd } } } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" { target vect_strided } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { ! { vect_strided } } } } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + -- cgit v1.2.3