1 // REQUIRES: aarch64-registered-target
2 // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
3 // RUN: -ffp-contract=fast -S -O3 -o - %s | FileCheck %s --check-prefix=CHECK \
4 // RUN: --check-prefix=CHECK-ARM64
5
6 // Test new aarch64 intrinsics with poly64
7
8 #include <arm_neon.h>
9
test_vceq_p64(poly64x1_t a,poly64x1_t b)10 uint64x1_t test_vceq_p64(poly64x1_t a, poly64x1_t b) {
11 // CHECK-LABEL: test_vceq_p64
12 return vceq_p64(a, b);
13 // CHECK: cmeq {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}
14 }
15
test_vceqq_p64(poly64x2_t a,poly64x2_t b)16 uint64x2_t test_vceqq_p64(poly64x2_t a, poly64x2_t b) {
17 // CHECK-LABEL: test_vceqq_p64
18 return vceqq_p64(a, b);
19 // CHECK: cmeq {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
20 }
21
test_vtst_p64(poly64x1_t a,poly64x1_t b)22 uint64x1_t test_vtst_p64(poly64x1_t a, poly64x1_t b) {
23 // CHECK-LABEL: test_vtst_p64
24 return vtst_p64(a, b);
25 // CHECK: cmtst {{d[0-9]+}}, {{d[0-9]+}}, {{d[0-9]+}}
26 }
27
test_vtstq_p64(poly64x2_t a,poly64x2_t b)28 uint64x2_t test_vtstq_p64(poly64x2_t a, poly64x2_t b) {
29 // CHECK-LABEL: test_vtstq_p64
30 return vtstq_p64(a, b);
31 // CHECK: cmtst {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
32 }
33
test_vbsl_p64(poly64x1_t a,poly64x1_t b,poly64x1_t c)34 poly64x1_t test_vbsl_p64(poly64x1_t a, poly64x1_t b, poly64x1_t c) {
35 // CHECK-LABEL: test_vbsl_p64
36 return vbsl_p64(a, b, c);
37 // CHECK: bsl {{v[0-9]+}}.8b, {{v[0-9]+}}.8b, {{v[0-9]+}}.8b
38 }
39
test_vbslq_p64(poly64x2_t a,poly64x2_t b,poly64x2_t c)40 poly64x2_t test_vbslq_p64(poly64x2_t a, poly64x2_t b, poly64x2_t c) {
41 // CHECK-LABEL: test_vbslq_p64
42 return vbslq_p64(a, b, c);
43 // CHECK: bsl {{v[0-9]+}}.16b, {{v[0-9]+}}.16b, {{v[0-9]+}}.16b
44 }
45
test_vget_lane_p64(poly64x1_t v)46 poly64_t test_vget_lane_p64(poly64x1_t v) {
47 // CHECK-LABEL: test_vget_lane_p64
48 return vget_lane_p64(v, 0);
49 // CHECK: fmov {{x[0-9]+}}, {{d[0-9]+}}
50 }
51
test_vgetq_lane_p64(poly64x2_t v)52 poly64_t test_vgetq_lane_p64(poly64x2_t v) {
53 // CHECK-LABEL: test_vgetq_lane_p64
54 return vgetq_lane_p64(v, 1);
55 // CHECK: {{mov|umov}} {{x[0-9]+}}, {{v[0-9]+}}.d[1]
56 }
57
test_vset_lane_p64(poly64_t a,poly64x1_t v)58 poly64x1_t test_vset_lane_p64(poly64_t a, poly64x1_t v) {
59 // CHECK-LABEL: test_vset_lane_p64
60 return vset_lane_p64(a, v, 0);
61 // CHECK: fmov {{d[0-9]+}}, {{x[0-9]+}}
62 }
63
test_vsetq_lane_p64(poly64_t a,poly64x2_t v)64 poly64x2_t test_vsetq_lane_p64(poly64_t a, poly64x2_t v) {
65 // CHECK-LABEL: test_vsetq_lane_p64
66 return vsetq_lane_p64(a, v, 1);
67 // CHECK: ins {{v[0-9]+}}.d[1], {{x[0-9]+}}
68 }
69
test_vcopy_lane_p64(poly64x1_t a,poly64x1_t b)70 poly64x1_t test_vcopy_lane_p64(poly64x1_t a, poly64x1_t b) {
71 // CHECK-LABEL: test_vcopy_lane_p64
72 return vcopy_lane_p64(a, 0, b, 0);
73
74 // CHECK-ARM64: mov v0.16b, v1.16b
75 }
76
test_vcopyq_lane_p64(poly64x2_t a,poly64x1_t b)77 poly64x2_t test_vcopyq_lane_p64(poly64x2_t a, poly64x1_t b) {
78 // CHECK-LABEL: test_vcopyq_lane_p64
79 return vcopyq_lane_p64(a, 1, b, 0);
80 // CHECK: ins {{v[0-9]+}}.d[1], {{v[0-9]+}}.d[0]
81 }
82
test_vcopyq_laneq_p64(poly64x2_t a,poly64x2_t b)83 poly64x2_t test_vcopyq_laneq_p64(poly64x2_t a, poly64x2_t b) {
84 // CHECK-LABEL: test_vcopyq_laneq_p64
85 return vcopyq_laneq_p64(a, 1, b, 1);
86 }
87
test_vcreate_p64(uint64_t a)88 poly64x1_t test_vcreate_p64(uint64_t a) {
89 // CHECK-LABEL: test_vcreate_p64
90 return vcreate_p64(a);
91 // CHECK: fmov {{d[0-9]+}}, {{x[0-9]+}}
92 }
93
test_vdup_n_p64(poly64_t a)94 poly64x1_t test_vdup_n_p64(poly64_t a) {
95 // CHECK-LABEL: test_vdup_n_p64
96 return vdup_n_p64(a);
97 // CHECK: fmov {{d[0-9]+}}, {{x[0-9]+}}
98 }
test_vdupq_n_p64(poly64_t a)99 poly64x2_t test_vdupq_n_p64(poly64_t a) {
100 // CHECK-LABEL: test_vdupq_n_p64
101 return vdupq_n_p64(a);
102 // CHECK: dup {{v[0-9]+}}.2d, {{x[0-9]+}}
103 }
104
test_vmov_n_p64(poly64_t a)105 poly64x1_t test_vmov_n_p64(poly64_t a) {
106 // CHECK-LABEL: test_vmov_n_p64
107 return vmov_n_p64(a);
108 // CHECK: fmov {{d[0-9]+}}, {{x[0-9]+}}
109 }
110
test_vmovq_n_p64(poly64_t a)111 poly64x2_t test_vmovq_n_p64(poly64_t a) {
112 // CHECK-LABEL: test_vmovq_n_p64
113 return vmovq_n_p64(a);
114 // CHECK: dup {{v[0-9]+}}.2d, {{x[0-9]+}}
115 }
116
test_vdup_lane_p64(poly64x1_t vec)117 poly64x1_t test_vdup_lane_p64(poly64x1_t vec) {
118 // CHECK-LABEL: test_vdup_lane_p64
119 return vdup_lane_p64(vec, 0);
120 // CHECK: ret
121 }
122
test_vdupq_lane_p64(poly64x1_t vec)123 poly64x2_t test_vdupq_lane_p64(poly64x1_t vec) {
124 // CHECK-LABEL: test_vdupq_lane_p64
125 return vdupq_lane_p64(vec, 0);
126 // CHECK: dup {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
127 }
128
test_vdupq_laneq_p64(poly64x2_t vec)129 poly64x2_t test_vdupq_laneq_p64(poly64x2_t vec) {
130 // CHECK-LABEL: test_vdupq_laneq_p64
131 return vdupq_laneq_p64(vec, 1);
132 // CHECK: dup {{v[0-9]+}}.2d, {{v[0-9]+}}.d[1]
133 }
134
test_vcombine_p64(poly64x1_t low,poly64x1_t high)135 poly64x2_t test_vcombine_p64(poly64x1_t low, poly64x1_t high) {
136 // CHECK-LABEL: test_vcombine_p64
137 return vcombine_p64(low, high);
138 // CHECK: ins {{v[0-9]+}}.d[1], {{v[0-9]+}}.d[0]
139 }
140
test_vld1_p64(poly64_t const * ptr)141 poly64x1_t test_vld1_p64(poly64_t const * ptr) {
142 // CHECK-LABEL: test_vld1_p64
143 return vld1_p64(ptr);
144 // CHECK-ARM64: ldr {{d[0-9]+}}, [{{x[0-9]+|sp}}]
145 }
146
test_vld1q_p64(poly64_t const * ptr)147 poly64x2_t test_vld1q_p64(poly64_t const * ptr) {
148 // CHECK-LABEL: test_vld1q_p64
149 return vld1q_p64(ptr);
150 // CHECK-ARM64: ldr {{q[0-9]+}}, [{{x[0-9]+|sp}}]
151 }
152
test_vst1_p64(poly64_t * ptr,poly64x1_t val)153 void test_vst1_p64(poly64_t * ptr, poly64x1_t val) {
154 // CHECK-LABEL: test_vst1_p64
155 return vst1_p64(ptr, val);
156 // CHECK-ARM64: str {{d[0-9]+}}, [{{x[0-9]+|sp}}]
157 }
158
test_vst1q_p64(poly64_t * ptr,poly64x2_t val)159 void test_vst1q_p64(poly64_t * ptr, poly64x2_t val) {
160 // CHECK-LABEL: test_vst1q_p64
161 return vst1q_p64(ptr, val);
162 // CHECK-ARM64: str {{q[0-9]+}}, [{{x[0-9]+|sp}}]
163 }
164
test_vld2_p64(poly64_t const * ptr)165 poly64x1x2_t test_vld2_p64(poly64_t const * ptr) {
166 // CHECK-LABEL: test_vld2_p64
167 return vld2_p64(ptr);
168 // CHECK: ld1 {{{ *v[0-9]+.1d, v[0-9]+.1d *}}}, [{{x[0-9]+|sp}}]
169 }
170
test_vld2q_p64(poly64_t const * ptr)171 poly64x2x2_t test_vld2q_p64(poly64_t const * ptr) {
172 // CHECK-LABEL: test_vld2q_p64
173 return vld2q_p64(ptr);
174 // CHECK: ld2 {{{ *v[0-9]+.2d, v[0-9]+.2d *}}}, [{{x[0-9]+|sp}}]
175 }
176
test_vld3_p64(poly64_t const * ptr)177 poly64x1x3_t test_vld3_p64(poly64_t const * ptr) {
178 // CHECK-LABEL: test_vld3_p64
179 return vld3_p64(ptr);
180 // CHECK: ld1 {{{ *v[0-9]+.1d, v[0-9]+.1d, v[0-9]+.1d *}}}, [{{x[0-9]+|sp}}]
181 }
182
test_vld3q_p64(poly64_t const * ptr)183 poly64x2x3_t test_vld3q_p64(poly64_t const * ptr) {
184 // CHECK-LABEL: test_vld3q_p64
185 return vld3q_p64(ptr);
186 // CHECK: ld3 {{{ *v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d *}}}, [{{x[0-9]+|sp}}]
187 }
188
test_vld4_p64(poly64_t const * ptr)189 poly64x1x4_t test_vld4_p64(poly64_t const * ptr) {
190 // CHECK-LABEL: test_vld4_p64
191 return vld4_p64(ptr);
192 // CHECK: ld1 {{{ *v[0-9]+.1d, v[0-9]+.1d, v[0-9]+.1d, v[0-9]+.1d *}}}, [{{x[0-9]+|sp}}]
193 }
194
test_vld4q_p64(poly64_t const * ptr)195 poly64x2x4_t test_vld4q_p64(poly64_t const * ptr) {
196 // CHECK-LABEL: test_vld4q_p64
197 return vld4q_p64(ptr);
198 // CHECK: ld4 {{{ *v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d *}}}, [{{x[0-9]+|sp}}]
199 }
200
test_vst2_p64(poly64_t * ptr,poly64x1x2_t val)201 void test_vst2_p64(poly64_t * ptr, poly64x1x2_t val) {
202 // CHECK-LABEL: test_vst2_p64
203 return vst2_p64(ptr, val);
204 // CHECK: st1 {{{ *v[0-9]+.1d, v[0-9]+.1d *}}}, [{{x[0-9]+|sp}}]
205 }
206
test_vst2q_p64(poly64_t * ptr,poly64x2x2_t val)207 void test_vst2q_p64(poly64_t * ptr, poly64x2x2_t val) {
208 // CHECK-LABEL: test_vst2q_p64
209 return vst2q_p64(ptr, val);
210 // CHECK: st2 {{{ *v[0-9]+.2d, v[0-9]+.2d *}}}, [{{x[0-9]+|sp}}]
211 }
212
test_vst3_p64(poly64_t * ptr,poly64x1x3_t val)213 void test_vst3_p64(poly64_t * ptr, poly64x1x3_t val) {
214 // CHECK-LABEL: test_vst3_p64
215 return vst3_p64(ptr, val);
216 // CHECK: st1 {{{ *v[0-9]+.1d, v[0-9]+.1d, v[0-9]+.1d *}}}, [{{x[0-9]+|sp}}]
217 }
218
test_vst3q_p64(poly64_t * ptr,poly64x2x3_t val)219 void test_vst3q_p64(poly64_t * ptr, poly64x2x3_t val) {
220 // CHECK-LABEL: test_vst3q_p64
221 return vst3q_p64(ptr, val);
222 // CHECK: st3 {{{ *v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d *}}}, [{{x[0-9]+|sp}}]
223 }
224
test_vst4_p64(poly64_t * ptr,poly64x1x4_t val)225 void test_vst4_p64(poly64_t * ptr, poly64x1x4_t val) {
226 // CHECK-LABEL: test_vst4_p64
227 return vst4_p64(ptr, val);
228 // CHECK: st1 {{{ *v[0-9]+.1d, v[0-9]+.1d, v[0-9]+.1d, v[0-9]+.1d *}}}, [{{x[0-9]+|sp}}]
229 }
230
test_vst4q_p64(poly64_t * ptr,poly64x2x4_t val)231 void test_vst4q_p64(poly64_t * ptr, poly64x2x4_t val) {
232 // CHECK-LABEL: test_vst4q_p64
233 return vst4q_p64(ptr, val);
234 // CHECK: st4 {{{ *v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d *}}}, [{{x[0-9]+|sp}}]
235 }
236
test_vext_p64(poly64x1_t a,poly64x1_t b)237 poly64x1_t test_vext_p64(poly64x1_t a, poly64x1_t b) {
238 // CHECK-LABEL: test_vext_p64
239 return vext_u64(a, b, 0);
240
241 }
242
test_vextq_p64(poly64x2_t a,poly64x2_t b)243 poly64x2_t test_vextq_p64(poly64x2_t a, poly64x2_t b) {
244 // CHECK-LABEL: test_vextq_p64
245 return vextq_p64(a, b, 1);
246 // CHECK: ext {{v[0-9]+}}.16b, {{v[0-9]+}}.16b, {{v[0-9]+}}.16b, {{#0x8|#8}}
247 }
248
test_vzip1q_p64(poly64x2_t a,poly64x2_t b)249 poly64x2_t test_vzip1q_p64(poly64x2_t a, poly64x2_t b) {
250 // CHECK-LABEL: test_vzip1q_p64
251 return vzip1q_p64(a, b);
252 // CHECK-ARM64: zip1 {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
253 }
254
test_vzip2q_p64(poly64x2_t a,poly64x2_t b)255 poly64x2_t test_vzip2q_p64(poly64x2_t a, poly64x2_t b) {
256 // CHECK-LABEL: test_vzip2q_p64
257 return vzip2q_u64(a, b);
258 // CHECK-ARM64: zip2 {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
259 }
260
test_vuzp1q_p64(poly64x2_t a,poly64x2_t b)261 poly64x2_t test_vuzp1q_p64(poly64x2_t a, poly64x2_t b) {
262 // CHECK-LABEL: test_vuzp1q_p64
263 return vuzp1q_p64(a, b);
264 // CHECK-ARM64: zip1 {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
265 }
266
test_vuzp2q_p64(poly64x2_t a,poly64x2_t b)267 poly64x2_t test_vuzp2q_p64(poly64x2_t a, poly64x2_t b) {
268 // CHECK-LABEL: test_vuzp2q_p64
269 return vuzp2q_u64(a, b);
270 // CHECK-ARM64: zip2 {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
271 }
272
test_vtrn1q_p64(poly64x2_t a,poly64x2_t b)273 poly64x2_t test_vtrn1q_p64(poly64x2_t a, poly64x2_t b) {
274 // CHECK-LABEL: test_vtrn1q_p64
275 return vtrn1q_p64(a, b);
276 // CHECK-ARM64: zip1 {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
277 }
278
test_vtrn2q_p64(poly64x2_t a,poly64x2_t b)279 poly64x2_t test_vtrn2q_p64(poly64x2_t a, poly64x2_t b) {
280 // CHECK-LABEL: test_vtrn2q_p64
281 return vtrn2q_u64(a, b);
282 // CHECK-ARM64: zip2 {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
283 }
284
test_vsri_n_p64(poly64x1_t a,poly64x1_t b)285 poly64x1_t test_vsri_n_p64(poly64x1_t a, poly64x1_t b) {
286 // CHECK-LABEL: test_vsri_n_p64
287 return vsri_n_p64(a, b, 33);
288 // CHECK: sri {{d[0-9]+}}, {{d[0-9]+}}, #33
289 }
290
test_vsriq_n_p64(poly64x2_t a,poly64x2_t b)291 poly64x2_t test_vsriq_n_p64(poly64x2_t a, poly64x2_t b) {
292 // CHECK-LABEL: test_vsriq_n_p64
293 return vsriq_n_p64(a, b, 64);
294 // CHECK: sri {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, #64
295 }
296
297