Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / vect / slp-20.c
blob5fd85743b5e339d91aa2edb96c9370a250c32dc8
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 128
8 int
9 main1 (unsigned short a0, unsigned short a1, unsigned short a2,
10 unsigned short a3, unsigned short a4, unsigned short a5,
11 unsigned short a6, unsigned short a7, unsigned short a8)
13 int i;
14 unsigned short out[N*8], out2[N*8], b0, b1, b2, b3, b4, b5, b6, b7, b8;
16 for (i = 0; i < N; i++)
18 b0 = a0 + 8;
19 b1 = a1 + 7;
20 b2 = a2 + 6;
21 b3 = a3 + 5;
22 b4 = a4 + 4;
23 b5 = a5 + 3;
25 out[i*4] = b0;
26 out[i*4 + 1] = b1;
27 out[i*4 + 2] = b2;
28 out[i*4 + 3] = b3;
30 out2[i*4] = b0;
31 out2[i*4 + 1] = b1;
32 out2[i*4 + 2] = b4;
33 out2[i*4 + 3] = b5;
36 /* check results: */
37 for (i = 0; i < N; i++)
39 if (out[i*4] != b0
40 || out[i*4 + 1] != b1
41 || out[i*4 + 2] != b2
42 || out[i*4 + 3] != b3)
43 abort ();
45 if (out2[i*4] != b0
46 || out2[i*4 + 1] != b1
47 || out2[i*4 + 2] != b4
48 || out2[i*4 + 3] != b5)
49 abort ();
52 for (i = 0; i < N; i++)
54 b0 = a0 + 8;
55 b1 = a1 + 7;
56 b2 = a2 + 6;
57 b3 = a3 + 5;
58 b4 = a4 + 4;
59 b5 = a5 + 3;
60 b6 = a6 + 2;
61 b7 = a7 + 1;
62 b8 = a8 + 9;
64 out[i*4] = b0;
65 out[i*4 + 1] = b1;
66 out[i*4 + 2] = b2;
67 out[i*4 + 3] = b3;
69 out2[i*8] = b0;
70 out2[i*8 + 1] = b1;
71 out2[i*8 + 2] = b4;
72 out2[i*8 + 3] = b5;
73 out2[i*8 + 4] = b6;
74 out2[i*8 + 5] = b2;
75 out2[i*8 + 6] = b7;
76 out2[i*8 + 7] = b8;
79 /* check results: */
80 for (i = 0; i < N; i++)
82 if (out[i*4] != b0
83 || out[i*4 + 1] != b1
84 || out[i*4 + 2] != b2
85 || out[i*4 + 3] != b3)
86 abort ();
88 if (out2[i*8] != b0
89 || out2[i*8 + 1] != b1
90 || out2[i*8 + 2] != b4
91 || out2[i*8 + 3] != b5
92 || out2[i*8 + 4] != b6
93 || out2[i*8 + 5] != b2
94 || out2[i*8 + 6] != b7
95 || out2[i*8 + 7] != b8)
96 abort ();
100 return 0;
103 int main (void)
105 check_vect ();
107 main1 (8,7,6,5,4,3,2,1,0);
109 return 0;
112 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
113 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */
114 /* { dg-final { cleanup-tree-dump "vect" } } */