1 ; RUN: llc < %s -mtriple=aarch64-eabi -mattr=+v8.2a,+fullfp16 | FileCheck %s
3 declare i64 @llvm.aarch64.neon.fcvtpu.i64.f16(half)
4 declare i32 @llvm.aarch64.neon.fcvtpu.i32.f16(half)
5 declare i64 @llvm.aarch64.neon.fcvtps.i64.f16(half)
6 declare i32 @llvm.aarch64.neon.fcvtps.i32.f16(half)
7 declare i64 @llvm.aarch64.neon.fcvtnu.i64.f16(half)
8 declare i32 @llvm.aarch64.neon.fcvtnu.i32.f16(half)
9 declare i64 @llvm.aarch64.neon.fcvtns.i64.f16(half)
10 declare i32 @llvm.aarch64.neon.fcvtns.i32.f16(half)
11 declare i64 @llvm.aarch64.neon.fcvtmu.i64.f16(half)
12 declare i32 @llvm.aarch64.neon.fcvtmu.i32.f16(half)
13 declare i64 @llvm.aarch64.neon.fcvtms.i64.f16(half)
14 declare i32 @llvm.aarch64.neon.fcvtms.i32.f16(half)
15 declare i64 @llvm.aarch64.neon.fcvtau.i64.f16(half)
16 declare i32 @llvm.aarch64.neon.fcvtau.i32.f16(half)
17 declare i64 @llvm.aarch64.neon.fcvtas.i64.f16(half)
18 declare i32 @llvm.aarch64.neon.fcvtas.i32.f16(half)
19 declare half @llvm.aarch64.neon.frsqrte.f16(half)
20 declare half @llvm.aarch64.neon.frecpx.f16(half)
21 declare half @llvm.aarch64.neon.frecpe.f16(half)
23 define dso_local i16 @t2(half %a) {
25 ; CHECK: fcmp h0, #0.0
26 ; CHECK-NEXT: csetm w0, eq
29 %0 = fcmp oeq half %a, 0xH0000
30 %vceqz = sext i1 %0 to i16
34 define dso_local i16 @t3(half %a) {
36 ; CHECK: fcmp h0, #0.0
37 ; CHECK-NEXT: csetm w0, ge
40 %0 = fcmp oge half %a, 0xH0000
41 %vcgez = sext i1 %0 to i16
45 define dso_local i16 @t4(half %a) {
47 ; CHECK: fcmp h0, #0.0
48 ; CHECK-NEXT: csetm w0, gt
51 %0 = fcmp ogt half %a, 0xH0000
52 %vcgtz = sext i1 %0 to i16
56 define dso_local i16 @t5(half %a) {
58 ; CHECK: fcmp h0, #0.0
59 ; CHECK-NEXT: csetm w0, ls
62 %0 = fcmp ole half %a, 0xH0000
63 %vclez = sext i1 %0 to i16
67 define dso_local i16 @t6(half %a) {
69 ; CHECK: fcmp h0, #0.0
70 ; CHECK-NEXT: csetm w0, mi
73 %0 = fcmp olt half %a, 0xH0000
74 %vcltz = sext i1 %0 to i16
78 define dso_local half @t8(i32 %a) {
83 %0 = sitofp i32 %a to half
87 define dso_local half @t9(i64 %a) {
92 %0 = sitofp i64 %a to half
96 define dso_local half @t12(i64 %a) {
101 %0 = uitofp i64 %a to half
105 define dso_local i16 @t13(half %a) {
107 ; CHECK: fcvtzs w0, h0
110 %0 = fptosi half %a to i16
114 define dso_local i64 @t15(half %a) {
116 ; CHECK: fcvtzs x0, h0
119 %0 = fptosi half %a to i64
123 define dso_local i16 @t16(half %a) {
125 ; CHECK: fcvtzs w0, h0
128 %0 = fptoui half %a to i16
132 define dso_local i64 @t18(half %a) {
134 ; CHECK: fcvtzu x0, h0
137 %0 = fptoui half %a to i64
141 define dso_local i16 @t19(half %a) {
143 ; CHECK: fcvtas w0, h0
146 %fcvt = tail call i32 @llvm.aarch64.neon.fcvtas.i32.f16(half %a)
147 %0 = trunc i32 %fcvt to i16
151 define dso_local i64 @t21(half %a) {
153 ; CHECK: fcvtas x0, h0
156 %vcvtah_s64_f16 = tail call i64 @llvm.aarch64.neon.fcvtas.i64.f16(half %a)
157 ret i64 %vcvtah_s64_f16
160 define dso_local i16 @t22(half %a) {
162 ; CHECK: fcvtau w0, h0
165 %fcvt = tail call i32 @llvm.aarch64.neon.fcvtau.i32.f16(half %a)
166 %0 = trunc i32 %fcvt to i16
170 define dso_local i64 @t24(half %a) {
172 ; CHECK: fcvtau x0, h0
175 %vcvtah_u64_f16 = tail call i64 @llvm.aarch64.neon.fcvtau.i64.f16(half %a)
176 ret i64 %vcvtah_u64_f16
179 define dso_local i16 @t25(half %a) {
181 ; CHECK: fcvtms w0, h0
184 %fcvt = tail call i32 @llvm.aarch64.neon.fcvtms.i32.f16(half %a)
185 %0 = trunc i32 %fcvt to i16
189 define dso_local i64 @t27(half %a) {
191 ; CHECK: fcvtms x0, h0
194 %vcvtmh_s64_f16 = tail call i64 @llvm.aarch64.neon.fcvtms.i64.f16(half %a)
195 ret i64 %vcvtmh_s64_f16
198 define dso_local i16 @t28(half %a) {
200 ; CHECK: fcvtmu w0, h0
203 %fcvt = tail call i32 @llvm.aarch64.neon.fcvtmu.i32.f16(half %a)
204 %0 = trunc i32 %fcvt to i16
208 define dso_local i64 @t30(half %a) {
210 ; CHECK: fcvtmu x0, h0
213 %vcvtmh_u64_f16 = tail call i64 @llvm.aarch64.neon.fcvtmu.i64.f16(half %a)
214 ret i64 %vcvtmh_u64_f16
217 define dso_local i16 @t31(half %a) {
219 ; CHECK: fcvtns w0, h0
222 %fcvt = tail call i32 @llvm.aarch64.neon.fcvtns.i32.f16(half %a)
223 %0 = trunc i32 %fcvt to i16
227 define dso_local i64 @t33(half %a) {
229 ; CHECK: fcvtns x0, h0
232 %vcvtnh_s64_f16 = tail call i64 @llvm.aarch64.neon.fcvtns.i64.f16(half %a)
233 ret i64 %vcvtnh_s64_f16
236 define dso_local i16 @t34(half %a) {
238 ; CHECK: fcvtnu w0, h0
241 %fcvt = tail call i32 @llvm.aarch64.neon.fcvtnu.i32.f16(half %a)
242 %0 = trunc i32 %fcvt to i16
246 define dso_local i64 @t36(half %a) {
248 ; CHECK: fcvtnu x0, h0
251 %vcvtnh_u64_f16 = tail call i64 @llvm.aarch64.neon.fcvtnu.i64.f16(half %a)
252 ret i64 %vcvtnh_u64_f16
255 define dso_local i16 @t37(half %a) {
257 ; CHECK: fcvtps w0, h0
260 %fcvt = tail call i32 @llvm.aarch64.neon.fcvtps.i32.f16(half %a)
261 %0 = trunc i32 %fcvt to i16
265 define dso_local i64 @t39(half %a) {
267 ; CHECK: fcvtps x0, h0
270 %vcvtph_s64_f16 = tail call i64 @llvm.aarch64.neon.fcvtps.i64.f16(half %a)
271 ret i64 %vcvtph_s64_f16
274 define dso_local i16 @t40(half %a) {
276 ; CHECK: fcvtpu w0, h0
279 %fcvt = tail call i32 @llvm.aarch64.neon.fcvtpu.i32.f16(half %a)
280 %0 = trunc i32 %fcvt to i16
284 define dso_local i64 @t42(half %a) {
286 ; CHECK: fcvtpu x0, h0
289 %vcvtph_u64_f16 = tail call i64 @llvm.aarch64.neon.fcvtpu.i64.f16(half %a)
290 ret i64 %vcvtph_u64_f16
293 define dso_local half @t44(half %a) {
295 ; CHECK: frecpe h0, h0
298 %vrecpeh_f16 = tail call half @llvm.aarch64.neon.frecpe.f16(half %a)
299 ret half %vrecpeh_f16
302 define dso_local half @t45(half %a) {
304 ; CHECK: frecpx h0, h0
307 %vrecpxh_f16 = tail call half @llvm.aarch64.neon.frecpx.f16(half %a)
308 ret half %vrecpxh_f16
311 define dso_local half @t53(half %a) {
313 ; CHECK: frsqrte h0, h0
316 %vrsqrteh_f16 = tail call half @llvm.aarch64.neon.frsqrte.f16(half %a)
317 ret half %vrsqrteh_f16