Drop prelink support.
[oota-llvm.git] / test / CodeGen / X86 / scalar-int-to-fp.ll
1 ; Verify that scalar integer conversions to FP compile successfully
2 ; (at one time long double failed with avx512f), and that reasonable
3 ; instruction sequences are selected based on subtarget features.
4 ; Due to the plethora of reasonable sequences we just check for
5 ; one key instruction, usually a cvt or fild, allowing the test
6 ; to be relatively easily updated when sequences are improved.
7 ;
8 ; RUN: llc < %s -mtriple=i386-unknown-unknown     -mattr=+avx512f | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512_32
9 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown   -mattr=+avx512f | FileCheck %s --check-prefix=CHECK --check-prefix=AVX512_64
10 ; RUN: llc < %s -mtriple=i386-unknown-unknown     -mattr=+sse2    | FileCheck %s --check-prefix=CHECK --check-prefix=SSE2_32
11 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown   -mattr=+sse2    | FileCheck %s --check-prefix=CHECK --check-prefix=SSE2_64
12 ; RUN: llc < %s -mtriple=i386-unknown-unknown     -mattr=-sse     | FileCheck %s --check-prefix=CHECK --check-prefix=X87
13
14 ; CHECK-LABEL: u32_to_f
15 ; AVX512_32: vcvtusi2ssl
16 ; AVX512_64: vcvtusi2ssl
17 ; SSE2_32: cvtsd2ss
18 ; SSE2_64: cvtsi2ssq
19 ; X87: fildll
20 define float @u32_to_f(i32 %a) nounwind {
21   %r = uitofp i32 %a to float
22   ret float %r
23 }
24
25 ; CHECK-LABEL: s32_to_f
26 ; AVX512_32: vcvtsi2ssl
27 ; AVX512_64: vcvtsi2ssl
28 ; SSE2_32: cvtsi2ssl
29 ; SSE2_64: cvtsi2ssl
30 ; X87: fildl
31 define float @s32_to_f(i32 %a) nounwind {
32   %r = sitofp i32 %a to float
33   ret float %r
34 }
35
36 ; CHECK-LABEL: u32_to_d
37 ; AVX512_32: vcvtusi2sdl
38 ; AVX512_64: vcvtusi2sdl
39 ; SSE2_32: subsd
40 ; SSE2_64: cvtsi2sdq
41 ; X87: fildll
42 define double @u32_to_d(i32 %a) nounwind {
43   %r = uitofp i32 %a to double
44   ret double %r
45 }
46
47 ; CHECK-LABEL: s32_to_d
48 ; AVX512_32: vcvtsi2sdl
49 ; AVX512_64: vcvtsi2sdl
50 ; SSE2_32: cvtsi2sdl
51 ; SSE2_64: cvtsi2sdl
52 ; X87: fildl
53 define double @s32_to_d(i32 %a) nounwind {
54   %r = sitofp i32 %a to double
55   ret double %r
56 }
57
58 ; CHECK-LABEL: u32_to_x
59 ; AVX512_32: vsubsd
60 ; AVX512_64: vsubsd
61 ; SSE2_32: subsd
62 ; SSE2_64: fildll
63 ; X87: fildll
64 define x86_fp80 @u32_to_x(i32 %a) nounwind {
65   %r = uitofp i32 %a to x86_fp80
66   ret x86_fp80 %r
67 }
68
69 ; CHECK-LABEL: s32_to_x
70 ; CHECK: fildl
71 define x86_fp80 @s32_to_x(i32 %a) nounwind {
72   %r = sitofp i32 %a to x86_fp80
73   ret x86_fp80 %r
74 }
75
76 ; CHECK-LABEL: u64_to_f
77 ; AVX512_32: fildll
78 ; AVX512_64: vcvtusi2ssq
79 ; SSE2_32: fildll
80 ; SSE2_64: cvtsi2ssq
81 ; X87: fildll
82 define float @u64_to_f(i64 %a) nounwind {
83   %r = uitofp i64 %a to float
84   ret float %r
85 }
86
87 ; CHECK-LABEL: s64_to_f
88 ; AVX512_32: fildll
89 ; AVX512_64: vcvtsi2ssq
90 ; SSE2_32: fildll
91 ; SSE2_64: cvtsi2ssq
92 ; X87: fildll
93 define float @s64_to_f(i64 %a) nounwind {
94   %r = sitofp i64 %a to float
95   ret float %r
96 }
97
98 ; CHECK-LABEL: u64_to_d
99 ; AVX512_32: vpunpckldq
100 ; AVX512_64: vcvtusi2sdq
101 ; SSE2_32: punpckldq
102 ; SSE2_64: punpckldq
103 ; X87: fildll
104 define double @u64_to_d(i64 %a) nounwind {
105   %r = uitofp i64 %a to double
106   ret double %r
107 }
108
109 ; CHECK-LABEL: s64_to_d
110 ; AVX512_32: fildll
111 ; AVX512_64: vcvtsi2sdq
112 ; SSE2_32: fildll
113 ; SSE2_64: cvtsi2sdq
114 ; X87: fildll
115 define double @s64_to_d(i64 %a) nounwind {
116   %r = sitofp i64 %a to double
117   ret double %r
118 }
119
120 ; CHECK-LABEL: u64_to_x
121 ; CHECK: fildll
122 define x86_fp80 @u64_to_x(i64 %a) nounwind {
123   %r = uitofp i64 %a to x86_fp80
124   ret x86_fp80 %r
125 }
126
127 ; CHECK-LABEL: s64_to_x
128 ; CHECK: fildll
129 define x86_fp80 @s64_to_x(i64 %a) nounwind {
130   %r = sitofp i64 %a to x86_fp80
131   ret x86_fp80 %r
132 }