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
3 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s --check-prefix=ALL
5 define zeroext i16 @test1_fast(double %d) #0 {
6 ; ALL-LABEL: test1_fast:
7 ; ALL: # %bb.0: # %entry
9 ; ALL-NEXT: callq __truncdfhf2@PLT
10 ; ALL-NEXT: vpextrw $0, %xmm0, %eax
11 ; ALL-NEXT: # kill: def $ax killed $ax killed $eax
15 %0 = tail call i16 @llvm.convert.to.fp16.f64(double %d)
19 define zeroext i16 @test2_fast(x86_fp80 %d) #0 {
20 ; ALL-LABEL: test2_fast:
21 ; ALL: # %bb.0: # %entry
22 ; ALL-NEXT: subq $24, %rsp
23 ; ALL-NEXT: fldt {{[0-9]+}}(%rsp)
24 ; ALL-NEXT: fstpt (%rsp)
25 ; ALL-NEXT: callq __truncxfhf2@PLT
26 ; ALL-NEXT: vpextrw $0, %xmm0, %eax
27 ; ALL-NEXT: # kill: def $ax killed $ax killed $eax
28 ; ALL-NEXT: addq $24, %rsp
31 %0 = tail call i16 @llvm.convert.to.fp16.f80(x86_fp80 %d)
35 define zeroext i16 @test1(double %d) #1 {
37 ; ALL: # %bb.0: # %entry
38 ; ALL-NEXT: pushq %rax
39 ; ALL-NEXT: callq __truncdfhf2@PLT
40 ; ALL-NEXT: vpextrw $0, %xmm0, %eax
41 ; ALL-NEXT: # kill: def $ax killed $ax killed $eax
45 %0 = tail call i16 @llvm.convert.to.fp16.f64(double %d)
49 define zeroext i16 @test2(x86_fp80 %d) #1 {
51 ; ALL: # %bb.0: # %entry
52 ; ALL-NEXT: subq $24, %rsp
53 ; ALL-NEXT: fldt {{[0-9]+}}(%rsp)
54 ; ALL-NEXT: fstpt (%rsp)
55 ; ALL-NEXT: callq __truncxfhf2@PLT
56 ; ALL-NEXT: vpextrw $0, %xmm0, %eax
57 ; ALL-NEXT: # kill: def $ax killed $ax killed $eax
58 ; ALL-NEXT: addq $24, %rsp
61 %0 = tail call i16 @llvm.convert.to.fp16.f80(x86_fp80 %d)
65 declare i16 @llvm.convert.to.fp16.f64(double)
66 declare i16 @llvm.convert.to.fp16.f80(x86_fp80)
68 attributes #0 = { nounwind readnone "unsafe-fp-math"="true" "use-soft-float"="false" }
69 attributes #1 = { nounwind readnone "unsafe-fp-math"="false" "use-soft-float"="false" }