1*0a6a1f1dSLionel Sambuc // REQUIRES: aarch64-registered-target
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
3*0a6a1f1dSLionel Sambuc // RUN: -ffp-contract=fast -S -O3 -o - %s | FileCheck %s --check-prefix=CHECK \
4*0a6a1f1dSLionel Sambuc // RUN: --check-prefix=CHECK-ARM64
5*0a6a1f1dSLionel Sambuc
6*0a6a1f1dSLionel Sambuc // Test new aarch64 intrinsics with poly128
7*0a6a1f1dSLionel Sambuc // FIXME: Currently, poly128_t equals to uint128, which will be spilt into
8*0a6a1f1dSLionel Sambuc // two 64-bit GPR(eg X0, X1). Now moving data from X0, X1 to FPR128 will
9*0a6a1f1dSLionel Sambuc // introduce 2 store and 1 load instructions(store X0, X1 to memory and
10*0a6a1f1dSLionel Sambuc // then load back to Q0). If target has NEON, this is better replaced by
11*0a6a1f1dSLionel Sambuc // FMOV or INS.
12*0a6a1f1dSLionel Sambuc
13*0a6a1f1dSLionel Sambuc #include <arm_neon.h>
14*0a6a1f1dSLionel Sambuc
test_vstrq_p128(poly128_t * ptr,poly128_t val)15*0a6a1f1dSLionel Sambuc void test_vstrq_p128(poly128_t * ptr, poly128_t val) {
16*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vstrq_p128
17*0a6a1f1dSLionel Sambuc vstrq_p128(ptr, val);
18*0a6a1f1dSLionel Sambuc
19*0a6a1f1dSLionel Sambuc // CHECK-ARM64: stp {{x[0-9]+}}, {{x[0-9]+}}, [x0]
20*0a6a1f1dSLionel Sambuc }
21*0a6a1f1dSLionel Sambuc
test_vldrq_p128(poly128_t * ptr)22*0a6a1f1dSLionel Sambuc poly128_t test_vldrq_p128(poly128_t * ptr) {
23*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vldrq_p128
24*0a6a1f1dSLionel Sambuc return vldrq_p128(ptr);
25*0a6a1f1dSLionel Sambuc
26*0a6a1f1dSLionel Sambuc // CHECK-ARM64: ldp {{x[0-9]+}}, {{x[0-9]+}}, [x0]
27*0a6a1f1dSLionel Sambuc }
28*0a6a1f1dSLionel Sambuc
test_ld_st_p128(poly128_t * ptr)29*0a6a1f1dSLionel Sambuc void test_ld_st_p128(poly128_t * ptr) {
30*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_ld_st_p128
31*0a6a1f1dSLionel Sambuc vstrq_p128(ptr+1, vldrq_p128(ptr));
32*0a6a1f1dSLionel Sambuc
33*0a6a1f1dSLionel Sambuc // CHECK-ARM64: ldp [[PLO:x[0-9]+]], [[PHI:x[0-9]+]], [{{x[0-9]+}}]
34*0a6a1f1dSLionel Sambuc // CHECK-ARM64-NEXT: stp [[PLO]], [[PHI]], [{{x[0-9]+}}, #16]
35*0a6a1f1dSLionel Sambuc }
36*0a6a1f1dSLionel Sambuc
test_vmull_p64(poly64_t a,poly64_t b)37*0a6a1f1dSLionel Sambuc poly128_t test_vmull_p64(poly64_t a, poly64_t b) {
38*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vmull_p64
39*0a6a1f1dSLionel Sambuc return vmull_p64(a, b);
40*0a6a1f1dSLionel Sambuc // CHECK: pmull {{v[0-9]+}}.1q, {{v[0-9]+}}.1d, {{v[0-9]+}}.1d
41*0a6a1f1dSLionel Sambuc }
42*0a6a1f1dSLionel Sambuc
test_vmull_high_p64(poly64x2_t a,poly64x2_t b)43*0a6a1f1dSLionel Sambuc poly128_t test_vmull_high_p64(poly64x2_t a, poly64x2_t b) {
44*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vmull_high_p64
45*0a6a1f1dSLionel Sambuc return vmull_high_p64(a, b);
46*0a6a1f1dSLionel Sambuc // CHECK: pmull2 {{v[0-9]+}}.1q, {{v[0-9]+}}.2d, {{v[0-9]+}}.2d
47*0a6a1f1dSLionel Sambuc }
48*0a6a1f1dSLionel Sambuc
49*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_s8
50*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_s8(int8x16_t a)51*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_s8(int8x16_t a) {
52*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_s8(a);
53*0a6a1f1dSLionel Sambuc }
54*0a6a1f1dSLionel Sambuc
55*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_s16
56*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_s16(int16x8_t a)57*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_s16(int16x8_t a) {
58*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_s16(a);
59*0a6a1f1dSLionel Sambuc }
60*0a6a1f1dSLionel Sambuc
61*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_s32
62*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_s32(int32x4_t a)63*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_s32(int32x4_t a) {
64*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_s32(a);
65*0a6a1f1dSLionel Sambuc }
66*0a6a1f1dSLionel Sambuc
67*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_s64
68*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_s64(int64x2_t a)69*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_s64(int64x2_t a) {
70*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_s64(a);
71*0a6a1f1dSLionel Sambuc }
72*0a6a1f1dSLionel Sambuc
73*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_u8
74*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_u8(uint8x16_t a)75*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_u8(uint8x16_t a) {
76*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_u8(a);
77*0a6a1f1dSLionel Sambuc }
78*0a6a1f1dSLionel Sambuc
79*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_u16
80*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_u16(uint16x8_t a)81*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_u16(uint16x8_t a) {
82*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_u16(a);
83*0a6a1f1dSLionel Sambuc }
84*0a6a1f1dSLionel Sambuc
85*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_u32
86*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_u32(uint32x4_t a)87*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_u32(uint32x4_t a) {
88*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_u32(a);
89*0a6a1f1dSLionel Sambuc }
90*0a6a1f1dSLionel Sambuc
91*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_u64
92*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_u64(uint64x2_t a)93*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_u64(uint64x2_t a) {
94*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_u64(a);
95*0a6a1f1dSLionel Sambuc }
96*0a6a1f1dSLionel Sambuc
97*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_f32
98*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_f32(float32x4_t a)99*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_f32(float32x4_t a) {
100*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_f32(a);
101*0a6a1f1dSLionel Sambuc }
102*0a6a1f1dSLionel Sambuc
103*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_f64
104*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_f64(float64x2_t a)105*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_f64(float64x2_t a) {
106*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_f64(a);
107*0a6a1f1dSLionel Sambuc }
108*0a6a1f1dSLionel Sambuc
109*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_p8
110*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_p8(poly8x16_t a)111*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_p8(poly8x16_t a) {
112*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_p8(a);
113*0a6a1f1dSLionel Sambuc }
114*0a6a1f1dSLionel Sambuc
115*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_p16
116*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_p16(poly16x8_t a)117*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_p16(poly16x8_t a) {
118*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_p16(a);
119*0a6a1f1dSLionel Sambuc }
120*0a6a1f1dSLionel Sambuc
121*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p128_p64
122*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p128_p64(poly64x2_t a)123*0a6a1f1dSLionel Sambuc poly128_t test_vreinterpretq_p128_p64(poly64x2_t a) {
124*0a6a1f1dSLionel Sambuc return vreinterpretq_p128_p64(a);
125*0a6a1f1dSLionel Sambuc }
126*0a6a1f1dSLionel Sambuc
127*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_s8_p128
128*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_s8_p128(poly128_t a)129*0a6a1f1dSLionel Sambuc int8x16_t test_vreinterpretq_s8_p128(poly128_t a) {
130*0a6a1f1dSLionel Sambuc return vreinterpretq_s8_p128(a);
131*0a6a1f1dSLionel Sambuc }
132*0a6a1f1dSLionel Sambuc
133*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_s16_p128
134*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_s16_p128(poly128_t a)135*0a6a1f1dSLionel Sambuc int16x8_t test_vreinterpretq_s16_p128(poly128_t a) {
136*0a6a1f1dSLionel Sambuc return vreinterpretq_s16_p128(a);
137*0a6a1f1dSLionel Sambuc }
138*0a6a1f1dSLionel Sambuc
139*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_s32_p128
140*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_s32_p128(poly128_t a)141*0a6a1f1dSLionel Sambuc int32x4_t test_vreinterpretq_s32_p128(poly128_t a) {
142*0a6a1f1dSLionel Sambuc return vreinterpretq_s32_p128(a);
143*0a6a1f1dSLionel Sambuc }
144*0a6a1f1dSLionel Sambuc
145*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_s64_p128
146*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_s64_p128(poly128_t a)147*0a6a1f1dSLionel Sambuc int64x2_t test_vreinterpretq_s64_p128(poly128_t a) {
148*0a6a1f1dSLionel Sambuc return vreinterpretq_s64_p128(a);
149*0a6a1f1dSLionel Sambuc }
150*0a6a1f1dSLionel Sambuc
151*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_u8_p128
152*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_u8_p128(poly128_t a)153*0a6a1f1dSLionel Sambuc uint8x16_t test_vreinterpretq_u8_p128(poly128_t a) {
154*0a6a1f1dSLionel Sambuc return vreinterpretq_u8_p128(a);
155*0a6a1f1dSLionel Sambuc }
156*0a6a1f1dSLionel Sambuc
157*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_u16_p128
158*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_u16_p128(poly128_t a)159*0a6a1f1dSLionel Sambuc uint16x8_t test_vreinterpretq_u16_p128(poly128_t a) {
160*0a6a1f1dSLionel Sambuc return vreinterpretq_u16_p128(a);
161*0a6a1f1dSLionel Sambuc }
162*0a6a1f1dSLionel Sambuc
163*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_u32_p128
164*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_u32_p128(poly128_t a)165*0a6a1f1dSLionel Sambuc uint32x4_t test_vreinterpretq_u32_p128(poly128_t a) {
166*0a6a1f1dSLionel Sambuc return vreinterpretq_u32_p128(a);
167*0a6a1f1dSLionel Sambuc }
168*0a6a1f1dSLionel Sambuc
169*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_u64_p128
170*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_u64_p128(poly128_t a)171*0a6a1f1dSLionel Sambuc uint64x2_t test_vreinterpretq_u64_p128(poly128_t a) {
172*0a6a1f1dSLionel Sambuc return vreinterpretq_u64_p128(a);
173*0a6a1f1dSLionel Sambuc }
174*0a6a1f1dSLionel Sambuc
175*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_f32_p128
176*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_f32_p128(poly128_t a)177*0a6a1f1dSLionel Sambuc float32x4_t test_vreinterpretq_f32_p128(poly128_t a) {
178*0a6a1f1dSLionel Sambuc return vreinterpretq_f32_p128(a);
179*0a6a1f1dSLionel Sambuc }
180*0a6a1f1dSLionel Sambuc
181*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_f64_p128
182*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_f64_p128(poly128_t a)183*0a6a1f1dSLionel Sambuc float64x2_t test_vreinterpretq_f64_p128(poly128_t a) {
184*0a6a1f1dSLionel Sambuc return vreinterpretq_f64_p128(a);
185*0a6a1f1dSLionel Sambuc }
186*0a6a1f1dSLionel Sambuc
187*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p8_p128
188*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p8_p128(poly128_t a)189*0a6a1f1dSLionel Sambuc poly8x16_t test_vreinterpretq_p8_p128(poly128_t a) {
190*0a6a1f1dSLionel Sambuc return vreinterpretq_p8_p128(a);
191*0a6a1f1dSLionel Sambuc }
192*0a6a1f1dSLionel Sambuc
193*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p16_p128
194*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p16_p128(poly128_t a)195*0a6a1f1dSLionel Sambuc poly16x8_t test_vreinterpretq_p16_p128(poly128_t a) {
196*0a6a1f1dSLionel Sambuc return vreinterpretq_p16_p128(a);
197*0a6a1f1dSLionel Sambuc }
198*0a6a1f1dSLionel Sambuc
199*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vreinterpretq_p64_p128
200*0a6a1f1dSLionel Sambuc // CHECK: ret
test_vreinterpretq_p64_p128(poly128_t a)201*0a6a1f1dSLionel Sambuc poly64x2_t test_vreinterpretq_p64_p128(poly128_t a) {
202*0a6a1f1dSLionel Sambuc return vreinterpretq_p64_p128(a);
203*0a6a1f1dSLionel Sambuc }
204*0a6a1f1dSLionel Sambuc
205*0a6a1f1dSLionel Sambuc
206