Debian Codegraph @

gcc/testsuite/gcc.target/aarch64/pr109072_1.c

raw
1 /* { dg-options "-O2 -fno-schedule-insns -fno-schedule-insns2" } */
2 /* { dg-final { check-function-bodies "**" "" "" { target aarch64_little_endian } } } */
3
4 #include <arm_neon.h>
5
6 /*
7 ** s32x2_1:
8 ** dup v0\.2s, w0
9 ** ret
10 */
11 int32x2_t
12 s32x2_1 (int32_t x)
13 {
14 int32_t arr[] = { x, x };
15 return vld1_s32 (arr);
16 }
17
18 /*
19 ** s32x2_2:
20 ** fmov s0, w0
21 ** ret
22 */
23 int32x2_t
24 s32x2_2 (int32_t x)
25 {
26 int32_t arr[] = { x, 0 };
27 return vld1_s32 (arr);
28 }
29
30 /*
31 ** s32x2_3:
32 ** fmov s0, w0
33 ** ins v0\.s\[1\], w1
34 ** ret
35 */
36 int32x2_t
37 s32x2_3 (int32_t x, int32_t y)
38 {
39 int32_t arr[] = { x, y };
40 return vld1_s32 (arr);
41 }
42
43 /*
44 ** f32x2_1:
45 ** dup v0\.2s, v0.s\[0\]
46 ** ret
47 */
48 float32x2_t
49 f32x2_1 (float32_t x)
50 {
51 float32_t arr[] = { x, x };
52 return vld1_f32 (arr);
53 }
54
55 /*
56 ** f32x2_2:
57 ** uzp1 v0\.2s, v0\.2s, v1\.2s
58 ** ret
59 */
60 float32x2_t
61 f32x2_2 (float32_t x, float32_t y)
62 {
63 float32_t arr[] = { x, y };
64 return vld1_f32 (arr);
65 }
66
67 /*
68 ** s16x4_1:
69 ** dup v0\.4h, w0
70 ** ret
71 */
72 int16x4_t
73 s16x4_1 (int16_t x)
74 {
75 int16_t arr[] = { x, x, x, x };
76 return vld1_s16 (arr);
77 }
78
79 /*
80 PR target/117092
81 ** s16x4_2: { xfail *-*-* }
82 ** ...
83 ** fmov [dsh]0, [wx][0-9]+
84 ** ret
85 */
86 int16x4_t
87 s16x4_2 (int16_t x)
88 {
89 int16_t arr[] = { x, 0, 0, 0 };
90 return vld1_s16 (arr);
91 }
92
93 /*
94 ** s16x4_3:
95 ** dup v0\.4h, w1
96 ** ins v0.h\[0\], w0
97 ** ret
98 */
99 int16x4_t
100 s16x4_3 (int16_t x, int16_t y)
101 {
102 int16_t arr[] = { x, y, y, y };
103 return vld1_s16 (arr);
104 }
105
106 /*
107 ** f16x4_1:
108 ** dup v0\.4h, v0.h\[0\]
109 ** ret
110 */
111 float16x4_t
112 f16x4_1 (float16_t x)
113 {
114 float16_t arr[] = { x, x, x, x };
115 return vld1_f16 (arr);
116 }
117
118 /*
119 ** s64x2_1:
120 ** dup v0\.2d, x0
121 ** ret
122 */
123 int64x2_t
124 s64x2_1 (int64_t x)
125 {
126 int64_t arr[] = { x, x };
127 return vld1q_s64 (arr);
128 }
129
130 /*
131 ** s64x2_2:
132 ** fmov d0, x0
133 ** ret
134 */
135 int64x2_t
136 s64x2_2 (int64_t x)
137 {
138 int64_t arr[] = { x, 0 };
139 return vld1q_s64 (arr);
140 }
141
142 /*
143 ** s64x2_3:
144 ** fmov d0, x0
145 ** ins v0\.d\[1\], x1
146 ** ret
147 */
148 int64x2_t
149 s64x2_3 (int64_t x, int64_t y)
150 {
151 int64_t arr[] = { x, y };
152 return vld1q_s64 (arr);
153 }
154
155 /*
156 ** f64x2_1:
157 ** dup v0\.2d, v0.d\[0\]
158 ** ret
159 */
160 float64x2_t
161 f64x2_1 (float64_t x)
162 {
163 float64_t arr[] = { x, x };
164 return vld1q_f64 (arr);
165 }
166
167 /*
168 ** f64x2_2:
169 ** uzp1 v0\.2d, v0\.2d, v1\.2d
170 ** ret
171 */
172 float64x2_t
173 f64x2_2 (float64_t x, float64_t y)
174 {
175 float64_t arr[] = { x, y };
176 return vld1q_f64 (arr);
177 }
178
179 /*
180 ** s32x4_1:
181 ** dup v0\.4s, w0
182 ** ret
183 */
184 int32x4_t
185 s32x4_1 (int32_t x)
186 {
187 int32_t arr[] = { x, x, x, x };
188 return vld1q_s32 (arr);
189 }
190
191 /*
192 ** s32x4_2: { xfail *-*-* }
193 ** fmov s0, w0
194 ** ret
195 */
196 int32x4_t
197 s32x4_2 (int32_t x)
198 {
199 int32_t arr[] = { x, 0, 0, 0 };
200 return vld1q_s32 (arr);
201 }
202
203 /*
204 ** s32x4_3:
205 ** dup v0\.4s, w1
206 ** ins v0.s\[0\], w0
207 ** ret
208 */
209 int32x4_t
210 s32x4_3 (int32_t x, int32_t y)
211 {
212 int32_t arr[] = { x, y, y, y };
213 return vld1q_s32 (arr);
214 }
215
216 /*
217 ** f32x4_1:
218 ** dup v0\.4s, v0.s\[0\]
219 ** ret
220 */
221 float32x4_t
222 f32x4_1 (float32_t x)
223 {
224 float32_t arr[] = { x, x, x, x };
225 return vld1q_f32 (arr);
226 }
227
228 void consume (float32x4_t, float32x4_t, float32x4_t, float32x4_t);
229
230 /*
231 ** produce_1:
232 ** (
233 ** dup v0\.4s, v0\.s\[0\]
234 ** dup v1\.4s, v1\.s\[0\]
235 ** dup v2\.4s, v2\.s\[0\]
236 ** dup v3\.4s, v3\.s\[0\]
237 ** |
238 ** dup v3\.4s, v3\.s\[0\]
239 ** dup v2\.4s, v2\.s\[0\]
240 ** dup v1\.4s, v1\.s\[0\]
241 ** dup v0\.4s, v0\.s\[0\]
242 ** )
243 ** b consume
244 */
245 void
246 produce_1 (float32_t a, float32_t b, float32_t c, float32_t d)
247 {
248 float arr[4][4] = {
249 { a, a, a, a },
250 { b, b, b, b },
251 { c, c, c, c },
252 { d, d, d, d }
253 };
254 consume (vld1q_f32 (arr[0]), vld1q_f32 (arr[1]),
255 vld1q_f32 (arr[2]), vld1q_f32 (arr[3]));
256 }
257
258 /*
259 ** produce_2:
260 ** (
261 ** dup v0\.4s, v0\.s\[0\]
262 ** dup v1\.4s, v1\.s\[0\]
263 ** dup v2\.4s, v2\.s\[0\]
264 ** dup v3\.4s, v3\.s\[0\]
265 ** |
266 ** dup v3\.4s, v3\.s\[0\]
267 ** dup v2\.4s, v2\.s\[0\]
268 ** dup v1\.4s, v1\.s\[0\]
269 ** dup v0\.4s, v0\.s\[0\]
270 ** )
271 ** b consume
272 */
273 void
274 produce_2 (float32_t a, float32_t b, float32_t c, float32_t d)
275 {
276 float arr0[] = { a, a, a, a };
277 float arr1[] = { b, b, b, b };
278 float arr2[] = { c, c, c, c };
279 float arr3[] = { d, d, d, d };
280 consume (vld1q_f32 (arr0), vld1q_f32 (arr1),
281 vld1q_f32 (arr2), vld1q_f32 (arr3));
282 }