1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=aarch64-eabi -mattr=+v8.2a,+fullfp16 | FileCheck %s
4 declare half @llvm.aarch64.sisd.fabd.f16(half, half)
5 declare half @llvm.aarch64.neon.fmax.f16(half, half)
6 declare half @llvm.aarch64.neon.fmin.f16(half, half)
7 declare half @llvm.aarch64.neon.frsqrts.f16(half, half)
8 declare half @llvm.aarch64.neon.frecps.f16(half, half)
9 declare half @llvm.aarch64.neon.fmulx.f16(half, half)
10 declare half @llvm.fabs.f16(half)
11 declare i32 @llvm.aarch64.neon.facge.i32.f16(half, half)
12 declare i32 @llvm.aarch64.neon.facgt.i32.f16(half, half)
14 define dso_local half @t_vabdh_f16(half %a, half %b) {
15 ; CHECK-LABEL: t_vabdh_f16:
16 ; CHECK: // %bb.0: // %entry
17 ; CHECK-NEXT: fabd h0, h0, h1
20 %vabdh_f16 = tail call half @llvm.aarch64.sisd.fabd.f16(half %a, half %b)
24 define dso_local half @t_vabdh_f16_from_fsub_fabs(half %a, half %b) {
25 ; CHECK-LABEL: t_vabdh_f16_from_fsub_fabs:
26 ; CHECK: // %bb.0: // %entry
27 ; CHECK-NEXT: fabd h0, h0, h1
30 %sub = fsub half %a, %b
31 %abs = tail call half @llvm.fabs.f16(half %sub)
35 define dso_local i16 @t_vceqh_f16(half %a, half %b) {
36 ; CHECK-LABEL: t_vceqh_f16:
37 ; CHECK: // %bb.0: // %entry
38 ; CHECK-NEXT: fcmp h0, h1
39 ; CHECK-NEXT: csetm w0, eq
42 %0 = fcmp oeq half %a, %b
43 %vcmpd = sext i1 %0 to i16
47 define dso_local i16 @t_vcgeh_f16(half %a, half %b) {
48 ; CHECK-LABEL: t_vcgeh_f16:
49 ; CHECK: // %bb.0: // %entry
50 ; CHECK-NEXT: fcmp h0, h1
51 ; CHECK-NEXT: csetm w0, ge
54 %0 = fcmp oge half %a, %b
55 %vcmpd = sext i1 %0 to i16
59 define dso_local i16 @t_vcgth_f16(half %a, half %b) {
60 ; CHECK-LABEL: t_vcgth_f16:
61 ; CHECK: // %bb.0: // %entry
62 ; CHECK-NEXT: fcmp h0, h1
63 ; CHECK-NEXT: csetm w0, gt
66 %0 = fcmp ogt half %a, %b
67 %vcmpd = sext i1 %0 to i16
71 define dso_local i16 @t_vcleh_f16(half %a, half %b) {
72 ; CHECK-LABEL: t_vcleh_f16:
73 ; CHECK: // %bb.0: // %entry
74 ; CHECK-NEXT: fcmp h0, h1
75 ; CHECK-NEXT: csetm w0, ls
78 %0 = fcmp ole half %a, %b
79 %vcmpd = sext i1 %0 to i16
83 define dso_local i16 @t_vclth_f16(half %a, half %b) {
84 ; CHECK-LABEL: t_vclth_f16:
85 ; CHECK: // %bb.0: // %entry
86 ; CHECK-NEXT: fcmp h0, h1
87 ; CHECK-NEXT: csetm w0, mi
90 %0 = fcmp olt half %a, %b
91 %vcmpd = sext i1 %0 to i16
95 define dso_local half @t_vmaxh_f16(half %a, half %b) {
96 ; CHECK-LABEL: t_vmaxh_f16:
97 ; CHECK: // %bb.0: // %entry
98 ; CHECK-NEXT: fmax h0, h0, h1
101 %vmax = tail call half @llvm.aarch64.neon.fmax.f16(half %a, half %b)
105 define dso_local half @t_vminh_f16(half %a, half %b) {
106 ; CHECK-LABEL: t_vminh_f16:
107 ; CHECK: // %bb.0: // %entry
108 ; CHECK-NEXT: fmin h0, h0, h1
111 %vmin = tail call half @llvm.aarch64.neon.fmin.f16(half %a, half %b)
115 define dso_local half @t_vmulxh_f16(half %a, half %b) {
116 ; CHECK-LABEL: t_vmulxh_f16:
117 ; CHECK: // %bb.0: // %entry
118 ; CHECK-NEXT: fmulx h0, h0, h1
121 %vmulxh_f16 = tail call half @llvm.aarch64.neon.fmulx.f16(half %a, half %b)
125 define dso_local half @t_vrecpsh_f16(half %a, half %b) {
126 ; CHECK-LABEL: t_vrecpsh_f16:
127 ; CHECK: // %bb.0: // %entry
128 ; CHECK-NEXT: frecps h0, h0, h1
131 %vrecps = tail call half @llvm.aarch64.neon.frecps.f16(half %a, half %b)
135 define dso_local half @t_vrsqrtsh_f16(half %a, half %b) {
136 ; CHECK-LABEL: t_vrsqrtsh_f16:
137 ; CHECK: // %bb.0: // %entry
138 ; CHECK-NEXT: frsqrts h0, h0, h1
141 %vrsqrtsh_f16 = tail call half @llvm.aarch64.neon.frsqrts.f16(half %a, half %b)
142 ret half %vrsqrtsh_f16
145 declare half @llvm.aarch64.neon.vcvtfxs2fp.f16.i32(i32, i32) #1
146 declare half @llvm.aarch64.neon.vcvtfxs2fp.f16.i64(i64, i32) #1
147 declare i32 @llvm.aarch64.neon.vcvtfp2fxs.i32.f16(half, i32) #1
148 declare i64 @llvm.aarch64.neon.vcvtfp2fxs.i64.f16(half, i32) #1
149 declare half @llvm.aarch64.neon.vcvtfxu2fp.f16.i32(i32, i32) #1
150 declare i32 @llvm.aarch64.neon.vcvtfp2fxu.i32.f16(half, i32) #1
152 define dso_local half @test_vcvth_n_f16_s16_1(i16 %a) {
153 ; CHECK-LABEL: test_vcvth_n_f16_s16_1:
154 ; CHECK: // %bb.0: // %entry
155 ; CHECK-NEXT: fmov s0, w0
156 ; CHECK-NEXT: scvtf h0, h0, #1
159 %sext = sext i16 %a to i32
160 %fcvth_n = tail call half @llvm.aarch64.neon.vcvtfxs2fp.f16.i32(i32 %sext, i32 1)
164 define dso_local half @test_vcvth_n_f16_s16_16(i16 %a) {
165 ; CHECK-LABEL: test_vcvth_n_f16_s16_16:
166 ; CHECK: // %bb.0: // %entry
167 ; CHECK-NEXT: fmov s0, w0
168 ; CHECK-NEXT: scvtf h0, h0, #16
171 %sext = sext i16 %a to i32
172 %fcvth_n = tail call half @llvm.aarch64.neon.vcvtfxs2fp.f16.i32(i32 %sext, i32 16)
176 define dso_local half @test_vcvth_n_f16_s32_1(i32 %a) {
177 ; CHECK-LABEL: test_vcvth_n_f16_s32_1:
178 ; CHECK: // %bb.0: // %entry
179 ; CHECK-NEXT: fmov s0, w0
180 ; CHECK-NEXT: scvtf h0, h0, #1
183 %vcvth_n_f16_s32 = tail call half @llvm.aarch64.neon.vcvtfxs2fp.f16.i32(i32 %a, i32 1)
184 ret half %vcvth_n_f16_s32
187 define dso_local half @test_vcvth_n_f16_s32_16(i32 %a) {
188 ; CHECK-LABEL: test_vcvth_n_f16_s32_16:
189 ; CHECK: // %bb.0: // %entry
190 ; CHECK-NEXT: fmov s0, w0
191 ; CHECK-NEXT: scvtf h0, h0, #16
194 %vcvth_n_f16_s32 = tail call half @llvm.aarch64.neon.vcvtfxs2fp.f16.i32(i32 %a, i32 16)
195 ret half %vcvth_n_f16_s32
198 define dso_local i16 @test_vcvth_n_s16_f16_1(half %a) {
199 ; CHECK-LABEL: test_vcvth_n_s16_f16_1:
200 ; CHECK: // %bb.0: // %entry
201 ; CHECK-NEXT: fcvtzs h0, h0, #1
202 ; CHECK-NEXT: fmov w0, s0
205 %fcvth_n = tail call i32 @llvm.aarch64.neon.vcvtfp2fxs.i32.f16(half %a, i32 1)
206 %0 = trunc i32 %fcvth_n to i16
210 define dso_local i16 @test_vcvth_n_s16_f16_16(half %a) {
211 ; CHECK-LABEL: test_vcvth_n_s16_f16_16:
212 ; CHECK: // %bb.0: // %entry
213 ; CHECK-NEXT: fcvtzs h0, h0, #16
214 ; CHECK-NEXT: fmov w0, s0
217 %fcvth_n = tail call i32 @llvm.aarch64.neon.vcvtfp2fxs.i32.f16(half %a, i32 16)
218 %0 = trunc i32 %fcvth_n to i16
222 define dso_local i32 @test_vcvth_n_s32_f16_1(half %a) {
223 ; CHECK-LABEL: test_vcvth_n_s32_f16_1:
224 ; CHECK: // %bb.0: // %entry
225 ; CHECK-NEXT: fcvtzs h0, h0, #1
226 ; CHECK-NEXT: fmov w0, s0
229 %vcvth_n_s32_f16 = tail call i32 @llvm.aarch64.neon.vcvtfp2fxs.i32.f16(half %a, i32 1)
230 ret i32 %vcvth_n_s32_f16
233 define dso_local i32 @test_vcvth_n_s32_f16_16(half %a) {
234 ; CHECK-LABEL: test_vcvth_n_s32_f16_16:
235 ; CHECK: // %bb.0: // %entry
236 ; CHECK-NEXT: fcvtzs h0, h0, #16
237 ; CHECK-NEXT: fmov w0, s0
240 %vcvth_n_s32_f16 = tail call i32 @llvm.aarch64.neon.vcvtfp2fxs.i32.f16(half %a, i32 16)
241 ret i32 %vcvth_n_s32_f16
244 define dso_local i64 @test_vcvth_n_s64_f16_1(half %a) {
245 ; CHECK-LABEL: test_vcvth_n_s64_f16_1:
246 ; CHECK: // %bb.0: // %entry
247 ; CHECK-NEXT: fcvtzs h0, h0, #1
248 ; CHECK-NEXT: fmov x0, d0
251 %vcvth_n_s64_f16 = tail call i64 @llvm.aarch64.neon.vcvtfp2fxs.i64.f16(half %a, i32 1)
252 ret i64 %vcvth_n_s64_f16
255 define dso_local i64 @test_vcvth_n_s64_f16_32(half %a) {
256 ; CHECK-LABEL: test_vcvth_n_s64_f16_32:
257 ; CHECK: // %bb.0: // %entry
258 ; CHECK-NEXT: fcvtzs h0, h0, #32
259 ; CHECK-NEXT: fmov x0, d0
262 %vcvth_n_s64_f16 = tail call i64 @llvm.aarch64.neon.vcvtfp2fxs.i64.f16(half %a, i32 32)
263 ret i64 %vcvth_n_s64_f16
266 define dso_local half @test_vcvth_n_f16_u16_1(i16 %a) {
267 ; CHECK-LABEL: test_vcvth_n_f16_u16_1:
268 ; CHECK: // %bb.0: // %entry
269 ; CHECK-NEXT: fmov s0, w0
270 ; CHECK-NEXT: ucvtf h0, h0, #1
273 %0 = zext i16 %a to i32
274 %fcvth_n = tail call half @llvm.aarch64.neon.vcvtfxu2fp.f16.i32(i32 %0, i32 1)
278 define dso_local half @test_vcvth_n_f16_u16_16(i16 %a) {
279 ; CHECK-LABEL: test_vcvth_n_f16_u16_16:
280 ; CHECK: // %bb.0: // %entry
281 ; CHECK-NEXT: fmov s0, w0
282 ; CHECK-NEXT: ucvtf h0, h0, #16
285 %0 = zext i16 %a to i32
286 %fcvth_n = tail call half @llvm.aarch64.neon.vcvtfxu2fp.f16.i32(i32 %0, i32 16)
290 define dso_local half @test_vcvth_n_f16_u32_1(i32 %a) {
291 ; CHECK-LABEL: test_vcvth_n_f16_u32_1:
292 ; CHECK: // %bb.0: // %entry
293 ; CHECK-NEXT: fmov s0, w0
294 ; CHECK-NEXT: ucvtf h0, h0, #1
297 %vcvth_n_f16_u32 = tail call half @llvm.aarch64.neon.vcvtfxu2fp.f16.i32(i32 %a, i32 1)
298 ret half %vcvth_n_f16_u32
301 define dso_local half @test_vcvth_n_f16_u32_16(i32 %a) {
302 ; CHECK-LABEL: test_vcvth_n_f16_u32_16:
303 ; CHECK: // %bb.0: // %entry
304 ; CHECK-NEXT: fmov s0, w0
305 ; CHECK-NEXT: ucvtf h0, h0, #16
308 %vcvth_n_f16_u32 = tail call half @llvm.aarch64.neon.vcvtfxu2fp.f16.i32(i32 %a, i32 16)
309 ret half %vcvth_n_f16_u32
312 define dso_local i16 @test_vcvth_n_u16_f16_1(half %a) {
313 ; CHECK-LABEL: test_vcvth_n_u16_f16_1:
314 ; CHECK: // %bb.0: // %entry
315 ; CHECK-NEXT: fcvtzu h0, h0, #1
316 ; CHECK-NEXT: fmov w0, s0
319 %fcvth_n = tail call i32 @llvm.aarch64.neon.vcvtfp2fxu.i32.f16(half %a, i32 1)
320 %0 = trunc i32 %fcvth_n to i16
324 define dso_local i16 @test_vcvth_n_u16_f16_16(half %a) {
325 ; CHECK-LABEL: test_vcvth_n_u16_f16_16:
326 ; CHECK: // %bb.0: // %entry
327 ; CHECK-NEXT: fcvtzu h0, h0, #16
328 ; CHECK-NEXT: fmov w0, s0
331 %fcvth_n = tail call i32 @llvm.aarch64.neon.vcvtfp2fxu.i32.f16(half %a, i32 16)
332 %0 = trunc i32 %fcvth_n to i16
336 define dso_local i32 @test_vcvth_n_u32_f16_1(half %a) {
337 ; CHECK-LABEL: test_vcvth_n_u32_f16_1:
338 ; CHECK: // %bb.0: // %entry
339 ; CHECK-NEXT: fcvtzu h0, h0, #1
340 ; CHECK-NEXT: fmov w0, s0
343 %vcvth_n_u32_f16 = tail call i32 @llvm.aarch64.neon.vcvtfp2fxu.i32.f16(half %a, i32 1)
344 ret i32 %vcvth_n_u32_f16
347 define dso_local i32 @test_vcvth_n_u32_f16_16(half %a) {
348 ; CHECK-LABEL: test_vcvth_n_u32_f16_16:
349 ; CHECK: // %bb.0: // %entry
350 ; CHECK-NEXT: fcvtzu h0, h0, #16
351 ; CHECK-NEXT: fmov w0, s0
354 %vcvth_n_u32_f16 = tail call i32 @llvm.aarch64.neon.vcvtfp2fxu.i32.f16(half %a, i32 16)
355 ret i32 %vcvth_n_u32_f16
358 define dso_local i16 @vcageh_f16_test(half %a, half %b) {
359 ; CHECK-LABEL: vcageh_f16_test:
360 ; CHECK: // %bb.0: // %entry
361 ; CHECK-NEXT: facge h0, h0, h1
362 ; CHECK-NEXT: fmov w0, s0
365 %facg = tail call i32 @llvm.aarch64.neon.facge.i32.f16(half %a, half %b)
366 %0 = trunc i32 %facg to i16
370 define dso_local i16 @vcagth_f16_test(half %a, half %b) {
371 ; CHECK-LABEL: vcagth_f16_test:
372 ; CHECK: // %bb.0: // %entry
373 ; CHECK-NEXT: facgt h0, h0, h1
374 ; CHECK-NEXT: fmov w0, s0
377 %facg = tail call i32 @llvm.aarch64.neon.facgt.i32.f16(half %a, half %b)
378 %0 = trunc i32 %facg to i16
382 define dso_local half @vcvth_n_f16_s64_test(i64 %a) {
383 ; CHECK-LABEL: vcvth_n_f16_s64_test:
384 ; CHECK: // %bb.0: // %entry
385 ; CHECK-NEXT: fmov d0, x0
386 ; CHECK-NEXT: scvtf h0, h0, #16
389 %vcvth_n_f16_s64 = tail call half @llvm.aarch64.neon.vcvtfxs2fp.f16.i64(i64 %a, i32 16)
390 ret half %vcvth_n_f16_s64