comparison gcc/testsuite/gcc.dg/vect/slp-22.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 128
7
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)
12 {
13 int i;
14 unsigned short out[N*8], out2[N*8], out3[N*8], b0, b1, b2, b3, b4, b5, b6, b7, b8;
15
16 for (i = 0; i < N; i++)
17 {
18 b0 = a0 + 8;
19 b1 = a1 + 7;
20 b2 = a2 + 6;
21 b3 = a3 + 5;
22 b4 = a4 + 4;
23 b5 = a5 + 3;
24
25 out[i*4] = b0;
26 out[i*4 + 1] = b1;
27 out[i*4 + 2] = b2;
28 out[i*4 + 3] = b3;
29
30 out2[i*4] = b0;
31 out2[i*4 + 1] = b1;
32 out2[i*4 + 2] = b4;
33 out2[i*4 + 3] = b5;
34
35 out3[i*4] = b2;
36 out3[i*4 + 1] = b1;
37 out3[i*4 + 2] = b4;
38 out3[i*4 + 3] = b5;
39 }
40
41 /* check results: */
42 for (i = 0; i < N; i++)
43 {
44 if (out[i*4] != b0
45 || out[i*4 + 1] != b1
46 || out[i*4 + 2] != b2
47 || out[i*4 + 3] != b3)
48 abort ();
49
50
51 if (out2[i*4] != b0
52 || out2[i*4 + 1] != b1
53 || out2[i*4 + 2] != b4
54 || out2[i*4 + 3] != b5)
55 abort ();
56
57 if (out3[i*4] != b2
58 || out3[i*4 + 1] != b1
59 || out3[i*4 + 2] != b4
60 || out3[i*4 + 3] != b5)
61 abort ();
62 }
63
64 for (i = 0; i < N; i++)
65 {
66 b0 = a0 + 8;
67 b1 = a1 + 7;
68 b2 = a2 + 6;
69 b3 = a3 + 5;
70 b4 = a4 + 4;
71 b5 = a5 + 3;
72 b6 = a6 + 2;
73 b7 = a7 + 1;
74 b8 = a8 + 9;
75
76 out[i*4] = b0;
77 out[i*4 + 1] = b1;
78 out[i*4 + 2] = b2;
79 out[i*4 + 3] = b3;
80
81 out2[i*8] = b0;
82 out2[i*8 + 1] = b1;
83 out2[i*8 + 2] = b4;
84 out2[i*8 + 3] = b5;
85 out2[i*8 + 4] = b6;
86 out2[i*8 + 5] = b2;
87 out2[i*8 + 6] = b7;
88 out2[i*8 + 7] = b8;
89
90 out3[2*i + 1] = a0;
91 out3[2*i] = b8;
92 }
93
94 /* check results: */
95 for (i = 0; i < N; i++)
96 {
97 if (out[i*4] != b0
98 || out[i*4 + 1] != b1
99 || out[i*4 + 2] != b2
100 || out[i*4 + 3] != b3)
101 abort ();
102
103 if (out2[i*8] != b0
104 || out2[i*8 + 1] != b1
105 || out2[i*8 + 2] != b4
106 || out2[i*8 + 3] != b5
107 || out2[i*8 + 4] != b6
108 || out2[i*8 + 5] != b2
109 || out2[i*8 + 6] != b7
110 || out2[i*8 + 7] != b8)
111 abort ();
112
113 if (out3[2*i] != b8
114 || out3[2*i+1] != a0)
115 abort();
116 }
117
118
119 return 0;
120 }
121
122 int main (void)
123 {
124 check_vect ();
125
126 main1 (8,7,6,5,4,3,2,1,0);
127
128 return 0;
129 }
130
131 /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */
132 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 6 "vect" } } */
133