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