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
10uint64x1_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
16uint64x2_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
22uint64x1_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
28uint64x2_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
34poly64x1_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
40poly64x2_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
46poly64_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
52poly64_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
58poly64x1_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
64poly64x2_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
70poly64x1_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
77poly64x2_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
83poly64x2_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
88poly64x1_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
94poly64x1_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}
99poly64x2_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
105poly64x1_t test_vdup_lane_p64(poly64x1_t vec) {
106  // CHECK-LABEL: test_vdup_lane_p64
107  return vdup_lane_p64(vec, 0);
108  // CHECK: ret
109}
110
111poly64x2_t test_vdupq_lane_p64(poly64x1_t vec) {
112  // CHECK-LABEL: test_vdupq_lane_p64
113  return vdupq_lane_p64(vec, 0);
114  // CHECK: dup {{v[0-9]+}}.2d, {{v[0-9]+}}.d[0]
115}
116
117poly64x2_t test_vdupq_laneq_p64(poly64x2_t vec) {
118  // CHECK-LABEL: test_vdupq_laneq_p64
119  return vdupq_laneq_p64(vec, 1);
120  // CHECK: dup {{v[0-9]+}}.2d, {{v[0-9]+}}.d[1]
121}
122
123poly64x2_t test_vcombine_p64(poly64x1_t low, poly64x1_t high) {
124  // CHECK-LABEL: test_vcombine_p64
125  return vcombine_p64(low, high);
126  // CHECK: ins {{v[0-9]+}}.d[1], {{v[0-9]+}}.d[0]
127}
128
129poly64x1_t test_vld1_p64(poly64_t const * ptr) {
130  // CHECK-LABEL: test_vld1_p64
131  return vld1_p64(ptr);
132  // CHECK-ARM64: ldr {{d[0-9]+}}, [{{x[0-9]+|sp}}]
133}
134
135poly64x2_t test_vld1q_p64(poly64_t const * ptr) {
136  // CHECK-LABEL: test_vld1q_p64
137  return vld1q_p64(ptr);
138  // CHECK-ARM64: ldr {{q[0-9]+}}, [{{x[0-9]+|sp}}]
139}
140
141void test_vst1_p64(poly64_t * ptr, poly64x1_t val) {
142  // CHECK-LABEL: test_vst1_p64
143  return vst1_p64(ptr, val);
144  // CHECK-ARM64: str {{d[0-9]+}}, [{{x[0-9]+|sp}}]
145}
146
147void test_vst1q_p64(poly64_t * ptr, poly64x2_t val) {
148  // CHECK-LABEL: test_vst1q_p64
149  return vst1q_p64(ptr, val);
150  // CHECK-ARM64: str {{q[0-9]+}}, [{{x[0-9]+|sp}}]
151}
152
153poly64x1x2_t test_vld2_p64(poly64_t const * ptr) {
154  // CHECK-LABEL: test_vld2_p64
155  return vld2_p64(ptr);
156  // CHECK: ld1 {{{ *v[0-9]+.1d, v[0-9]+.1d *}}}, [{{x[0-9]+|sp}}]
157}
158
159poly64x2x2_t test_vld2q_p64(poly64_t const * ptr) {
160  // CHECK-LABEL: test_vld2q_p64
161  return vld2q_p64(ptr);
162  // CHECK: ld2 {{{ *v[0-9]+.2d, v[0-9]+.2d *}}}, [{{x[0-9]+|sp}}]
163}
164
165poly64x1x3_t test_vld3_p64(poly64_t const * ptr) {
166  // CHECK-LABEL: test_vld3_p64
167  return vld3_p64(ptr);
168  // CHECK: ld1 {{{ *v[0-9]+.1d, v[0-9]+.1d, v[0-9]+.1d *}}}, [{{x[0-9]+|sp}}]
169}
170
171poly64x2x3_t test_vld3q_p64(poly64_t const * ptr) {
172  // CHECK-LABEL: test_vld3q_p64
173  return vld3q_p64(ptr);
174  // CHECK: ld3 {{{ *v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d *}}}, [{{x[0-9]+|sp}}]
175}
176
177poly64x1x4_t test_vld4_p64(poly64_t const * ptr) {
178  // CHECK-LABEL: test_vld4_p64
179  return vld4_p64(ptr);
180  // CHECK: ld1 {{{ *v[0-9]+.1d, v[0-9]+.1d, v[0-9]+.1d, v[0-9]+.1d *}}}, [{{x[0-9]+|sp}}]
181}
182
183poly64x2x4_t test_vld4q_p64(poly64_t const * ptr) {
184  // CHECK-LABEL: test_vld4q_p64
185  return vld4q_p64(ptr);
186  // CHECK: ld4 {{{ *v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d *}}}, [{{x[0-9]+|sp}}]
187}
188
189void test_vst2_p64(poly64_t * ptr, poly64x1x2_t val) {
190  // CHECK-LABEL: test_vst2_p64
191  return vst2_p64(ptr, val);
192  // CHECK:  st1 {{{ *v[0-9]+.1d, v[0-9]+.1d *}}}, [{{x[0-9]+|sp}}]
193}
194
195void test_vst2q_p64(poly64_t * ptr, poly64x2x2_t val) {
196  // CHECK-LABEL: test_vst2q_p64
197  return vst2q_p64(ptr, val);
198  // CHECK:  st2 {{{ *v[0-9]+.2d, v[0-9]+.2d *}}}, [{{x[0-9]+|sp}}]
199}
200
201void test_vst3_p64(poly64_t * ptr, poly64x1x3_t val) {
202  // CHECK-LABEL: test_vst3_p64
203  return vst3_p64(ptr, val);
204  // CHECK:  st1 {{{ *v[0-9]+.1d, v[0-9]+.1d, v[0-9]+.1d *}}}, [{{x[0-9]+|sp}}]
205}
206
207void test_vst3q_p64(poly64_t * ptr, poly64x2x3_t val) {
208  // CHECK-LABEL: test_vst3q_p64
209  return vst3q_p64(ptr, val);
210  // CHECK:  st3 {{{ *v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d *}}}, [{{x[0-9]+|sp}}]
211}
212
213void test_vst4_p64(poly64_t * ptr, poly64x1x4_t val) {
214  // CHECK-LABEL: test_vst4_p64
215  return vst4_p64(ptr, val);
216  // CHECK:  st1 {{{ *v[0-9]+.1d, v[0-9]+.1d, v[0-9]+.1d, v[0-9]+.1d *}}}, [{{x[0-9]+|sp}}]
217}
218
219void test_vst4q_p64(poly64_t * ptr, poly64x2x4_t val) {
220  // CHECK-LABEL: test_vst4q_p64
221  return vst4q_p64(ptr, val);
222  // CHECK:  st4 {{{ *v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d, v[0-9]+.2d *}}}, [{{x[0-9]+|sp}}]
223}
224
225poly64x1_t test_vext_p64(poly64x1_t a, poly64x1_t b) {
226  // CHECK-LABEL: test_vext_p64
227  return vext_u64(a, b, 0);
228
229}
230
231poly64x2_t test_vextq_p64(poly64x2_t a, poly64x2_t b) {
232  // CHECK-LABEL: test_vextq_p64
233  return vextq_p64(a, b, 1);
234  // CHECK: ext {{v[0-9]+}}.16b, {{v[0-9]+}}.16b, {{v[0-9]+}}.16b, {{#0x8|#8}}
235}
236
237poly64x2_t test_vzip1q_p64(poly64x2_t a, poly64x2_t b) {
238  // CHECK-LABEL: test_vzip1q_p64
239  return vzip1q_p64(a, b);
240  // CHECK-ARM64: zip1 {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
241}
242
243poly64x2_t test_vzip2q_p64(poly64x2_t a, poly64x2_t b) {
244  // CHECK-LABEL: test_vzip2q_p64
245  return vzip2q_u64(a, b);
246  // CHECK-ARM64: zip2 {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
247}
248
249poly64x2_t test_vuzp1q_p64(poly64x2_t a, poly64x2_t b) {
250  // CHECK-LABEL: test_vuzp1q_p64
251  return vuzp1q_p64(a, b);
252  // CHECK-ARM64: zip1 {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
253}
254
255poly64x2_t test_vuzp2q_p64(poly64x2_t a, poly64x2_t b) {
256  // CHECK-LABEL: test_vuzp2q_p64
257  return vuzp2q_u64(a, b);
258  // CHECK-ARM64: zip2 {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
259}
260
261poly64x2_t test_vtrn1q_p64(poly64x2_t a, poly64x2_t b) {
262  // CHECK-LABEL: test_vtrn1q_p64
263  return vtrn1q_p64(a, b);
264  // CHECK-ARM64: zip1 {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
265}
266
267poly64x2_t test_vtrn2q_p64(poly64x2_t a, poly64x2_t b) {
268  // CHECK-LABEL: test_vtrn2q_p64
269  return vtrn2q_u64(a, b);
270  // CHECK-ARM64: zip2 {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
271}
272
273poly64x1_t test_vsri_n_p64(poly64x1_t a, poly64x1_t b) {
274  // CHECK-LABEL: test_vsri_n_p64
275  return vsri_n_p64(a, b, 33);
276  // CHECK: sri {{d[0-9]+}}, {{d[0-9]+}}, #33
277}
278
279poly64x2_t test_vsriq_n_p64(poly64x2_t a, poly64x2_t b) {
280  // CHECK-LABEL: test_vsriq_n_p64
281  return vsriq_n_p64(a, b, 64);
282  // CHECK: sri {{v[0-9]+}}.2d, {{v[0-9]+}}.2d, #64
283}
284
285