1 ; RUN: llc -mtriple=thumbv8.1m.main -mattr=+cdecp0 -mattr=+cdecp1 -mattr=+mve -verify-machineinstrs -o - %s | FileCheck %s
2 ; RUN: llc -mtriple=thumbv8m.main -mattr=+cdecp0 -mattr=+cdecp1 -mattr=+fp-armv8d16sp -verify-machineinstrs -o - %s | FileCheck %s
4 declare float @llvm.arm.cde.vcx1.f32(i32 immarg, i32 immarg)
5 declare float @llvm.arm.cde.vcx1a.f32(i32 immarg, float, i32 immarg)
6 declare float @llvm.arm.cde.vcx2.f32(i32 immarg, float, i32 immarg)
7 declare float @llvm.arm.cde.vcx2a.f32(i32 immarg, float, float, i32 immarg)
8 declare float @llvm.arm.cde.vcx3.f32(i32 immarg, float, float, i32 immarg)
9 declare float @llvm.arm.cde.vcx3a.f32(i32 immarg, float, float, float, i32 immarg)
11 declare double @llvm.arm.cde.vcx1.f64(i32 immarg, i32 immarg)
12 declare double @llvm.arm.cde.vcx1a.f64(i32 immarg, double, i32 immarg)
13 declare double @llvm.arm.cde.vcx2.f64(i32 immarg, double, i32 immarg)
14 declare double @llvm.arm.cde.vcx2a.f64(i32 immarg, double, double, i32 immarg)
15 declare double @llvm.arm.cde.vcx3.f64(i32 immarg, double, double, i32 immarg)
16 declare double @llvm.arm.cde.vcx3a.f64(i32 immarg, double, double, double, i32 immarg)
18 define arm_aapcs_vfpcc i32 @test_vcx1_u32() {
19 ; CHECK-LABEL: test_vcx1_u32:
20 ; CHECK: @ %bb.0: @ %entry
21 ; CHECK-NEXT: vcx1 p0, s0, #11
22 ; CHECK-NEXT: vmov r0, s0
25 %0 = call float @llvm.arm.cde.vcx1.f32(i32 0, i32 11)
26 %1 = bitcast float %0 to i32
30 define arm_aapcs_vfpcc i32 @test_vcx1a_u32(i32 %acc) {
31 ; CHECK-LABEL: test_vcx1a_u32:
32 ; CHECK: @ %bb.0: @ %entry
33 ; CHECK-NEXT: vmov s0, r0
34 ; CHECK-NEXT: vcx1a p1, s0, #12
35 ; CHECK-NEXT: vmov r0, s0
38 %0 = bitcast i32 %acc to float
39 %1 = call float @llvm.arm.cde.vcx1a.f32(i32 1, float %0, i32 12)
40 %2 = bitcast float %1 to i32
44 define arm_aapcs_vfpcc i32 @test_vcx2_u32(i32 %n) {
45 ; CHECK-LABEL: test_vcx2_u32:
46 ; CHECK: @ %bb.0: @ %entry
47 ; CHECK-NEXT: vmov s0, r0
48 ; CHECK-NEXT: vcx2 p0, s0, s0, #21
49 ; CHECK-NEXT: vmov r0, s0
52 %0 = bitcast i32 %n to float
53 %1 = call float @llvm.arm.cde.vcx2.f32(i32 0, float %0, i32 21)
54 %2 = bitcast float %1 to i32
58 define arm_aapcs_vfpcc i32 @test_vcx2a_u32(i32 %acc, i32 %n) {
59 ; CHECK-LABEL: test_vcx2a_u32:
60 ; CHECK: @ %bb.0: @ %entry
61 ; CHECK-NEXT: vmov s0, r1
62 ; CHECK-NEXT: vmov s2, r0
63 ; CHECK-NEXT: vcx2a p0, s2, s0, #22
64 ; CHECK-NEXT: vmov r0, s2
67 %0 = bitcast i32 %acc to float
68 %1 = bitcast i32 %n to float
69 %2 = call float @llvm.arm.cde.vcx2a.f32(i32 0, float %0, float %1, i32 22)
70 %3 = bitcast float %2 to i32
74 define arm_aapcs_vfpcc i32 @test_vcx3_u32(i32 %n, i32 %m) {
75 ; CHECK-LABEL: test_vcx3_u32:
76 ; CHECK: @ %bb.0: @ %entry
77 ; CHECK-NEXT: vmov s0, r1
78 ; CHECK-NEXT: vmov s2, r0
79 ; CHECK-NEXT: vcx3 p1, s0, s2, s0, #3
80 ; CHECK-NEXT: vmov r0, s0
83 %0 = bitcast i32 %n to float
84 %1 = bitcast i32 %m to float
85 %2 = call float @llvm.arm.cde.vcx3.f32(i32 1, float %0, float %1, i32 3)
86 %3 = bitcast float %2 to i32
90 define arm_aapcs_vfpcc i32 @test_vcx3a_u32(i32 %acc, i32 %n, i32 %m) {
91 ; CHECK-LABEL: test_vcx3a_u32:
92 ; CHECK: @ %bb.0: @ %entry
93 ; CHECK-NEXT: vmov s0, r2
94 ; CHECK-NEXT: vmov s2, r1
95 ; CHECK-NEXT: vmov s4, r0
96 ; CHECK-NEXT: vcx3a p0, s4, s2, s0, #5
97 ; CHECK-NEXT: vmov r0, s4
100 %0 = bitcast i32 %acc to float
101 %1 = bitcast i32 %n to float
102 %2 = bitcast i32 %m to float
103 %3 = call float @llvm.arm.cde.vcx3a.f32(i32 0, float %0, float %1, float %2, i32 5)
104 %4 = bitcast float %3 to i32
108 define arm_aapcs_vfpcc i64 @test_vcx1d_u64() {
109 ; CHECK-LABEL: test_vcx1d_u64:
110 ; CHECK: @ %bb.0: @ %entry
111 ; CHECK-NEXT: vcx1 p0, d0, #11
112 ; CHECK-NEXT: vmov r0, r1, d0
115 %0 = call double @llvm.arm.cde.vcx1.f64(i32 0, i32 11)
116 %1 = bitcast double %0 to i64
120 define arm_aapcs_vfpcc i64 @test_vcx1da_u64(i64 %acc) {
121 ; CHECK-LABEL: test_vcx1da_u64:
122 ; CHECK: @ %bb.0: @ %entry
123 ; CHECK-NEXT: vmov d0, r0, r1
124 ; CHECK-NEXT: vcx1a p1, d0, #12
125 ; CHECK-NEXT: vmov r0, r1, d0
128 %0 = bitcast i64 %acc to double
129 %1 = call double @llvm.arm.cde.vcx1a.f64(i32 1, double %0, i32 12)
130 %2 = bitcast double %1 to i64
134 define arm_aapcs_vfpcc i64 @test_vcx2d_u64(i64 %n) {
135 ; CHECK-LABEL: test_vcx2d_u64:
136 ; CHECK: @ %bb.0: @ %entry
137 ; CHECK-NEXT: vmov d0, r0, r1
138 ; CHECK-NEXT: vcx2 p0, d0, d0, #21
139 ; CHECK-NEXT: vmov r0, r1, d0
142 %0 = bitcast i64 %n to double
143 %1 = call double @llvm.arm.cde.vcx2.f64(i32 0, double %0, i32 21)
144 %2 = bitcast double %1 to i64
148 define arm_aapcs_vfpcc i64 @test_vcx2da_u64(i64 %acc, i64 %n) {
149 ; CHECK-LABEL: test_vcx2da_u64:
150 ; CHECK: @ %bb.0: @ %entry
151 ; CHECK-NEXT: vmov d0, r2, r3
152 ; CHECK-NEXT: vmov d1, r0, r1
153 ; CHECK-NEXT: vcx2a p0, d1, d0, #22
154 ; CHECK-NEXT: vmov r0, r1, d1
157 %0 = bitcast i64 %acc to double
158 %1 = bitcast i64 %n to double
159 %2 = call double @llvm.arm.cde.vcx2a.f64(i32 0, double %0, double %1, i32 22)
160 %3 = bitcast double %2 to i64
164 define arm_aapcs_vfpcc i64 @test_vcx3d_u64(i64 %n, i64 %m) {
165 ; CHECK-LABEL: test_vcx3d_u64:
166 ; CHECK: @ %bb.0: @ %entry
167 ; CHECK-NEXT: vmov d0, r2, r3
168 ; CHECK-NEXT: vmov d1, r0, r1
169 ; CHECK-NEXT: vcx3 p1, d0, d1, d0, #3
170 ; CHECK-NEXT: vmov r0, r1, d0
173 %0 = bitcast i64 %n to double
174 %1 = bitcast i64 %m to double
175 %2 = call double @llvm.arm.cde.vcx3.f64(i32 1, double %0, double %1, i32 3)
176 %3 = bitcast double %2 to i64
180 define arm_aapcs_vfpcc i64 @test_vcx3da_u64(i64 %acc, i64 %n, i64 %m) {
181 ; CHECK-LABEL: test_vcx3da_u64:
182 ; CHECK: @ %bb.0: @ %entry
183 ; CHECK-NEXT: push {r7, lr}
184 ; CHECK-NEXT: ldrd lr, r12, [sp, #8]
185 ; CHECK-DAG: vmov [[D0:d.*]], r0, r1
186 ; CHECK-DAG: vmov [[D1:d.*]], r2, r3
187 ; CHECK-DAG: vmov [[D2:d.*]], lr, r12
188 ; CHECK-NEXT: vcx3a p0, [[D0]], [[D1]], [[D2]], #5
189 ; CHECK-NEXT: vmov r0, r1, [[D0]]
190 ; CHECK-NEXT: pop {r7, pc}
192 %0 = bitcast i64 %acc to double
193 %1 = bitcast i64 %n to double
194 %2 = bitcast i64 %m to double
195 %3 = call double @llvm.arm.cde.vcx3a.f64(i32 0, double %0, double %1, double %2, i32 5)
196 %4 = bitcast double %3 to i64