Debian Codegraph @

gcc/testsuite/gcc.target/riscv/rvv/autovec/struct/struct_vect-6.c

raw
1 /* { dg-do compile } */
2 /* { dg-additional-options "-std=c99 -march=rv32gcv_zvfh -mabi=ilp32d -mrvv-vector-bits=scalable -fno-vect-cost-model" } */
3
4 #include <stdint-gcc.h>
5
6 #ifndef TYPE
7 #define TYPE uint8_t
8 #define ITYPE int8_t
9 #endif
10
11 void __attribute__ ((noinline, noclone))
12 f2 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c, ITYPE n)
13 {
14 for (ITYPE i = 0; i < n; ++i)
15 {
16 a[i] = c[i * 2];
17 b[i] = c[i * 2 + 1];
18 }
19 }
20
21 void __attribute__ ((noinline, noclone))
22 f3 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
23 TYPE *__restrict d, ITYPE n)
24 {
25 for (ITYPE i = 0; i < n; ++i)
26 {
27 a[i] = d[i * 3];
28 b[i] = d[i * 3 + 1];
29 c[i] = d[i * 3 + 2];
30 }
31 }
32
33 void __attribute__ ((noinline, noclone))
34 f4 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
35 TYPE *__restrict d, TYPE *__restrict e, ITYPE n)
36 {
37 for (ITYPE i = 0; i < n; ++i)
38 {
39 a[i] = e[i * 4];
40 b[i] = e[i * 4 + 1];
41 c[i] = e[i * 4 + 2];
42 d[i] = e[i * 4 + 3];
43 }
44 }
45
46 void __attribute__ ((noinline, noclone))
47 f5 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
48 TYPE *__restrict d, TYPE *__restrict e, TYPE *__restrict f, ITYPE n)
49 {
50 for (ITYPE i = 0; i < n; ++i)
51 {
52 a[i] = f[i * 5];
53 b[i] = f[i * 5 + 1];
54 c[i] = f[i * 5 + 2];
55 d[i] = f[i * 5 + 3];
56 e[i] = f[i * 5 + 4];
57 }
58 }
59
60 void __attribute__ ((noinline, noclone))
61 f6 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
62 TYPE *__restrict d, TYPE *__restrict e, TYPE *__restrict f,
63 TYPE *__restrict g, ITYPE n)
64 {
65 for (ITYPE i = 0; i < n; ++i)
66 {
67 a[i] = g[i * 6];
68 b[i] = g[i * 6 + 1];
69 c[i] = g[i * 6 + 2];
70 d[i] = g[i * 6 + 3];
71 e[i] = g[i * 6 + 4];
72 f[i] = g[i * 6 + 5];
73 }
74 }
75
76 void __attribute__ ((noinline, noclone))
77 f7 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
78 TYPE *__restrict d, TYPE *__restrict e, TYPE *__restrict f,
79 TYPE *__restrict g, TYPE *__restrict h, ITYPE n)
80 {
81 for (ITYPE i = 0; i < n; ++i)
82 {
83 a[i] = h[i * 7];
84 b[i] = h[i * 7 + 1];
85 c[i] = h[i * 7 + 2];
86 d[i] = h[i * 7 + 3];
87 e[i] = h[i * 7 + 4];
88 f[i] = h[i * 7 + 5];
89 g[i] = h[i * 7 + 6];
90 }
91 }
92
93 void __attribute__ ((noinline, noclone))
94 f8 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
95 TYPE *__restrict d, TYPE *__restrict e, TYPE *__restrict f,
96 TYPE *__restrict g, TYPE *__restrict h, TYPE *__restrict j, ITYPE n)
97 {
98 for (ITYPE i = 0; i < n; ++i)
99 {
100 a[i] = j[i * 8];
101 b[i] = j[i * 8 + 1];
102 c[i] = j[i * 8 + 2];
103 d[i] = j[i * 8 + 3];
104 e[i] = j[i * 8 + 4];
105 f[i] = j[i * 8 + 5];
106 g[i] = j[i * 8 + 6];
107 h[i] = j[i * 8 + 7];
108 }
109 }
110
111 void __attribute__ ((noinline, noclone))
112 g2 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c, ITYPE n)
113 {
114 for (ITYPE i = 0; i < n; ++i)
115 {
116 c[i * 2] = a[i];
117 c[i * 2 + 1] = b[i];
118 }
119 }
120
121 void __attribute__ ((noinline, noclone))
122 g3 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
123 TYPE *__restrict d, ITYPE n)
124 {
125 for (ITYPE i = 0; i < n; ++i)
126 {
127 d[i * 3] = a[i];
128 d[i * 3 + 1] = b[i];
129 d[i * 3 + 2] = c[i];
130 }
131 }
132
133 void __attribute__ ((noinline, noclone))
134 g4 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
135 TYPE *__restrict d, TYPE *__restrict e, ITYPE n)
136 {
137 for (ITYPE i = 0; i < n; ++i)
138 {
139 e[i * 4] = a[i];
140 e[i * 4 + 1] = b[i];
141 e[i * 4 + 2] = c[i];
142 e[i * 4 + 3] = d[i];
143 }
144 }
145
146 void __attribute__ ((noinline, noclone))
147 g5 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
148 TYPE *__restrict d, TYPE *__restrict e, TYPE *__restrict f, ITYPE n)
149 {
150 for (ITYPE i = 0; i < n; ++i)
151 {
152 f[i * 5] = a[i];
153 f[i * 5 + 1] = b[i];
154 f[i * 5 + 2] = c[i];
155 f[i * 5 + 3] = d[i];
156 f[i * 5 + 4] = e[i];
157 }
158 }
159
160 void __attribute__ ((noinline, noclone))
161 g6 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
162 TYPE *__restrict d, TYPE *__restrict e, TYPE *__restrict f,
163 TYPE *__restrict g, ITYPE n)
164 {
165 for (ITYPE i = 0; i < n; ++i)
166 {
167 g[i * 6] = a[i];
168 g[i * 6 + 1] = b[i];
169 g[i * 6 + 2] = c[i];
170 g[i * 6 + 3] = d[i];
171 g[i * 6 + 4] = e[i];
172 g[i * 6 + 5] = f[i];
173 }
174 }
175
176 void __attribute__ ((noinline, noclone))
177 g7 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
178 TYPE *__restrict d, TYPE *__restrict e, TYPE *__restrict f,
179 TYPE *__restrict g, TYPE *__restrict h, ITYPE n)
180 {
181 for (ITYPE i = 0; i < n; ++i)
182 {
183 h[i * 7] = a[i];
184 h[i * 7 + 1] = b[i];
185 h[i * 7 + 2] = c[i];
186 h[i * 7 + 3] = d[i];
187 h[i * 7 + 4] = e[i];
188 h[i * 7 + 5] = f[i];
189 h[i * 7 + 6] = g[i];
190 }
191 }
192
193 void __attribute__ ((noinline, noclone))
194 g8 (TYPE *__restrict a, TYPE *__restrict b, TYPE *__restrict c,
195 TYPE *__restrict d, TYPE *__restrict e, TYPE *__restrict f,
196 TYPE *__restrict g, TYPE *__restrict h, TYPE *__restrict j, ITYPE n)
197 {
198 for (ITYPE i = 0; i < n; ++i)
199 {
200 j[i * 8] = a[i];
201 j[i * 8 + 1] = b[i];
202 j[i * 8 + 2] = c[i];
203 j[i * 8 + 3] = d[i];
204 j[i * 8 + 4] = e[i];
205 j[i * 8 + 5] = f[i];
206 j[i * 8 + 6] = g[i];
207 j[i * 8 + 7] = h[i];
208 }
209 }
210
211 /* { dg-final { scan-assembler-times {vlseg2e8\.v} 1 } } */
212 /* { dg-final { scan-assembler-times {vlseg3e8\.v} 1 } } */
213 /* { dg-final { scan-assembler-times {vlseg4e8\.v} 1 } } */
214 /* { dg-final { scan-assembler-times {vlseg5e8\.v} 1 } } */
215 /* { dg-final { scan-assembler-times {vlseg6e8\.v} 1 } } */
216 /* { dg-final { scan-assembler-times {vlseg7e8\.v} 1 } } */
217 /* { dg-final { scan-assembler-times {vlseg8e8\.v} 1 } } */
218 /* { dg-final { scan-assembler-times {vsseg2e8\.v} 1 } } */
219 /* { dg-final { scan-assembler-times {vsseg3e8\.v} 1 } } */
220 /* { dg-final { scan-assembler-times {vsseg4e8\.v} 1 } } */
221 /* { dg-final { scan-assembler-times {vsseg5e8\.v} 1 } } */
222 /* { dg-final { scan-assembler-times {vsseg6e8\.v} 1 } } */
223 /* { dg-final { scan-assembler-times {vsseg7e8\.v} 1 } } */
224 /* { dg-final { scan-assembler-times {vsseg8e8\.v} 1 } } */
225 /* { dg-final { scan-assembler-times {vsetvli\s+[a-x0-9]+,\s*[a-x0-9]+,\s*e8,\s*m1,\s*t[au],\s*m[au]} 14 } } */