• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=i386-pc-linux < %s | FileCheck %s
2; RUN: llc -mtriple=x86_64-pc-linux < %s | FileCheck %s
3
4; Function Attrs: nounwind
5; CHECK-LABEL: s64_to_d:
6; CHECK: call{{l|q}} __floatdidf
7define double @s64_to_d(i64 %n) #0 {
8entry:
9  %conv = sitofp i64 %n to double
10  ret double %conv
11}
12
13; CHECK-LABEL: s64_to_f:
14; CHECK: call{{l|q}} __floatdisf
15define float @s64_to_f(i64 %n) #0 {
16entry:
17  %conv = sitofp i64 %n to float
18  ret float %conv
19}
20
21; CHECK-LABEL: s32_to_d:
22; CHECK: call{{l|q}} __floatsidf
23define double @s32_to_d(i32 %n) #0 {
24entry:
25  %conv = sitofp i32 %n to double
26  ret double %conv
27}
28
29; CHECK-LABEL: s32_to_f:
30; CHECK: call{{l|q}} __floatsisf
31define float @s32_to_f(i32 %n) #0 {
32entry:
33  %conv = sitofp i32 %n to float
34  ret float %conv
35}
36
37; CHECK-LABEL: u64_to_d:
38; CHECK: call{{l|q}} __floatundidf
39define double @u64_to_d(i64 %n) #0 {
40entry:
41  %conv = uitofp i64 %n to double
42  ret double %conv
43}
44
45; CHECK-LABEL: u64_to_f:
46; CHECK: call{{l|q}} __floatundisf
47define float @u64_to_f(i64 %n) #0 {
48entry:
49  %conv = uitofp i64 %n to float
50  ret float %conv
51}
52
53; CHECK-LABEL: u32_to_d:
54; CHECK: call{{l|q}} __floatunsidf
55define double @u32_to_d(i32 %n) #0 {
56entry:
57  %conv = uitofp i32 %n to double
58  ret double %conv
59}
60
61; CHECK-LABEL: u32_to_f:
62; CHECK: call{{l|q}} __floatunsisf
63define float @u32_to_f(i32 %n) #0 {
64entry:
65  %conv = uitofp i32 %n to float
66  ret float %conv
67}
68
69; CHECK-LABEL: d_to_s64:
70; CHECK: call{{l|q}} __fixdfdi
71define i64 @d_to_s64(double %n) #0 {
72entry:
73  %conv = fptosi double %n to i64
74  ret i64 %conv
75}
76
77; CHECK-LABEL: d_to_s32:
78; CHECK: call{{l|q}} __fixdfsi
79define i32 @d_to_s32(double %n) #0 {
80entry:
81  %conv = fptosi double %n to i32
82  ret i32 %conv
83}
84
85; CHECK-LABEL: f_to_s64:
86; CHECK: call{{l|q}} __fixsfdi
87define i64 @f_to_s64(float %n) #0 {
88entry:
89  %conv = fptosi float %n to i64
90  ret i64 %conv
91}
92
93; CHECK-LABEL: f_to_s32:
94; CHECK: call{{l|q}} __fixsfsi
95define i32 @f_to_s32(float %n) #0 {
96entry:
97  %conv = fptosi float %n to i32
98  ret i32 %conv
99}
100
101; CHECK-LABEL: d_to_u64:
102; CHECK: call{{l|q}} __fixunsdfdi
103define i64 @d_to_u64(double %n) #0 {
104entry:
105  %conv = fptoui double %n to i64
106  ret i64 %conv
107}
108
109; CHECK-LABEL: d_to_u32:
110; CHECK: call{{l|q}} __fixunsdfsi
111define i32 @d_to_u32(double %n) #0 {
112entry:
113  %conv = fptoui double %n to i32
114  ret i32 %conv
115}
116
117; CHECK-LABEL: f_to_u64:
118; CHECK: call{{l|q}} __fixunssfdi
119define i64 @f_to_u64(float %n) #0 {
120entry:
121  %conv = fptoui float %n to i64
122  ret i64 %conv
123}
124
125; CHECK-LABEL: f_to_u32:
126; CHECK: call{{l|q}} __fixunssfsi
127define i32 @f_to_u32(float %n) #0 {
128entry:
129  %conv = fptoui float %n to i32
130  ret i32 %conv
131}
132
133; CHECK-LABEL: f_to_s8:
134; CHECK: call{{l|q}} __fixsfsi
135define i8 @f_to_s8(float %f, i8 %i) #0 {
136entry:
137  %conv = fptosi float %f to i8
138  %add = add i8 %conv, %i
139  ret i8 %add
140}
141
142; CHECK-LABEL: f_to_u8:
143; CHECK: call{{l|q}} __fixunssfsi
144define i8 @f_to_u8(float %f, i8 %i) #0 {
145entry:
146  %conv = fptoui float %f to i8
147  %add = add i8 %conv, %i
148  ret i8 %add
149}
150
151; CHECK-LABEL: f_to_s16:
152; CHECK: call{{l|q}} __fixsfsi
153define i16 @f_to_s16(float %f, i16 %i) #0 {
154entry:
155  %conv = fptosi float %f to i16
156  %add = add i16 %conv, %i
157  ret i16 %add
158}
159
160; CHECK-LABEL: f_to_u16:
161; CHECK: call{{l|q}} __fixunssfsi
162define i16 @f_to_u16(float %f, i16 %i) #0 {
163entry:
164  %conv = fptoui float %f to i16
165  %add = add i16 %conv, %i
166  ret i16 %add
167}
168
169attributes #0 = { nounwind "use-soft-float"="true" }
170