1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=aarch64 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOFP16
3 ; RUN: llc -mtriple=aarch64 -mattr=+fullfp16 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FP16
4 ; RUN: llc -mtriple=aarch64 -global-isel=true -global-isel-abort=2 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-NOFP16
5 ; RUN: llc -mtriple=aarch64 -global-isel=true -global-isel-abort=2 -mattr=+fullfp16 %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FP16
7 ; Check that constrained fp intrinsics are correctly lowered.
10 ; Half-precision intrinsics
12 define half @add_f16(half %x, half %y) #0 {
13 ; CHECK-NOFP16-LABEL: add_f16:
14 ; CHECK-NOFP16: // %bb.0:
15 ; CHECK-NOFP16-NEXT: fcvt s1, h1
16 ; CHECK-NOFP16-NEXT: fcvt s0, h0
17 ; CHECK-NOFP16-NEXT: fadd s0, s0, s1
18 ; CHECK-NOFP16-NEXT: fcvt h0, s0
19 ; CHECK-NOFP16-NEXT: ret
21 ; CHECK-FP16-LABEL: add_f16:
22 ; CHECK-FP16: // %bb.0:
23 ; CHECK-FP16-NEXT: fadd h0, h0, h1
24 ; CHECK-FP16-NEXT: ret
25 %val = call half @llvm.experimental.constrained.fadd.f16(half %x, half %y, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
29 define half @sub_f16(half %x, half %y) #0 {
30 ; CHECK-NOFP16-LABEL: sub_f16:
31 ; CHECK-NOFP16: // %bb.0:
32 ; CHECK-NOFP16-NEXT: fcvt s1, h1
33 ; CHECK-NOFP16-NEXT: fcvt s0, h0
34 ; CHECK-NOFP16-NEXT: fsub s0, s0, s1
35 ; CHECK-NOFP16-NEXT: fcvt h0, s0
36 ; CHECK-NOFP16-NEXT: ret
38 ; CHECK-FP16-LABEL: sub_f16:
39 ; CHECK-FP16: // %bb.0:
40 ; CHECK-FP16-NEXT: fsub h0, h0, h1
41 ; CHECK-FP16-NEXT: ret
42 %val = call half @llvm.experimental.constrained.fsub.f16(half %x, half %y, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
46 define half @mul_f16(half %x, half %y) #0 {
47 ; CHECK-NOFP16-LABEL: mul_f16:
48 ; CHECK-NOFP16: // %bb.0:
49 ; CHECK-NOFP16-NEXT: fcvt s1, h1
50 ; CHECK-NOFP16-NEXT: fcvt s0, h0
51 ; CHECK-NOFP16-NEXT: fmul s0, s0, s1
52 ; CHECK-NOFP16-NEXT: fcvt h0, s0
53 ; CHECK-NOFP16-NEXT: ret
55 ; CHECK-FP16-LABEL: mul_f16:
56 ; CHECK-FP16: // %bb.0:
57 ; CHECK-FP16-NEXT: fmul h0, h0, h1
58 ; CHECK-FP16-NEXT: ret
59 %val = call half @llvm.experimental.constrained.fmul.f16(half %x, half %y, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
63 define half @div_f16(half %x, half %y) #0 {
64 ; CHECK-NOFP16-LABEL: div_f16:
65 ; CHECK-NOFP16: // %bb.0:
66 ; CHECK-NOFP16-NEXT: fcvt s1, h1
67 ; CHECK-NOFP16-NEXT: fcvt s0, h0
68 ; CHECK-NOFP16-NEXT: fdiv s0, s0, s1
69 ; CHECK-NOFP16-NEXT: fcvt h0, s0
70 ; CHECK-NOFP16-NEXT: ret
72 ; CHECK-FP16-LABEL: div_f16:
73 ; CHECK-FP16: // %bb.0:
74 ; CHECK-FP16-NEXT: fdiv h0, h0, h1
75 ; CHECK-FP16-NEXT: ret
76 %val = call half @llvm.experimental.constrained.fdiv.f16(half %x, half %y, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
80 define half @frem_f16(half %x, half %y) #0 {
81 ; CHECK-LABEL: frem_f16:
83 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
84 ; CHECK-NEXT: .cfi_def_cfa_offset 16
85 ; CHECK-NEXT: .cfi_offset w30, -16
86 ; CHECK-NEXT: fcvt s1, h1
87 ; CHECK-NEXT: fcvt s0, h0
88 ; CHECK-NEXT: bl fmodf
89 ; CHECK-NEXT: fcvt h0, s0
90 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
92 %val = call half @llvm.experimental.constrained.frem.f16(half %x, half %y, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
96 define half @fma_f16(half %x, half %y, half %z) #0 {
97 ; CHECK-NOFP16-LABEL: fma_f16:
98 ; CHECK-NOFP16: // %bb.0:
99 ; CHECK-NOFP16-NEXT: fcvt s2, h2
100 ; CHECK-NOFP16-NEXT: fcvt s1, h1
101 ; CHECK-NOFP16-NEXT: fcvt s0, h0
102 ; CHECK-NOFP16-NEXT: fmadd s0, s0, s1, s2
103 ; CHECK-NOFP16-NEXT: fcvt h0, s0
104 ; CHECK-NOFP16-NEXT: ret
106 ; CHECK-FP16-LABEL: fma_f16:
107 ; CHECK-FP16: // %bb.0:
108 ; CHECK-FP16-NEXT: fmadd h0, h0, h1, h2
109 ; CHECK-FP16-NEXT: ret
110 %val = call half @llvm.experimental.constrained.fma.f16(half %x, half %y, half %z, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
114 define i32 @fptosi_i32_f16(half %x) #0 {
115 ; CHECK-NOFP16-LABEL: fptosi_i32_f16:
116 ; CHECK-NOFP16: // %bb.0:
117 ; CHECK-NOFP16-NEXT: fcvt s0, h0
118 ; CHECK-NOFP16-NEXT: fcvtzs w0, s0
119 ; CHECK-NOFP16-NEXT: ret
121 ; CHECK-FP16-LABEL: fptosi_i32_f16:
122 ; CHECK-FP16: // %bb.0:
123 ; CHECK-FP16-NEXT: fcvtzs w0, h0
124 ; CHECK-FP16-NEXT: ret
125 %val = call i32 @llvm.experimental.constrained.fptosi.i32.f16(half %x, metadata !"fpexcept.strict") #0
129 define i32 @fptoui_i32_f16(half %x) #0 {
130 ; CHECK-NOFP16-LABEL: fptoui_i32_f16:
131 ; CHECK-NOFP16: // %bb.0:
132 ; CHECK-NOFP16-NEXT: fcvt s0, h0
133 ; CHECK-NOFP16-NEXT: fcvtzu w0, s0
134 ; CHECK-NOFP16-NEXT: ret
136 ; CHECK-FP16-LABEL: fptoui_i32_f16:
137 ; CHECK-FP16: // %bb.0:
138 ; CHECK-FP16-NEXT: fcvtzu w0, h0
139 ; CHECK-FP16-NEXT: ret
140 %val = call i32 @llvm.experimental.constrained.fptoui.i32.f16(half %x, metadata !"fpexcept.strict") #0
144 define i64 @fptosi_i64_f16(half %x) #0 {
145 ; CHECK-NOFP16-LABEL: fptosi_i64_f16:
146 ; CHECK-NOFP16: // %bb.0:
147 ; CHECK-NOFP16-NEXT: fcvt s0, h0
148 ; CHECK-NOFP16-NEXT: fcvtzs x0, s0
149 ; CHECK-NOFP16-NEXT: ret
151 ; CHECK-FP16-LABEL: fptosi_i64_f16:
152 ; CHECK-FP16: // %bb.0:
153 ; CHECK-FP16-NEXT: fcvtzs x0, h0
154 ; CHECK-FP16-NEXT: ret
155 %val = call i64 @llvm.experimental.constrained.fptosi.i64.f16(half %x, metadata !"fpexcept.strict") #0
159 define i64 @fptoui_i64_f16(half %x) #0 {
160 ; CHECK-NOFP16-LABEL: fptoui_i64_f16:
161 ; CHECK-NOFP16: // %bb.0:
162 ; CHECK-NOFP16-NEXT: fcvt s0, h0
163 ; CHECK-NOFP16-NEXT: fcvtzu x0, s0
164 ; CHECK-NOFP16-NEXT: ret
166 ; CHECK-FP16-LABEL: fptoui_i64_f16:
167 ; CHECK-FP16: // %bb.0:
168 ; CHECK-FP16-NEXT: fcvtzu x0, h0
169 ; CHECK-FP16-NEXT: ret
170 %val = call i64 @llvm.experimental.constrained.fptoui.i64.f16(half %x, metadata !"fpexcept.strict") #0
174 define half @sitofp_f16_i32(i32 %x) #0 {
175 ; CHECK-NOFP16-LABEL: sitofp_f16_i32:
176 ; CHECK-NOFP16: // %bb.0:
177 ; CHECK-NOFP16-NEXT: scvtf s0, w0
178 ; CHECK-NOFP16-NEXT: fcvt h0, s0
179 ; CHECK-NOFP16-NEXT: ret
181 ; CHECK-FP16-LABEL: sitofp_f16_i32:
182 ; CHECK-FP16: // %bb.0:
183 ; CHECK-FP16-NEXT: scvtf h0, w0
184 ; CHECK-FP16-NEXT: ret
185 %val = call half @llvm.experimental.constrained.sitofp.f16.i32(i32 %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
189 define half @uitofp_f16_i32(i32 %x) #0 {
190 ; CHECK-NOFP16-LABEL: uitofp_f16_i32:
191 ; CHECK-NOFP16: // %bb.0:
192 ; CHECK-NOFP16-NEXT: ucvtf s0, w0
193 ; CHECK-NOFP16-NEXT: fcvt h0, s0
194 ; CHECK-NOFP16-NEXT: ret
196 ; CHECK-FP16-LABEL: uitofp_f16_i32:
197 ; CHECK-FP16: // %bb.0:
198 ; CHECK-FP16-NEXT: ucvtf h0, w0
199 ; CHECK-FP16-NEXT: ret
200 %val = call half @llvm.experimental.constrained.uitofp.f16.i32(i32 %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
204 define half @sitofp_f16_i64(i64 %x) #0 {
205 ; CHECK-NOFP16-LABEL: sitofp_f16_i64:
206 ; CHECK-NOFP16: // %bb.0:
207 ; CHECK-NOFP16-NEXT: scvtf s0, x0
208 ; CHECK-NOFP16-NEXT: fcvt h0, s0
209 ; CHECK-NOFP16-NEXT: ret
211 ; CHECK-FP16-LABEL: sitofp_f16_i64:
212 ; CHECK-FP16: // %bb.0:
213 ; CHECK-FP16-NEXT: scvtf h0, x0
214 ; CHECK-FP16-NEXT: ret
215 %val = call half @llvm.experimental.constrained.sitofp.f16.i64(i64 %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
219 define half @uitofp_f16_i64(i64 %x) #0 {
220 ; CHECK-NOFP16-LABEL: uitofp_f16_i64:
221 ; CHECK-NOFP16: // %bb.0:
222 ; CHECK-NOFP16-NEXT: ucvtf s0, x0
223 ; CHECK-NOFP16-NEXT: fcvt h0, s0
224 ; CHECK-NOFP16-NEXT: ret
226 ; CHECK-FP16-LABEL: uitofp_f16_i64:
227 ; CHECK-FP16: // %bb.0:
228 ; CHECK-FP16-NEXT: ucvtf h0, x0
229 ; CHECK-FP16-NEXT: ret
230 %val = call half @llvm.experimental.constrained.uitofp.f16.i64(i64 %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
234 define half @sitofp_f16_i128(i128 %x) #0 {
235 ; CHECK-NOFP16-LABEL: sitofp_f16_i128:
236 ; CHECK-NOFP16: // %bb.0:
237 ; CHECK-NOFP16-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
238 ; CHECK-NOFP16-NEXT: .cfi_def_cfa_offset 16
239 ; CHECK-NOFP16-NEXT: .cfi_offset w30, -16
240 ; CHECK-NOFP16-NEXT: bl __floattisf
241 ; CHECK-NOFP16-NEXT: fcvt h0, s0
242 ; CHECK-NOFP16-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
243 ; CHECK-NOFP16-NEXT: ret
245 ; CHECK-FP16-LABEL: sitofp_f16_i128:
246 ; CHECK-FP16: // %bb.0:
247 ; CHECK-FP16-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
248 ; CHECK-FP16-NEXT: .cfi_def_cfa_offset 16
249 ; CHECK-FP16-NEXT: .cfi_offset w30, -16
250 ; CHECK-FP16-NEXT: bl __floattihf
251 ; CHECK-FP16-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
252 ; CHECK-FP16-NEXT: ret
253 %val = call half @llvm.experimental.constrained.sitofp.f16.i128(i128 %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
257 define half @uitofp_f16_i128(i128 %x) #0 {
258 ; CHECK-NOFP16-LABEL: uitofp_f16_i128:
259 ; CHECK-NOFP16: // %bb.0:
260 ; CHECK-NOFP16-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
261 ; CHECK-NOFP16-NEXT: .cfi_def_cfa_offset 16
262 ; CHECK-NOFP16-NEXT: .cfi_offset w30, -16
263 ; CHECK-NOFP16-NEXT: bl __floatuntisf
264 ; CHECK-NOFP16-NEXT: fcvt h0, s0
265 ; CHECK-NOFP16-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
266 ; CHECK-NOFP16-NEXT: ret
268 ; CHECK-FP16-LABEL: uitofp_f16_i128:
269 ; CHECK-FP16: // %bb.0:
270 ; CHECK-FP16-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
271 ; CHECK-FP16-NEXT: .cfi_def_cfa_offset 16
272 ; CHECK-FP16-NEXT: .cfi_offset w30, -16
273 ; CHECK-FP16-NEXT: bl __floatuntihf
274 ; CHECK-FP16-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
275 ; CHECK-FP16-NEXT: ret
276 %val = call half @llvm.experimental.constrained.uitofp.f16.i128(i128 %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
280 define half @sqrt_f16(half %x) #0 {
281 ; CHECK-NOFP16-LABEL: sqrt_f16:
282 ; CHECK-NOFP16: // %bb.0:
283 ; CHECK-NOFP16-NEXT: fcvt s0, h0
284 ; CHECK-NOFP16-NEXT: fsqrt s0, s0
285 ; CHECK-NOFP16-NEXT: fcvt h0, s0
286 ; CHECK-NOFP16-NEXT: ret
288 ; CHECK-FP16-LABEL: sqrt_f16:
289 ; CHECK-FP16: // %bb.0:
290 ; CHECK-FP16-NEXT: fsqrt h0, h0
291 ; CHECK-FP16-NEXT: ret
292 %val = call half @llvm.experimental.constrained.sqrt.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
296 define half @powi_f16(half %x, i32 %y) #0 {
297 ; CHECK-LABEL: powi_f16:
299 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
300 ; CHECK-NEXT: .cfi_def_cfa_offset 16
301 ; CHECK-NEXT: .cfi_offset w30, -16
302 ; CHECK-NEXT: fcvt s0, h0
303 ; CHECK-NEXT: bl __powisf2
304 ; CHECK-NEXT: fcvt h0, s0
305 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
307 %val = call half @llvm.experimental.constrained.powi.f16(half %x, i32 %y, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
311 define half @sin_f16(half %x) #0 {
312 ; CHECK-LABEL: sin_f16:
314 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
315 ; CHECK-NEXT: .cfi_def_cfa_offset 16
316 ; CHECK-NEXT: .cfi_offset w30, -16
317 ; CHECK-NEXT: fcvt s0, h0
318 ; CHECK-NEXT: bl sinf
319 ; CHECK-NEXT: fcvt h0, s0
320 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
322 %val = call half @llvm.experimental.constrained.sin.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
326 define half @cos_f16(half %x) #0 {
327 ; CHECK-LABEL: cos_f16:
329 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
330 ; CHECK-NEXT: .cfi_def_cfa_offset 16
331 ; CHECK-NEXT: .cfi_offset w30, -16
332 ; CHECK-NEXT: fcvt s0, h0
333 ; CHECK-NEXT: bl cosf
334 ; CHECK-NEXT: fcvt h0, s0
335 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
337 %val = call half @llvm.experimental.constrained.cos.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
341 define half @pow_f16(half %x, half %y) #0 {
342 ; CHECK-LABEL: pow_f16:
344 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
345 ; CHECK-NEXT: .cfi_def_cfa_offset 16
346 ; CHECK-NEXT: .cfi_offset w30, -16
347 ; CHECK-NEXT: fcvt s1, h1
348 ; CHECK-NEXT: fcvt s0, h0
349 ; CHECK-NEXT: bl powf
350 ; CHECK-NEXT: fcvt h0, s0
351 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
353 %val = call half @llvm.experimental.constrained.pow.f16(half %x, half %y, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
357 define half @log_f16(half %x) #0 {
358 ; CHECK-LABEL: log_f16:
360 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
361 ; CHECK-NEXT: .cfi_def_cfa_offset 16
362 ; CHECK-NEXT: .cfi_offset w30, -16
363 ; CHECK-NEXT: fcvt s0, h0
364 ; CHECK-NEXT: bl logf
365 ; CHECK-NEXT: fcvt h0, s0
366 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
368 %val = call half @llvm.experimental.constrained.log.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
372 define half @log10_f16(half %x) #0 {
373 ; CHECK-LABEL: log10_f16:
375 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
376 ; CHECK-NEXT: .cfi_def_cfa_offset 16
377 ; CHECK-NEXT: .cfi_offset w30, -16
378 ; CHECK-NEXT: fcvt s0, h0
379 ; CHECK-NEXT: bl log10f
380 ; CHECK-NEXT: fcvt h0, s0
381 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
383 %val = call half @llvm.experimental.constrained.log10.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
387 define half @log2_f16(half %x) #0 {
388 ; CHECK-LABEL: log2_f16:
390 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
391 ; CHECK-NEXT: .cfi_def_cfa_offset 16
392 ; CHECK-NEXT: .cfi_offset w30, -16
393 ; CHECK-NEXT: fcvt s0, h0
394 ; CHECK-NEXT: bl log2f
395 ; CHECK-NEXT: fcvt h0, s0
396 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
398 %val = call half @llvm.experimental.constrained.log2.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
402 define half @exp_f16(half %x) #0 {
403 ; CHECK-LABEL: exp_f16:
405 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
406 ; CHECK-NEXT: .cfi_def_cfa_offset 16
407 ; CHECK-NEXT: .cfi_offset w30, -16
408 ; CHECK-NEXT: fcvt s0, h0
409 ; CHECK-NEXT: bl expf
410 ; CHECK-NEXT: fcvt h0, s0
411 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
413 %val = call half @llvm.experimental.constrained.exp.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
417 define half @exp2_f16(half %x) #0 {
418 ; CHECK-LABEL: exp2_f16:
420 ; CHECK-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill
421 ; CHECK-NEXT: .cfi_def_cfa_offset 16
422 ; CHECK-NEXT: .cfi_offset w30, -16
423 ; CHECK-NEXT: fcvt s0, h0
424 ; CHECK-NEXT: bl exp2f
425 ; CHECK-NEXT: fcvt h0, s0
426 ; CHECK-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload
428 %val = call half @llvm.experimental.constrained.exp2.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
432 define half @rint_f16(half %x) #0 {
433 ; CHECK-NOFP16-LABEL: rint_f16:
434 ; CHECK-NOFP16: // %bb.0:
435 ; CHECK-NOFP16-NEXT: fcvt s0, h0
436 ; CHECK-NOFP16-NEXT: frintx s0, s0
437 ; CHECK-NOFP16-NEXT: fcvt h0, s0
438 ; CHECK-NOFP16-NEXT: ret
440 ; CHECK-FP16-LABEL: rint_f16:
441 ; CHECK-FP16: // %bb.0:
442 ; CHECK-FP16-NEXT: frintx h0, h0
443 ; CHECK-FP16-NEXT: ret
444 %val = call half @llvm.experimental.constrained.rint.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
448 define half @nearbyint_f16(half %x) #0 {
449 ; CHECK-NOFP16-LABEL: nearbyint_f16:
450 ; CHECK-NOFP16: // %bb.0:
451 ; CHECK-NOFP16-NEXT: fcvt s0, h0
452 ; CHECK-NOFP16-NEXT: frinti s0, s0
453 ; CHECK-NOFP16-NEXT: fcvt h0, s0
454 ; CHECK-NOFP16-NEXT: ret
456 ; CHECK-FP16-LABEL: nearbyint_f16:
457 ; CHECK-FP16: // %bb.0:
458 ; CHECK-FP16-NEXT: frinti h0, h0
459 ; CHECK-FP16-NEXT: ret
460 %val = call half @llvm.experimental.constrained.nearbyint.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
464 define i32 @lrint_f16(half %x) #0 {
465 ; CHECK-NOFP16-LABEL: lrint_f16:
466 ; CHECK-NOFP16: // %bb.0:
467 ; CHECK-NOFP16-NEXT: fcvt s0, h0
468 ; CHECK-NOFP16-NEXT: frintx s0, s0
469 ; CHECK-NOFP16-NEXT: fcvtzs w0, s0
470 ; CHECK-NOFP16-NEXT: ret
472 ; CHECK-FP16-LABEL: lrint_f16:
473 ; CHECK-FP16: // %bb.0:
474 ; CHECK-FP16-NEXT: frintx h0, h0
475 ; CHECK-FP16-NEXT: fcvtzs w0, h0
476 ; CHECK-FP16-NEXT: ret
477 %val = call i32 @llvm.experimental.constrained.lrint.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
481 define i64 @llrint_f16(half %x) #0 {
482 ; CHECK-NOFP16-LABEL: llrint_f16:
483 ; CHECK-NOFP16: // %bb.0:
484 ; CHECK-NOFP16-NEXT: fcvt s0, h0
485 ; CHECK-NOFP16-NEXT: frintx s0, s0
486 ; CHECK-NOFP16-NEXT: fcvtzs x0, s0
487 ; CHECK-NOFP16-NEXT: ret
489 ; CHECK-FP16-LABEL: llrint_f16:
490 ; CHECK-FP16: // %bb.0:
491 ; CHECK-FP16-NEXT: frintx h0, h0
492 ; CHECK-FP16-NEXT: fcvtzs x0, h0
493 ; CHECK-FP16-NEXT: ret
494 %val = call i64 @llvm.experimental.constrained.llrint.f16(half %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
498 define half @maxnum_f16(half %x, half %y) #0 {
499 ; CHECK-NOFP16-LABEL: maxnum_f16:
500 ; CHECK-NOFP16: // %bb.0:
501 ; CHECK-NOFP16-NEXT: fcvt s1, h1
502 ; CHECK-NOFP16-NEXT: fcvt s0, h0
503 ; CHECK-NOFP16-NEXT: fmaxnm s0, s0, s1
504 ; CHECK-NOFP16-NEXT: fcvt h0, s0
505 ; CHECK-NOFP16-NEXT: ret
507 ; CHECK-FP16-LABEL: maxnum_f16:
508 ; CHECK-FP16: // %bb.0:
509 ; CHECK-FP16-NEXT: fmaxnm h0, h0, h1
510 ; CHECK-FP16-NEXT: ret
511 %val = call half @llvm.experimental.constrained.maxnum.f16(half %x, half %y, metadata !"fpexcept.strict") #0
515 define half @minnum_f16(half %x, half %y) #0 {
516 ; CHECK-NOFP16-LABEL: minnum_f16:
517 ; CHECK-NOFP16: // %bb.0:
518 ; CHECK-NOFP16-NEXT: fcvt s1, h1
519 ; CHECK-NOFP16-NEXT: fcvt s0, h0
520 ; CHECK-NOFP16-NEXT: fminnm s0, s0, s1
521 ; CHECK-NOFP16-NEXT: fcvt h0, s0
522 ; CHECK-NOFP16-NEXT: ret
524 ; CHECK-FP16-LABEL: minnum_f16:
525 ; CHECK-FP16: // %bb.0:
526 ; CHECK-FP16-NEXT: fminnm h0, h0, h1
527 ; CHECK-FP16-NEXT: ret
528 %val = call half @llvm.experimental.constrained.minnum.f16(half %x, half %y, metadata !"fpexcept.strict") #0
532 define half @ceil_f16(half %x) #0 {
533 ; CHECK-NOFP16-LABEL: ceil_f16:
534 ; CHECK-NOFP16: // %bb.0:
535 ; CHECK-NOFP16-NEXT: fcvt s0, h0
536 ; CHECK-NOFP16-NEXT: frintp s0, s0
537 ; CHECK-NOFP16-NEXT: fcvt h0, s0
538 ; CHECK-NOFP16-NEXT: ret
540 ; CHECK-FP16-LABEL: ceil_f16:
541 ; CHECK-FP16: // %bb.0:
542 ; CHECK-FP16-NEXT: frintp h0, h0
543 ; CHECK-FP16-NEXT: ret
544 %val = call half @llvm.experimental.constrained.ceil.f16(half %x, metadata !"fpexcept.strict") #0
548 define half @floor_f16(half %x) #0 {
549 ; CHECK-NOFP16-LABEL: floor_f16:
550 ; CHECK-NOFP16: // %bb.0:
551 ; CHECK-NOFP16-NEXT: fcvt s0, h0
552 ; CHECK-NOFP16-NEXT: frintm s0, s0
553 ; CHECK-NOFP16-NEXT: fcvt h0, s0
554 ; CHECK-NOFP16-NEXT: ret
556 ; CHECK-FP16-LABEL: floor_f16:
557 ; CHECK-FP16: // %bb.0:
558 ; CHECK-FP16-NEXT: frintm h0, h0
559 ; CHECK-FP16-NEXT: ret
560 %val = call half @llvm.experimental.constrained.floor.f16(half %x, metadata !"fpexcept.strict") #0
564 define i32 @lround_f16(half %x) #0 {
565 ; CHECK-NOFP16-LABEL: lround_f16:
566 ; CHECK-NOFP16: // %bb.0:
567 ; CHECK-NOFP16-NEXT: fcvt s0, h0
568 ; CHECK-NOFP16-NEXT: fcvtas w0, s0
569 ; CHECK-NOFP16-NEXT: ret
571 ; CHECK-FP16-LABEL: lround_f16:
572 ; CHECK-FP16: // %bb.0:
573 ; CHECK-FP16-NEXT: fcvtas w0, h0
574 ; CHECK-FP16-NEXT: ret
575 %val = call i32 @llvm.experimental.constrained.lround.f16(half %x, metadata !"fpexcept.strict") #0
579 define i64 @llround_f16(half %x) #0 {
580 ; CHECK-NOFP16-LABEL: llround_f16:
581 ; CHECK-NOFP16: // %bb.0:
582 ; CHECK-NOFP16-NEXT: fcvt s0, h0
583 ; CHECK-NOFP16-NEXT: fcvtas x0, s0
584 ; CHECK-NOFP16-NEXT: ret
586 ; CHECK-FP16-LABEL: llround_f16:
587 ; CHECK-FP16: // %bb.0:
588 ; CHECK-FP16-NEXT: fcvtas x0, h0
589 ; CHECK-FP16-NEXT: ret
590 %val = call i64 @llvm.experimental.constrained.llround.f16(half %x, metadata !"fpexcept.strict") #0
594 define half @round_f16(half %x) #0 {
595 ; CHECK-NOFP16-LABEL: round_f16:
596 ; CHECK-NOFP16: // %bb.0:
597 ; CHECK-NOFP16-NEXT: fcvt s0, h0
598 ; CHECK-NOFP16-NEXT: frinta s0, s0
599 ; CHECK-NOFP16-NEXT: fcvt h0, s0
600 ; CHECK-NOFP16-NEXT: ret
602 ; CHECK-FP16-LABEL: round_f16:
603 ; CHECK-FP16: // %bb.0:
604 ; CHECK-FP16-NEXT: frinta h0, h0
605 ; CHECK-FP16-NEXT: ret
606 %val = call half @llvm.experimental.constrained.round.f16(half %x, metadata !"fpexcept.strict") #0
610 define half @roundeven_f16(half %x) #0 {
611 ; CHECK-NOFP16-LABEL: roundeven_f16:
612 ; CHECK-NOFP16: // %bb.0:
613 ; CHECK-NOFP16-NEXT: fcvt s0, h0
614 ; CHECK-NOFP16-NEXT: frintn s0, s0
615 ; CHECK-NOFP16-NEXT: fcvt h0, s0
616 ; CHECK-NOFP16-NEXT: ret
618 ; CHECK-FP16-LABEL: roundeven_f16:
619 ; CHECK-FP16: // %bb.0:
620 ; CHECK-FP16-NEXT: frintn h0, h0
621 ; CHECK-FP16-NEXT: ret
622 %val = call half @llvm.experimental.constrained.roundeven.f16(half %x, metadata !"fpexcept.strict") #0
626 define half @trunc_f16(half %x) #0 {
627 ; CHECK-NOFP16-LABEL: trunc_f16:
628 ; CHECK-NOFP16: // %bb.0:
629 ; CHECK-NOFP16-NEXT: fcvt s0, h0
630 ; CHECK-NOFP16-NEXT: frintz s0, s0
631 ; CHECK-NOFP16-NEXT: fcvt h0, s0
632 ; CHECK-NOFP16-NEXT: ret
634 ; CHECK-FP16-LABEL: trunc_f16:
635 ; CHECK-FP16: // %bb.0:
636 ; CHECK-FP16-NEXT: frintz h0, h0
637 ; CHECK-FP16-NEXT: ret
638 %val = call half @llvm.experimental.constrained.trunc.f16(half %x, metadata !"fpexcept.strict") #0
642 define i32 @fcmp_olt_f16(half %a, half %b) #0 {
643 ; CHECK-NOFP16-LABEL: fcmp_olt_f16:
644 ; CHECK-NOFP16: // %bb.0:
645 ; CHECK-NOFP16-NEXT: fcvt s0, h0
646 ; CHECK-NOFP16-NEXT: fcvt s1, h1
647 ; CHECK-NOFP16-NEXT: fcmp s0, s1
648 ; CHECK-NOFP16-NEXT: cset w0, mi
649 ; CHECK-NOFP16-NEXT: ret
651 ; CHECK-FP16-LABEL: fcmp_olt_f16:
652 ; CHECK-FP16: // %bb.0:
653 ; CHECK-FP16-NEXT: fcmp h0, h1
654 ; CHECK-FP16-NEXT: cset w0, mi
655 ; CHECK-FP16-NEXT: ret
656 %cmp = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"olt", metadata !"fpexcept.strict") #0
657 %conv = zext i1 %cmp to i32
661 define i32 @fcmp_ole_f16(half %a, half %b) #0 {
662 ; CHECK-NOFP16-LABEL: fcmp_ole_f16:
663 ; CHECK-NOFP16: // %bb.0:
664 ; CHECK-NOFP16-NEXT: fcvt s0, h0
665 ; CHECK-NOFP16-NEXT: fcvt s1, h1
666 ; CHECK-NOFP16-NEXT: fcmp s0, s1
667 ; CHECK-NOFP16-NEXT: cset w0, ls
668 ; CHECK-NOFP16-NEXT: ret
670 ; CHECK-FP16-LABEL: fcmp_ole_f16:
671 ; CHECK-FP16: // %bb.0:
672 ; CHECK-FP16-NEXT: fcmp h0, h1
673 ; CHECK-FP16-NEXT: cset w0, ls
674 ; CHECK-FP16-NEXT: ret
675 %cmp = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ole", metadata !"fpexcept.strict") #0
676 %conv = zext i1 %cmp to i32
680 define i32 @fcmp_ogt_f16(half %a, half %b) #0 {
681 ; CHECK-NOFP16-LABEL: fcmp_ogt_f16:
682 ; CHECK-NOFP16: // %bb.0:
683 ; CHECK-NOFP16-NEXT: fcvt s0, h0
684 ; CHECK-NOFP16-NEXT: fcvt s1, h1
685 ; CHECK-NOFP16-NEXT: fcmp s0, s1
686 ; CHECK-NOFP16-NEXT: cset w0, gt
687 ; CHECK-NOFP16-NEXT: ret
689 ; CHECK-FP16-LABEL: fcmp_ogt_f16:
690 ; CHECK-FP16: // %bb.0:
691 ; CHECK-FP16-NEXT: fcmp h0, h1
692 ; CHECK-FP16-NEXT: cset w0, gt
693 ; CHECK-FP16-NEXT: ret
694 %cmp = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ogt", metadata !"fpexcept.strict") #0
695 %conv = zext i1 %cmp to i32
699 define i32 @fcmp_oge_f16(half %a, half %b) #0 {
700 ; CHECK-NOFP16-LABEL: fcmp_oge_f16:
701 ; CHECK-NOFP16: // %bb.0:
702 ; CHECK-NOFP16-NEXT: fcvt s0, h0
703 ; CHECK-NOFP16-NEXT: fcvt s1, h1
704 ; CHECK-NOFP16-NEXT: fcmp s0, s1
705 ; CHECK-NOFP16-NEXT: cset w0, ge
706 ; CHECK-NOFP16-NEXT: ret
708 ; CHECK-FP16-LABEL: fcmp_oge_f16:
709 ; CHECK-FP16: // %bb.0:
710 ; CHECK-FP16-NEXT: fcmp h0, h1
711 ; CHECK-FP16-NEXT: cset w0, ge
712 ; CHECK-FP16-NEXT: ret
713 %cmp = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"oge", metadata !"fpexcept.strict") #0
714 %conv = zext i1 %cmp to i32
718 define i32 @fcmp_oeq_f16(half %a, half %b) #0 {
719 ; CHECK-NOFP16-LABEL: fcmp_oeq_f16:
720 ; CHECK-NOFP16: // %bb.0:
721 ; CHECK-NOFP16-NEXT: fcvt s0, h0
722 ; CHECK-NOFP16-NEXT: fcvt s1, h1
723 ; CHECK-NOFP16-NEXT: fcmp s0, s1
724 ; CHECK-NOFP16-NEXT: cset w0, eq
725 ; CHECK-NOFP16-NEXT: ret
727 ; CHECK-FP16-LABEL: fcmp_oeq_f16:
728 ; CHECK-FP16: // %bb.0:
729 ; CHECK-FP16-NEXT: fcmp h0, h1
730 ; CHECK-FP16-NEXT: cset w0, eq
731 ; CHECK-FP16-NEXT: ret
732 %cmp = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"oeq", metadata !"fpexcept.strict") #0
733 %conv = zext i1 %cmp to i32
737 define i32 @fcmp_one_f16(half %a, half %b) #0 {
738 ; CHECK-NOFP16-LABEL: fcmp_one_f16:
739 ; CHECK-NOFP16: // %bb.0:
740 ; CHECK-NOFP16-NEXT: fcvt s0, h0
741 ; CHECK-NOFP16-NEXT: fcvt s1, h1
742 ; CHECK-NOFP16-NEXT: fcmp s0, s1
743 ; CHECK-NOFP16-NEXT: cset w8, mi
744 ; CHECK-NOFP16-NEXT: csinc w0, w8, wzr, le
745 ; CHECK-NOFP16-NEXT: ret
747 ; CHECK-FP16-LABEL: fcmp_one_f16:
748 ; CHECK-FP16: // %bb.0:
749 ; CHECK-FP16-NEXT: fcmp h0, h1
750 ; CHECK-FP16-NEXT: cset w8, mi
751 ; CHECK-FP16-NEXT: csinc w0, w8, wzr, le
752 ; CHECK-FP16-NEXT: ret
753 %cmp = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"one", metadata !"fpexcept.strict") #0
754 %conv = zext i1 %cmp to i32
758 define i32 @fcmp_ult_f16(half %a, half %b) #0 {
759 ; CHECK-NOFP16-LABEL: fcmp_ult_f16:
760 ; CHECK-NOFP16: // %bb.0:
761 ; CHECK-NOFP16-NEXT: fcvt s0, h0
762 ; CHECK-NOFP16-NEXT: fcvt s1, h1
763 ; CHECK-NOFP16-NEXT: fcmp s0, s1
764 ; CHECK-NOFP16-NEXT: cset w0, lt
765 ; CHECK-NOFP16-NEXT: ret
767 ; CHECK-FP16-LABEL: fcmp_ult_f16:
768 ; CHECK-FP16: // %bb.0:
769 ; CHECK-FP16-NEXT: fcmp h0, h1
770 ; CHECK-FP16-NEXT: cset w0, lt
771 ; CHECK-FP16-NEXT: ret
772 %cmp = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ult", metadata !"fpexcept.strict") #0
773 %conv = zext i1 %cmp to i32
777 define i32 @fcmp_ule_f16(half %a, half %b) #0 {
778 ; CHECK-NOFP16-LABEL: fcmp_ule_f16:
779 ; CHECK-NOFP16: // %bb.0:
780 ; CHECK-NOFP16-NEXT: fcvt s0, h0
781 ; CHECK-NOFP16-NEXT: fcvt s1, h1
782 ; CHECK-NOFP16-NEXT: fcmp s0, s1
783 ; CHECK-NOFP16-NEXT: cset w0, le
784 ; CHECK-NOFP16-NEXT: ret
786 ; CHECK-FP16-LABEL: fcmp_ule_f16:
787 ; CHECK-FP16: // %bb.0:
788 ; CHECK-FP16-NEXT: fcmp h0, h1
789 ; CHECK-FP16-NEXT: cset w0, le
790 ; CHECK-FP16-NEXT: ret
791 %cmp = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ule", metadata !"fpexcept.strict") #0
792 %conv = zext i1 %cmp to i32
796 define i32 @fcmp_ugt_f16(half %a, half %b) #0 {
797 ; CHECK-NOFP16-LABEL: fcmp_ugt_f16:
798 ; CHECK-NOFP16: // %bb.0:
799 ; CHECK-NOFP16-NEXT: fcvt s0, h0
800 ; CHECK-NOFP16-NEXT: fcvt s1, h1
801 ; CHECK-NOFP16-NEXT: fcmp s0, s1
802 ; CHECK-NOFP16-NEXT: cset w0, hi
803 ; CHECK-NOFP16-NEXT: ret
805 ; CHECK-FP16-LABEL: fcmp_ugt_f16:
806 ; CHECK-FP16: // %bb.0:
807 ; CHECK-FP16-NEXT: fcmp h0, h1
808 ; CHECK-FP16-NEXT: cset w0, hi
809 ; CHECK-FP16-NEXT: ret
810 %cmp = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ugt", metadata !"fpexcept.strict") #0
811 %conv = zext i1 %cmp to i32
815 define i32 @fcmp_uge_f16(half %a, half %b) #0 {
816 ; CHECK-NOFP16-LABEL: fcmp_uge_f16:
817 ; CHECK-NOFP16: // %bb.0:
818 ; CHECK-NOFP16-NEXT: fcvt s0, h0
819 ; CHECK-NOFP16-NEXT: fcvt s1, h1
820 ; CHECK-NOFP16-NEXT: fcmp s0, s1
821 ; CHECK-NOFP16-NEXT: cset w0, pl
822 ; CHECK-NOFP16-NEXT: ret
824 ; CHECK-FP16-LABEL: fcmp_uge_f16:
825 ; CHECK-FP16: // %bb.0:
826 ; CHECK-FP16-NEXT: fcmp h0, h1
827 ; CHECK-FP16-NEXT: cset w0, pl
828 ; CHECK-FP16-NEXT: ret
829 %cmp = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"uge", metadata !"fpexcept.strict") #0
830 %conv = zext i1 %cmp to i32
834 define i32 @fcmp_ueq_f16(half %a, half %b) #0 {
835 ; CHECK-NOFP16-LABEL: fcmp_ueq_f16:
836 ; CHECK-NOFP16: // %bb.0:
837 ; CHECK-NOFP16-NEXT: fcvt s0, h0
838 ; CHECK-NOFP16-NEXT: fcvt s1, h1
839 ; CHECK-NOFP16-NEXT: fcmp s0, s1
840 ; CHECK-NOFP16-NEXT: cset w8, eq
841 ; CHECK-NOFP16-NEXT: csinc w0, w8, wzr, vc
842 ; CHECK-NOFP16-NEXT: ret
844 ; CHECK-FP16-LABEL: fcmp_ueq_f16:
845 ; CHECK-FP16: // %bb.0:
846 ; CHECK-FP16-NEXT: fcmp h0, h1
847 ; CHECK-FP16-NEXT: cset w8, eq
848 ; CHECK-FP16-NEXT: csinc w0, w8, wzr, vc
849 ; CHECK-FP16-NEXT: ret
850 %cmp = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"ueq", metadata !"fpexcept.strict") #0
851 %conv = zext i1 %cmp to i32
855 define i32 @fcmp_une_f16(half %a, half %b) #0 {
856 ; CHECK-NOFP16-LABEL: fcmp_une_f16:
857 ; CHECK-NOFP16: // %bb.0:
858 ; CHECK-NOFP16-NEXT: fcvt s0, h0
859 ; CHECK-NOFP16-NEXT: fcvt s1, h1
860 ; CHECK-NOFP16-NEXT: fcmp s0, s1
861 ; CHECK-NOFP16-NEXT: cset w0, ne
862 ; CHECK-NOFP16-NEXT: ret
864 ; CHECK-FP16-LABEL: fcmp_une_f16:
865 ; CHECK-FP16: // %bb.0:
866 ; CHECK-FP16-NEXT: fcmp h0, h1
867 ; CHECK-FP16-NEXT: cset w0, ne
868 ; CHECK-FP16-NEXT: ret
869 %cmp = call i1 @llvm.experimental.constrained.fcmp.f16(half %a, half %b, metadata !"une", metadata !"fpexcept.strict") #0
870 %conv = zext i1 %cmp to i32
874 define i32 @fcmps_olt_f16(half %a, half %b) #0 {
875 ; CHECK-NOFP16-LABEL: fcmps_olt_f16:
876 ; CHECK-NOFP16: // %bb.0:
877 ; CHECK-NOFP16-NEXT: fcvt s0, h0
878 ; CHECK-NOFP16-NEXT: fcvt s1, h1
879 ; CHECK-NOFP16-NEXT: fcmpe s0, s1
880 ; CHECK-NOFP16-NEXT: cset w0, mi
881 ; CHECK-NOFP16-NEXT: ret
883 ; CHECK-FP16-LABEL: fcmps_olt_f16:
884 ; CHECK-FP16: // %bb.0:
885 ; CHECK-FP16-NEXT: fcmpe h0, h1
886 ; CHECK-FP16-NEXT: cset w0, mi
887 ; CHECK-FP16-NEXT: ret
888 %cmp = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"olt", metadata !"fpexcept.strict") #0
889 %conv = zext i1 %cmp to i32
893 define i32 @fcmps_ole_f16(half %a, half %b) #0 {
894 ; CHECK-NOFP16-LABEL: fcmps_ole_f16:
895 ; CHECK-NOFP16: // %bb.0:
896 ; CHECK-NOFP16-NEXT: fcvt s0, h0
897 ; CHECK-NOFP16-NEXT: fcvt s1, h1
898 ; CHECK-NOFP16-NEXT: fcmpe s0, s1
899 ; CHECK-NOFP16-NEXT: cset w0, ls
900 ; CHECK-NOFP16-NEXT: ret
902 ; CHECK-FP16-LABEL: fcmps_ole_f16:
903 ; CHECK-FP16: // %bb.0:
904 ; CHECK-FP16-NEXT: fcmpe h0, h1
905 ; CHECK-FP16-NEXT: cset w0, ls
906 ; CHECK-FP16-NEXT: ret
907 %cmp = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ole", metadata !"fpexcept.strict") #0
908 %conv = zext i1 %cmp to i32
912 define i32 @fcmps_ogt_f16(half %a, half %b) #0 {
913 ; CHECK-NOFP16-LABEL: fcmps_ogt_f16:
914 ; CHECK-NOFP16: // %bb.0:
915 ; CHECK-NOFP16-NEXT: fcvt s0, h0
916 ; CHECK-NOFP16-NEXT: fcvt s1, h1
917 ; CHECK-NOFP16-NEXT: fcmpe s0, s1
918 ; CHECK-NOFP16-NEXT: cset w0, gt
919 ; CHECK-NOFP16-NEXT: ret
921 ; CHECK-FP16-LABEL: fcmps_ogt_f16:
922 ; CHECK-FP16: // %bb.0:
923 ; CHECK-FP16-NEXT: fcmpe h0, h1
924 ; CHECK-FP16-NEXT: cset w0, gt
925 ; CHECK-FP16-NEXT: ret
926 %cmp = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ogt", metadata !"fpexcept.strict") #0
927 %conv = zext i1 %cmp to i32
931 define i32 @fcmps_oge_f16(half %a, half %b) #0 {
932 ; CHECK-NOFP16-LABEL: fcmps_oge_f16:
933 ; CHECK-NOFP16: // %bb.0:
934 ; CHECK-NOFP16-NEXT: fcvt s0, h0
935 ; CHECK-NOFP16-NEXT: fcvt s1, h1
936 ; CHECK-NOFP16-NEXT: fcmpe s0, s1
937 ; CHECK-NOFP16-NEXT: cset w0, ge
938 ; CHECK-NOFP16-NEXT: ret
940 ; CHECK-FP16-LABEL: fcmps_oge_f16:
941 ; CHECK-FP16: // %bb.0:
942 ; CHECK-FP16-NEXT: fcmpe h0, h1
943 ; CHECK-FP16-NEXT: cset w0, ge
944 ; CHECK-FP16-NEXT: ret
945 %cmp = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"oge", metadata !"fpexcept.strict") #0
946 %conv = zext i1 %cmp to i32
950 define i32 @fcmps_oeq_f16(half %a, half %b) #0 {
951 ; CHECK-NOFP16-LABEL: fcmps_oeq_f16:
952 ; CHECK-NOFP16: // %bb.0:
953 ; CHECK-NOFP16-NEXT: fcvt s0, h0
954 ; CHECK-NOFP16-NEXT: fcvt s1, h1
955 ; CHECK-NOFP16-NEXT: fcmpe s0, s1
956 ; CHECK-NOFP16-NEXT: cset w0, eq
957 ; CHECK-NOFP16-NEXT: ret
959 ; CHECK-FP16-LABEL: fcmps_oeq_f16:
960 ; CHECK-FP16: // %bb.0:
961 ; CHECK-FP16-NEXT: fcmpe h0, h1
962 ; CHECK-FP16-NEXT: cset w0, eq
963 ; CHECK-FP16-NEXT: ret
964 %cmp = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"oeq", metadata !"fpexcept.strict") #0
965 %conv = zext i1 %cmp to i32
969 define i32 @fcmps_one_f16(half %a, half %b) #0 {
970 ; CHECK-NOFP16-LABEL: fcmps_one_f16:
971 ; CHECK-NOFP16: // %bb.0:
972 ; CHECK-NOFP16-NEXT: fcvt s0, h0
973 ; CHECK-NOFP16-NEXT: fcvt s1, h1
974 ; CHECK-NOFP16-NEXT: fcmpe s0, s1
975 ; CHECK-NOFP16-NEXT: cset w8, mi
976 ; CHECK-NOFP16-NEXT: csinc w0, w8, wzr, le
977 ; CHECK-NOFP16-NEXT: ret
979 ; CHECK-FP16-LABEL: fcmps_one_f16:
980 ; CHECK-FP16: // %bb.0:
981 ; CHECK-FP16-NEXT: fcmpe h0, h1
982 ; CHECK-FP16-NEXT: cset w8, mi
983 ; CHECK-FP16-NEXT: csinc w0, w8, wzr, le
984 ; CHECK-FP16-NEXT: ret
985 %cmp = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"one", metadata !"fpexcept.strict") #0
986 %conv = zext i1 %cmp to i32
990 define i32 @fcmps_ult_f16(half %a, half %b) #0 {
991 ; CHECK-NOFP16-LABEL: fcmps_ult_f16:
992 ; CHECK-NOFP16: // %bb.0:
993 ; CHECK-NOFP16-NEXT: fcvt s0, h0
994 ; CHECK-NOFP16-NEXT: fcvt s1, h1
995 ; CHECK-NOFP16-NEXT: fcmpe s0, s1
996 ; CHECK-NOFP16-NEXT: cset w0, lt
997 ; CHECK-NOFP16-NEXT: ret
999 ; CHECK-FP16-LABEL: fcmps_ult_f16:
1000 ; CHECK-FP16: // %bb.0:
1001 ; CHECK-FP16-NEXT: fcmpe h0, h1
1002 ; CHECK-FP16-NEXT: cset w0, lt
1003 ; CHECK-FP16-NEXT: ret
1004 %cmp = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ult", metadata !"fpexcept.strict") #0
1005 %conv = zext i1 %cmp to i32
1009 define i32 @fcmps_ule_f16(half %a, half %b) #0 {
1010 ; CHECK-NOFP16-LABEL: fcmps_ule_f16:
1011 ; CHECK-NOFP16: // %bb.0:
1012 ; CHECK-NOFP16-NEXT: fcvt s0, h0
1013 ; CHECK-NOFP16-NEXT: fcvt s1, h1
1014 ; CHECK-NOFP16-NEXT: fcmpe s0, s1
1015 ; CHECK-NOFP16-NEXT: cset w0, le
1016 ; CHECK-NOFP16-NEXT: ret
1018 ; CHECK-FP16-LABEL: fcmps_ule_f16:
1019 ; CHECK-FP16: // %bb.0:
1020 ; CHECK-FP16-NEXT: fcmpe h0, h1
1021 ; CHECK-FP16-NEXT: cset w0, le
1022 ; CHECK-FP16-NEXT: ret
1023 %cmp = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ule", metadata !"fpexcept.strict") #0
1024 %conv = zext i1 %cmp to i32
1028 define i32 @fcmps_ugt_f16(half %a, half %b) #0 {
1029 ; CHECK-NOFP16-LABEL: fcmps_ugt_f16:
1030 ; CHECK-NOFP16: // %bb.0:
1031 ; CHECK-NOFP16-NEXT: fcvt s0, h0
1032 ; CHECK-NOFP16-NEXT: fcvt s1, h1
1033 ; CHECK-NOFP16-NEXT: fcmpe s0, s1
1034 ; CHECK-NOFP16-NEXT: cset w0, hi
1035 ; CHECK-NOFP16-NEXT: ret
1037 ; CHECK-FP16-LABEL: fcmps_ugt_f16:
1038 ; CHECK-FP16: // %bb.0:
1039 ; CHECK-FP16-NEXT: fcmpe h0, h1
1040 ; CHECK-FP16-NEXT: cset w0, hi
1041 ; CHECK-FP16-NEXT: ret
1042 %cmp = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ugt", metadata !"fpexcept.strict") #0
1043 %conv = zext i1 %cmp to i32
1047 define i32 @fcmps_uge_f16(half %a, half %b) #0 {
1048 ; CHECK-NOFP16-LABEL: fcmps_uge_f16:
1049 ; CHECK-NOFP16: // %bb.0:
1050 ; CHECK-NOFP16-NEXT: fcvt s0, h0
1051 ; CHECK-NOFP16-NEXT: fcvt s1, h1
1052 ; CHECK-NOFP16-NEXT: fcmpe s0, s1
1053 ; CHECK-NOFP16-NEXT: cset w0, pl
1054 ; CHECK-NOFP16-NEXT: ret
1056 ; CHECK-FP16-LABEL: fcmps_uge_f16:
1057 ; CHECK-FP16: // %bb.0:
1058 ; CHECK-FP16-NEXT: fcmpe h0, h1
1059 ; CHECK-FP16-NEXT: cset w0, pl
1060 ; CHECK-FP16-NEXT: ret
1061 %cmp = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"uge", metadata !"fpexcept.strict") #0
1062 %conv = zext i1 %cmp to i32
1066 define i32 @fcmps_ueq_f16(half %a, half %b) #0 {
1067 ; CHECK-NOFP16-LABEL: fcmps_ueq_f16:
1068 ; CHECK-NOFP16: // %bb.0:
1069 ; CHECK-NOFP16-NEXT: fcvt s0, h0
1070 ; CHECK-NOFP16-NEXT: fcvt s1, h1
1071 ; CHECK-NOFP16-NEXT: fcmpe s0, s1
1072 ; CHECK-NOFP16-NEXT: cset w8, eq
1073 ; CHECK-NOFP16-NEXT: csinc w0, w8, wzr, vc
1074 ; CHECK-NOFP16-NEXT: ret
1076 ; CHECK-FP16-LABEL: fcmps_ueq_f16:
1077 ; CHECK-FP16: // %bb.0:
1078 ; CHECK-FP16-NEXT: fcmpe h0, h1
1079 ; CHECK-FP16-NEXT: cset w8, eq
1080 ; CHECK-FP16-NEXT: csinc w0, w8, wzr, vc
1081 ; CHECK-FP16-NEXT: ret
1082 %cmp = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"ueq", metadata !"fpexcept.strict") #0
1083 %conv = zext i1 %cmp to i32
1087 define i32 @fcmps_une_f16(half %a, half %b) #0 {
1088 ; CHECK-NOFP16-LABEL: fcmps_une_f16:
1089 ; CHECK-NOFP16: // %bb.0:
1090 ; CHECK-NOFP16-NEXT: fcvt s0, h0
1091 ; CHECK-NOFP16-NEXT: fcvt s1, h1
1092 ; CHECK-NOFP16-NEXT: fcmpe s0, s1
1093 ; CHECK-NOFP16-NEXT: cset w0, ne
1094 ; CHECK-NOFP16-NEXT: ret
1096 ; CHECK-FP16-LABEL: fcmps_une_f16:
1097 ; CHECK-FP16: // %bb.0:
1098 ; CHECK-FP16-NEXT: fcmpe h0, h1
1099 ; CHECK-FP16-NEXT: cset w0, ne
1100 ; CHECK-FP16-NEXT: ret
1101 %cmp = call i1 @llvm.experimental.constrained.fcmps.f16(half %a, half %b, metadata !"une", metadata !"fpexcept.strict") #0
1102 %conv = zext i1 %cmp to i32
1107 ; Intrinsics to convert between floating-point types
1109 define half @fptrunc_f16_f32(float %x) #0 {
1110 ; CHECK-LABEL: fptrunc_f16_f32:
1112 ; CHECK-NEXT: fcvt h0, s0
1114 %val = call half @llvm.experimental.constrained.fptrunc.f16.f32(float %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
1118 define float @fpext_f32_f16(half %x) #0 {
1119 ; CHECK-LABEL: fpext_f32_f16:
1121 ; CHECK-NEXT: fcvt s0, h0
1123 %val = call float @llvm.experimental.constrained.fpext.f32.f16(half %x, metadata !"fpexcept.strict") #0
1128 attributes #0 = { strictfp }
1130 declare half @llvm.experimental.constrained.fadd.f16(half, half, metadata, metadata)
1131 declare half @llvm.experimental.constrained.fsub.f16(half, half, metadata, metadata)
1132 declare half @llvm.experimental.constrained.fmul.f16(half, half, metadata, metadata)
1133 declare half @llvm.experimental.constrained.fdiv.f16(half, half, metadata, metadata)
1134 declare half @llvm.experimental.constrained.frem.f16(half, half, metadata, metadata)
1135 declare half @llvm.experimental.constrained.fma.f16(half, half, half, metadata, metadata)
1136 declare i32 @llvm.experimental.constrained.fptosi.i32.f16(half, metadata)
1137 declare i32 @llvm.experimental.constrained.fptoui.i32.f16(half, metadata)
1138 declare i64 @llvm.experimental.constrained.fptosi.i64.f16(half, metadata)
1139 declare i64 @llvm.experimental.constrained.fptoui.i64.f16(half, metadata)
1140 declare half @llvm.experimental.constrained.sitofp.f16.i32(i32, metadata, metadata)
1141 declare half @llvm.experimental.constrained.uitofp.f16.i32(i32, metadata, metadata)
1142 declare half @llvm.experimental.constrained.sitofp.f16.i64(i64, metadata, metadata)
1143 declare half @llvm.experimental.constrained.uitofp.f16.i64(i64, metadata, metadata)
1144 declare half @llvm.experimental.constrained.sitofp.f16.i128(i128, metadata, metadata)
1145 declare half @llvm.experimental.constrained.uitofp.f16.i128(i128, metadata, metadata)
1146 declare half @llvm.experimental.constrained.sqrt.f16(half, metadata, metadata)
1147 declare half @llvm.experimental.constrained.powi.f16(half, i32, metadata, metadata)
1148 declare half @llvm.experimental.constrained.sin.f16(half, metadata, metadata)
1149 declare half @llvm.experimental.constrained.cos.f16(half, metadata, metadata)
1150 declare half @llvm.experimental.constrained.pow.f16(half, half, metadata, metadata)
1151 declare half @llvm.experimental.constrained.log.f16(half, metadata, metadata)
1152 declare half @llvm.experimental.constrained.log10.f16(half, metadata, metadata)
1153 declare half @llvm.experimental.constrained.log2.f16(half, metadata, metadata)
1154 declare half @llvm.experimental.constrained.exp.f16(half, metadata, metadata)
1155 declare half @llvm.experimental.constrained.exp2.f16(half, metadata, metadata)
1156 declare half @llvm.experimental.constrained.rint.f16(half, metadata, metadata)
1157 declare half @llvm.experimental.constrained.nearbyint.f16(half, metadata, metadata)
1158 declare i32 @llvm.experimental.constrained.lrint.f16(half, metadata, metadata)
1159 declare i64 @llvm.experimental.constrained.llrint.f16(half, metadata, metadata)
1160 declare half @llvm.experimental.constrained.maxnum.f16(half, half, metadata)
1161 declare half @llvm.experimental.constrained.minnum.f16(half, half, metadata)
1162 declare half @llvm.experimental.constrained.ceil.f16(half, metadata)
1163 declare half @llvm.experimental.constrained.floor.f16(half, metadata)
1164 declare i32 @llvm.experimental.constrained.lround.f16(half, metadata)
1165 declare i64 @llvm.experimental.constrained.llround.f16(half, metadata)
1166 declare half @llvm.experimental.constrained.round.f16(half, metadata)
1167 declare half @llvm.experimental.constrained.roundeven.f16(half, metadata)
1168 declare half @llvm.experimental.constrained.trunc.f16(half, metadata)
1169 declare i1 @llvm.experimental.constrained.fcmps.f16(half, half, metadata, metadata)
1170 declare i1 @llvm.experimental.constrained.fcmp.f16(half, half, metadata, metadata)
1172 declare half @llvm.experimental.constrained.fptrunc.f16.f32(float, metadata, metadata)
1173 declare float @llvm.experimental.constrained.fpext.f32.f16(half, metadata)