1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-apple-macosx %s -o - | FileCheck %s --check-prefix=CHECK-SOFT
3 ; RUN: llc -mtriple=x86_64-apple-macosx -mattr=+f16c %s -o - | FileCheck %s --check-prefix=CHECK-F16C
5 define void @extendhfxf(ptr %outptr, ptr %inptr) nounwind {
6 ; CHECK-SOFT-LABEL: extendhfxf:
7 ; CHECK-SOFT: ## %bb.0:
8 ; CHECK-SOFT-NEXT: pushq %rbx
9 ; CHECK-SOFT-NEXT: subq $16, %rsp
10 ; CHECK-SOFT-NEXT: movq %rdi, %rbx
11 ; CHECK-SOFT-NEXT: movzwl (%rsi), %edi
12 ; CHECK-SOFT-NEXT: callq ___extendhfsf2
13 ; CHECK-SOFT-NEXT: movss %xmm0, {{[0-9]+}}(%rsp)
14 ; CHECK-SOFT-NEXT: flds {{[0-9]+}}(%rsp)
15 ; CHECK-SOFT-NEXT: fstpt (%rbx)
16 ; CHECK-SOFT-NEXT: addq $16, %rsp
17 ; CHECK-SOFT-NEXT: popq %rbx
18 ; CHECK-SOFT-NEXT: retq
20 ; CHECK-F16C-LABEL: extendhfxf:
21 ; CHECK-F16C: ## %bb.0:
22 ; CHECK-F16C-NEXT: movzwl (%rsi), %eax
23 ; CHECK-F16C-NEXT: vmovd %eax, %xmm0
24 ; CHECK-F16C-NEXT: vcvtph2ps %xmm0, %xmm0
25 ; CHECK-F16C-NEXT: vmovss %xmm0, -{{[0-9]+}}(%rsp)
26 ; CHECK-F16C-NEXT: flds -{{[0-9]+}}(%rsp)
27 ; CHECK-F16C-NEXT: fstpt (%rdi)
28 ; CHECK-F16C-NEXT: retq
29 %in = load half, ptr %inptr
30 %fp80 = fpext half %in to x86_fp80
31 store x86_fp80 %fp80, ptr %outptr
35 ; FIXME: We don't currently provide __truncxfhf2, but we can't lower this as
36 ; successive fptruncs (like we do fpext) because of double rounding.
37 ; We also don't currently soft-float this call, like we do e.g., __truncsfhf2:
38 ; the latter long predates the fp16 parameter passing ABI, so can't change.
39 ; If we ever add a __truncxfhf2, we're not bound by existing ABI.
40 define void @truncxfhf(ptr %outptr, ptr %inptr) nounwind {
41 ; CHECK-SOFT-LABEL: truncxfhf:
42 ; CHECK-SOFT: ## %bb.0:
43 ; CHECK-SOFT-NEXT: pushq %rbx
44 ; CHECK-SOFT-NEXT: subq $16, %rsp
45 ; CHECK-SOFT-NEXT: movq %rdi, %rbx
46 ; CHECK-SOFT-NEXT: fldt (%rsi)
47 ; CHECK-SOFT-NEXT: fstpt (%rsp)
48 ; CHECK-SOFT-NEXT: callq ___truncxfhf2
49 ; CHECK-SOFT-NEXT: pextrw $0, %xmm0, %eax
50 ; CHECK-SOFT-NEXT: movw %ax, (%rbx)
51 ; CHECK-SOFT-NEXT: addq $16, %rsp
52 ; CHECK-SOFT-NEXT: popq %rbx
53 ; CHECK-SOFT-NEXT: retq
55 ; CHECK-F16C-LABEL: truncxfhf:
56 ; CHECK-F16C: ## %bb.0:
57 ; CHECK-F16C-NEXT: pushq %rbx
58 ; CHECK-F16C-NEXT: subq $16, %rsp
59 ; CHECK-F16C-NEXT: movq %rdi, %rbx
60 ; CHECK-F16C-NEXT: fldt (%rsi)
61 ; CHECK-F16C-NEXT: fstpt (%rsp)
62 ; CHECK-F16C-NEXT: callq ___truncxfhf2
63 ; CHECK-F16C-NEXT: vpextrw $0, %xmm0, (%rbx)
64 ; CHECK-F16C-NEXT: addq $16, %rsp
65 ; CHECK-F16C-NEXT: popq %rbx
66 ; CHECK-F16C-NEXT: retq
67 %in = load x86_fp80, ptr %inptr
68 %half = fptrunc x86_fp80 %in to half
69 store half %half, ptr %outptr