1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+f16c < %s | FileCheck %s --check-prefix=ALL --check-prefix=F16C
3 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX
5 define zeroext i16 @test1_fast(double %d) #0 {
6 ; F16C-LABEL: test1_fast:
7 ; F16C: # %bb.0: # %entry
8 ; F16C-NEXT: vcvtsd2ss %xmm0, %xmm0, %xmm0
9 ; F16C-NEXT: vcvtps2ph $4, %xmm0, %xmm0
10 ; F16C-NEXT: vmovd %xmm0, %eax
11 ; F16C-NEXT: # kill: def $ax killed $ax killed $eax
14 ; AVX-LABEL: test1_fast:
15 ; AVX: # %bb.0: # %entry
16 ; AVX-NEXT: pushq %rax
17 ; AVX-NEXT: .cfi_def_cfa_offset 16
18 ; AVX-NEXT: callq __truncdfhf2@PLT
20 ; AVX-NEXT: .cfi_def_cfa_offset 8
23 %0 = tail call i16 @llvm.convert.to.fp16.f64(double %d)
27 define zeroext i16 @test2_fast(x86_fp80 %d) #0 {
28 ; F16C-LABEL: test2_fast:
29 ; F16C: # %bb.0: # %entry
30 ; F16C-NEXT: fldt {{[0-9]+}}(%rsp)
31 ; F16C-NEXT: fstps -{{[0-9]+}}(%rsp)
32 ; F16C-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
33 ; F16C-NEXT: vcvtps2ph $4, %xmm0, %xmm0
34 ; F16C-NEXT: vmovd %xmm0, %eax
35 ; F16C-NEXT: # kill: def $ax killed $ax killed $eax
38 ; AVX-LABEL: test2_fast:
39 ; AVX: # %bb.0: # %entry
40 ; AVX-NEXT: subq $24, %rsp
41 ; AVX-NEXT: .cfi_def_cfa_offset 32
42 ; AVX-NEXT: fldt {{[0-9]+}}(%rsp)
43 ; AVX-NEXT: fstpt (%rsp)
44 ; AVX-NEXT: callq __truncxfhf2@PLT
45 ; AVX-NEXT: addq $24, %rsp
46 ; AVX-NEXT: .cfi_def_cfa_offset 8
49 %0 = tail call i16 @llvm.convert.to.fp16.f80(x86_fp80 %d)
53 define zeroext i16 @test1(double %d) #1 {
55 ; ALL: # %bb.0: # %entry
56 ; ALL-NEXT: pushq %rax
57 ; ALL-NEXT: .cfi_def_cfa_offset 16
58 ; ALL-NEXT: callq __truncdfhf2@PLT
60 ; ALL-NEXT: .cfi_def_cfa_offset 8
63 %0 = tail call i16 @llvm.convert.to.fp16.f64(double %d)
67 define zeroext i16 @test2(x86_fp80 %d) #1 {
69 ; ALL: # %bb.0: # %entry
70 ; ALL-NEXT: subq $24, %rsp
71 ; ALL-NEXT: .cfi_def_cfa_offset 32
72 ; ALL-NEXT: fldt {{[0-9]+}}(%rsp)
73 ; ALL-NEXT: fstpt (%rsp)
74 ; ALL-NEXT: callq __truncxfhf2@PLT
75 ; ALL-NEXT: addq $24, %rsp
76 ; ALL-NEXT: .cfi_def_cfa_offset 8
79 %0 = tail call i16 @llvm.convert.to.fp16.f80(x86_fp80 %d)
83 declare i16 @llvm.convert.to.fp16.f64(double)
84 declare i16 @llvm.convert.to.fp16.f80(x86_fp80)
86 attributes #0 = { nounwind readnone uwtable "unsafe-fp-math"="true" "use-soft-float"="false" }
87 attributes #1 = { nounwind readnone uwtable "unsafe-fp-math"="false" "use-soft-float"="false" }