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
4*0a6a1f1dSLionel Sambuc 
5*0a6a1f1dSLionel Sambuc // Test new aarch64 intrinsics and types
6*0a6a1f1dSLionel Sambuc 
7*0a6a1f1dSLionel Sambuc #include <arm_neon.h>
8*0a6a1f1dSLionel Sambuc 
test_vcvtxd_f32_f64(float64_t a)9*0a6a1f1dSLionel Sambuc float32_t test_vcvtxd_f32_f64(float64_t a) {
10*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtxd_f32_f64
11*0a6a1f1dSLionel Sambuc // CHECK: fcvtxn {{s[0-9]+}}, {{d[0-9]+}}
12*0a6a1f1dSLionel Sambuc   return (float32_t)vcvtxd_f32_f64(a);
13*0a6a1f1dSLionel Sambuc }
14*0a6a1f1dSLionel Sambuc 
test_vcvtas_s32_f32(float32_t a)15*0a6a1f1dSLionel Sambuc int32_t test_vcvtas_s32_f32(float32_t a) {
16*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtas_s32_f32
17*0a6a1f1dSLionel Sambuc // CHECK: fcvtas {{[ws][0-9]+}}, {{s[0-9]+}}
18*0a6a1f1dSLionel Sambuc   return (int32_t)vcvtas_s32_f32(a);
19*0a6a1f1dSLionel Sambuc }
20*0a6a1f1dSLionel Sambuc 
test_test_vcvtad_s64_f64(float64_t a)21*0a6a1f1dSLionel Sambuc int64_t test_test_vcvtad_s64_f64(float64_t a) {
22*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_test_vcvtad_s64_f64
23*0a6a1f1dSLionel Sambuc // CHECK: fcvtas {{[dx][0-9]+}}, {{d[0-9]+}}
24*0a6a1f1dSLionel Sambuc   return (int64_t)vcvtad_s64_f64(a);
25*0a6a1f1dSLionel Sambuc }
26*0a6a1f1dSLionel Sambuc 
test_vcvtas_u32_f32(float32_t a)27*0a6a1f1dSLionel Sambuc uint32_t test_vcvtas_u32_f32(float32_t a) {
28*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtas_u32_f32
29*0a6a1f1dSLionel Sambuc // CHECK: fcvtau {{[ws][0-9]+}}, {{s[0-9]+}}
30*0a6a1f1dSLionel Sambuc   return (uint32_t)vcvtas_u32_f32(a);
31*0a6a1f1dSLionel Sambuc }
32*0a6a1f1dSLionel Sambuc 
test_vcvtad_u64_f64(float64_t a)33*0a6a1f1dSLionel Sambuc uint64_t test_vcvtad_u64_f64(float64_t a) {
34*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtad_u64_f64
35*0a6a1f1dSLionel Sambuc // CHECK: fcvtau {{[xd][0-9]+}}, {{d[0-9]+}}
36*0a6a1f1dSLionel Sambuc   return (uint64_t)vcvtad_u64_f64(a);
37*0a6a1f1dSLionel Sambuc }
38*0a6a1f1dSLionel Sambuc 
test_vcvtms_s32_f32(float32_t a)39*0a6a1f1dSLionel Sambuc int32_t test_vcvtms_s32_f32(float32_t a) {
40*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtms_s32_f32
41*0a6a1f1dSLionel Sambuc // CHECK: fcvtms {{[sw][0-9]+}}, {{s[0-9]+}}
42*0a6a1f1dSLionel Sambuc   return (int32_t)vcvtms_s32_f32(a);
43*0a6a1f1dSLionel Sambuc }
44*0a6a1f1dSLionel Sambuc 
test_vcvtmd_s64_f64(float64_t a)45*0a6a1f1dSLionel Sambuc int64_t test_vcvtmd_s64_f64(float64_t a) {
46*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtmd_s64_f64
47*0a6a1f1dSLionel Sambuc // CHECK: fcvtms {{[dx][0-9]+}}, {{d[0-9]+}}
48*0a6a1f1dSLionel Sambuc   return (int64_t)vcvtmd_s64_f64(a);
49*0a6a1f1dSLionel Sambuc }
50*0a6a1f1dSLionel Sambuc 
test_vcvtms_u32_f32(float32_t a)51*0a6a1f1dSLionel Sambuc uint32_t test_vcvtms_u32_f32(float32_t a) {
52*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtms_u32_f32
53*0a6a1f1dSLionel Sambuc // CHECK: fcvtmu {{[ws][0-9]+}}, {{s[0-9]+}}
54*0a6a1f1dSLionel Sambuc   return (uint32_t)vcvtms_u32_f32(a);
55*0a6a1f1dSLionel Sambuc }
56*0a6a1f1dSLionel Sambuc 
test_vcvtmd_u64_f64(float64_t a)57*0a6a1f1dSLionel Sambuc uint64_t test_vcvtmd_u64_f64(float64_t a) {
58*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtmd_u64_f64
59*0a6a1f1dSLionel Sambuc // CHECK: fcvtmu {{[xd][0-9]+}}, {{d[0-9]+}}
60*0a6a1f1dSLionel Sambuc   return (uint64_t)vcvtmd_u64_f64(a);
61*0a6a1f1dSLionel Sambuc }
62*0a6a1f1dSLionel Sambuc 
test_vcvtns_s32_f32(float32_t a)63*0a6a1f1dSLionel Sambuc int32_t test_vcvtns_s32_f32(float32_t a) {
64*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtns_s32_f32
65*0a6a1f1dSLionel Sambuc // CHECK: fcvtns {{[sw][0-9]+}}, {{s[0-9]+}}
66*0a6a1f1dSLionel Sambuc   return (int32_t)vcvtns_s32_f32(a);
67*0a6a1f1dSLionel Sambuc }
68*0a6a1f1dSLionel Sambuc 
test_vcvtnd_s64_f64(float64_t a)69*0a6a1f1dSLionel Sambuc int64_t test_vcvtnd_s64_f64(float64_t a) {
70*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtnd_s64_f64
71*0a6a1f1dSLionel Sambuc // CHECK: fcvtns {{[dx][0-9]+}}, {{d[0-9]+}}
72*0a6a1f1dSLionel Sambuc   return (int64_t)vcvtnd_s64_f64(a);
73*0a6a1f1dSLionel Sambuc }
74*0a6a1f1dSLionel Sambuc 
test_vcvtns_u32_f32(float32_t a)75*0a6a1f1dSLionel Sambuc uint32_t test_vcvtns_u32_f32(float32_t a) {
76*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtns_u32_f32
77*0a6a1f1dSLionel Sambuc // CHECK: fcvtnu {{[sw][0-9]+}}, {{s[0-9]+}}
78*0a6a1f1dSLionel Sambuc   return (uint32_t)vcvtns_u32_f32(a);
79*0a6a1f1dSLionel Sambuc }
80*0a6a1f1dSLionel Sambuc 
test_vcvtnd_u64_f64(float64_t a)81*0a6a1f1dSLionel Sambuc uint64_t test_vcvtnd_u64_f64(float64_t a) {
82*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtnd_u64_f64
83*0a6a1f1dSLionel Sambuc // CHECK: fcvtnu {{[dx][0-9]+}}, {{d[0-9]+}}
84*0a6a1f1dSLionel Sambuc   return (uint64_t)vcvtnd_u64_f64(a);
85*0a6a1f1dSLionel Sambuc }
86*0a6a1f1dSLionel Sambuc 
test_vcvtps_s32_f32(float32_t a)87*0a6a1f1dSLionel Sambuc int32_t test_vcvtps_s32_f32(float32_t a) {
88*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtps_s32_f32
89*0a6a1f1dSLionel Sambuc // CHECK: fcvtps {{[sw][0-9]+}}, {{s[0-9]+}}
90*0a6a1f1dSLionel Sambuc   return (int32_t)vcvtps_s32_f32(a);
91*0a6a1f1dSLionel Sambuc }
92*0a6a1f1dSLionel Sambuc 
test_vcvtpd_s64_f64(float64_t a)93*0a6a1f1dSLionel Sambuc int64_t test_vcvtpd_s64_f64(float64_t a) {
94*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtpd_s64_f64
95*0a6a1f1dSLionel Sambuc // CHECK: fcvtps {{[dx][0-9]+}}, {{d[0-9]+}}
96*0a6a1f1dSLionel Sambuc   return (int64_t)vcvtpd_s64_f64(a);
97*0a6a1f1dSLionel Sambuc }
98*0a6a1f1dSLionel Sambuc 
test_vcvtps_u32_f32(float32_t a)99*0a6a1f1dSLionel Sambuc uint32_t test_vcvtps_u32_f32(float32_t a) {
100*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtps_u32_f32
101*0a6a1f1dSLionel Sambuc // CHECK: fcvtpu {{[sw][0-9]+}}, {{s[0-9]+}}
102*0a6a1f1dSLionel Sambuc   return (uint32_t)vcvtps_u32_f32(a);
103*0a6a1f1dSLionel Sambuc }
104*0a6a1f1dSLionel Sambuc 
test_vcvtpd_u64_f64(float64_t a)105*0a6a1f1dSLionel Sambuc uint64_t test_vcvtpd_u64_f64(float64_t a) {
106*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtpd_u64_f64
107*0a6a1f1dSLionel Sambuc // CHECK: fcvtpu {{[dx][0-9]+}}, {{d[0-9]+}}
108*0a6a1f1dSLionel Sambuc   return (uint64_t)vcvtpd_u64_f64(a);
109*0a6a1f1dSLionel Sambuc }
110*0a6a1f1dSLionel Sambuc 
test_vcvts_s32_f32(float32_t a)111*0a6a1f1dSLionel Sambuc int32_t test_vcvts_s32_f32(float32_t a) {
112*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvts_s32_f32
113*0a6a1f1dSLionel Sambuc // CHECK: fcvtzs {{[sw][0-9]+}}, {{s[0-9]+}}
114*0a6a1f1dSLionel Sambuc   return (int32_t)vcvts_s32_f32(a);
115*0a6a1f1dSLionel Sambuc }
116*0a6a1f1dSLionel Sambuc 
test_vcvtd_s64_f64(float64_t a)117*0a6a1f1dSLionel Sambuc int64_t test_vcvtd_s64_f64(float64_t a) {
118*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtd_s64_f64
119*0a6a1f1dSLionel Sambuc // CHECK: fcvtzs {{[dx][0-9]+}}, {{d[0-9]+}}
120*0a6a1f1dSLionel Sambuc   return (int64_t)vcvtd_s64_f64(a);
121*0a6a1f1dSLionel Sambuc }
122*0a6a1f1dSLionel Sambuc 
test_vcvts_u32_f32(float32_t a)123*0a6a1f1dSLionel Sambuc uint32_t test_vcvts_u32_f32(float32_t a) {
124*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvts_u32_f32
125*0a6a1f1dSLionel Sambuc // CHECK: fcvtzu {{[sw][0-9]+}}, {{s[0-9]+}}
126*0a6a1f1dSLionel Sambuc   return (uint32_t)vcvts_u32_f32(a);
127*0a6a1f1dSLionel Sambuc }
128*0a6a1f1dSLionel Sambuc 
test_vcvtd_u64_f64(float64_t a)129*0a6a1f1dSLionel Sambuc uint64_t test_vcvtd_u64_f64(float64_t a) {
130*0a6a1f1dSLionel Sambuc // CHECK-LABEL: test_vcvtd_u64_f64
131*0a6a1f1dSLionel Sambuc // CHECK: fcvtzu {{[dx][0-9]+}}, {{d[0-9]+}}
132*0a6a1f1dSLionel Sambuc   return (uint64_t)vcvtd_u64_f64(a);
133*0a6a1f1dSLionel Sambuc }
134