1 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+f16c < %s | FileCheck %s --check-prefix=ALL --check-prefix=F16C
2 ; RUN: llc -mtriple=x86_64-unknown-unknown -mattr=+avx < %s | FileCheck %s --check-prefix=ALL --check-prefix=AVX
4 define zeroext i16 @test1_fast(double %d) #0 {
5 ; ALL-LABEL: test1_fast:
6 ; F16C-NOT: callq {{_+}}truncdfhf2
7 ; F16C: vcvtsd2ss %xmm0, %xmm0, %xmm0
8 ; F16C-NEXT: vcvtps2ph $4, %xmm0, %xmm0
9 ; AVX: callq {{_+}}truncdfhf2
12 %0 = tail call i16 @llvm.convert.to.fp16.f64(double %d)
16 define zeroext i16 @test2_fast(x86_fp80 %d) #0 {
17 ; ALL-LABEL: test2_fast:
18 ; F16C-NOT: callq {{_+}}truncxfhf2
22 ; F16C-NEXT: vcvtps2ph $4, %xmm0, %xmm0
23 ; AVX: callq {{_+}}truncxfhf2
26 %0 = tail call i16 @llvm.convert.to.fp16.f80(x86_fp80 %d)
30 define zeroext i16 @test1(double %d) #1 {
32 ; ALL: callq {{_+}}truncdfhf2
35 %0 = tail call i16 @llvm.convert.to.fp16.f64(double %d)
39 define zeroext i16 @test2(x86_fp80 %d) #1 {
41 ; ALL: callq {{_+}}truncxfhf2
44 %0 = tail call i16 @llvm.convert.to.fp16.f80(x86_fp80 %d)
48 declare i16 @llvm.convert.to.fp16.f64(double)
49 declare i16 @llvm.convert.to.fp16.f80(x86_fp80)
51 attributes #0 = { nounwind readnone uwtable "unsafe-fp-math"="true" "use-soft-float"="false" }
52 attributes #1 = { nounwind readnone uwtable "unsafe-fp-math"="false" "use-soft-float"="false" }