1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=x86_64-linux-gnu -global-isel -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s
5 ; ModuleID = 'sitofp.ll'
6 source_filename = "sitofp.c"
7 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
8 target triple = "x86_64-unknown-linux-gnu"
10 ; Function Attrs: norecurse nounwind readnone uwtable
11 define dso_local float @int8_to_float(i8 signext %a) local_unnamed_addr #0 {
13 %conv = sitofp i8 %a to float
17 ; Function Attrs: norecurse nounwind readnone uwtable
18 define dso_local float @int16_to_float(i16 signext %a) local_unnamed_addr #0 {
20 %conv = sitofp i16 %a to float
24 ; Function Attrs: norecurse nounwind readnone uwtable
25 define dso_local float @int32_to_float(i32 %a) local_unnamed_addr #0 {
27 %conv = sitofp i32 %a to float
31 ; Function Attrs: norecurse nounwind readnone uwtable
32 define dso_local float @int64_to_float(i64 %a) local_unnamed_addr #0 {
34 %conv = sitofp i64 %a to float
38 ; Function Attrs: norecurse nounwind readnone uwtable
39 define dso_local double @int8_to_double(i8 signext %a) local_unnamed_addr #0 {
41 %conv = sitofp i8 %a to double
45 ; Function Attrs: norecurse nounwind readnone uwtable
46 define dso_local double @int16_to_double(i16 signext %a) local_unnamed_addr #0 {
48 %conv = sitofp i16 %a to double
52 ; Function Attrs: norecurse nounwind readnone uwtable
53 define dso_local double @int32_to_double(i32 %a) local_unnamed_addr #0 {
55 %conv = sitofp i32 %a to double
59 ; Function Attrs: norecurse nounwind readnone uwtable
60 define dso_local double @int64_to_double(i64 %a) local_unnamed_addr #0 {
62 %conv = sitofp i64 %a to double
66 attributes #0 = { norecurse nounwind readnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
68 !llvm.module.flags = !{!0}
71 !0 = !{i32 1, !"wchar_size", i32 4}
72 !1 = !{!"clang version 7.0.0"}
78 tracksRegLiveness: true
88 ; CHECK-LABEL: name: int8_to_float
89 ; CHECK: liveins: $edi
90 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
91 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
92 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
93 ; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[C]](s32)
94 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[TRUNC]](s8)
95 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[C]](s32)
96 ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[TRUNC1]](s8)
97 ; CHECK: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[ASHR]](s32)
98 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s128) = G_ANYEXT [[SITOFP]](s32)
99 ; CHECK: $xmm0 = COPY [[ANYEXT]](s128)
100 ; CHECK: RET 0, implicit $xmm0
101 %1:_(s32) = COPY $edi
102 %0:_(s8) = G_TRUNC %1(s32)
103 %2:_(s32) = G_SITOFP %0(s8)
104 %3:_(s128) = G_ANYEXT %2(s32)
105 $xmm0 = COPY %3(s128)
106 RET 0, implicit $xmm0
112 tracksRegLiveness: true
114 - { id: 0, class: _ }
115 - { id: 1, class: _ }
116 - { id: 2, class: _ }
117 - { id: 3, class: _ }
122 ; CHECK-LABEL: name: int16_to_float
123 ; CHECK: liveins: $edi
124 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
125 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
126 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
127 ; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[C]](s32)
128 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[TRUNC]](s8)
129 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[C]](s32)
130 ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[TRUNC1]](s8)
131 ; CHECK: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[ASHR]](s32)
132 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s128) = G_ANYEXT [[SITOFP]](s32)
133 ; CHECK: $xmm0 = COPY [[ANYEXT]](s128)
134 ; CHECK: RET 0, implicit $xmm0
135 %1:_(s32) = COPY $edi
136 %0:_(s16) = G_TRUNC %1(s32)
137 %2:_(s32) = G_SITOFP %0(s16)
138 %3:_(s128) = G_ANYEXT %2(s32)
139 $xmm0 = COPY %3(s128)
140 RET 0, implicit $xmm0
146 tracksRegLiveness: true
148 - { id: 0, class: _ }
149 - { id: 1, class: _ }
150 - { id: 2, class: _ }
155 ; CHECK-LABEL: name: int32_to_float
156 ; CHECK: liveins: $edi
157 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
158 ; CHECK: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[COPY]](s32)
159 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s128) = G_ANYEXT [[SITOFP]](s32)
160 ; CHECK: $xmm0 = COPY [[ANYEXT]](s128)
161 ; CHECK: RET 0, implicit $xmm0
162 %0:_(s32) = COPY $edi
163 %1:_(s32) = G_SITOFP %0(s32)
164 %2:_(s128) = G_ANYEXT %1(s32)
165 $xmm0 = COPY %2(s128)
166 RET 0, implicit $xmm0
172 tracksRegLiveness: true
174 - { id: 0, class: _ }
175 - { id: 1, class: _ }
176 - { id: 2, class: _ }
181 ; CHECK-LABEL: name: int64_to_float
182 ; CHECK: liveins: $rdi
183 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $rdi
184 ; CHECK: [[SITOFP:%[0-9]+]]:_(s32) = G_SITOFP [[COPY]](s64)
185 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s128) = G_ANYEXT [[SITOFP]](s32)
186 ; CHECK: $xmm0 = COPY [[ANYEXT]](s128)
187 ; CHECK: RET 0, implicit $xmm0
188 %0:_(s64) = COPY $rdi
189 %1:_(s32) = G_SITOFP %0(s64)
190 %2:_(s128) = G_ANYEXT %1(s32)
191 $xmm0 = COPY %2(s128)
192 RET 0, implicit $xmm0
198 tracksRegLiveness: true
200 - { id: 0, class: _ }
201 - { id: 1, class: _ }
202 - { id: 2, class: _ }
203 - { id: 3, class: _ }
208 ; CHECK-LABEL: name: int8_to_double
209 ; CHECK: liveins: $edi
210 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
211 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
212 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
213 ; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[C]](s32)
214 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[TRUNC]](s8)
215 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[C]](s32)
216 ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[TRUNC1]](s8)
217 ; CHECK: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[ASHR]](s32)
218 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s128) = G_ANYEXT [[SITOFP]](s64)
219 ; CHECK: $xmm0 = COPY [[ANYEXT]](s128)
220 ; CHECK: RET 0, implicit $xmm0
221 %1:_(s32) = COPY $edi
222 %0:_(s8) = G_TRUNC %1(s32)
223 %2:_(s64) = G_SITOFP %0(s8)
224 %3:_(s128) = G_ANYEXT %2(s64)
225 $xmm0 = COPY %3(s128)
226 RET 0, implicit $xmm0
230 name: int16_to_double
232 tracksRegLiveness: true
234 - { id: 0, class: _ }
235 - { id: 1, class: _ }
236 - { id: 2, class: _ }
237 - { id: 3, class: _ }
242 ; CHECK-LABEL: name: int16_to_double
243 ; CHECK: liveins: $edi
244 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
245 ; CHECK: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
246 ; CHECK: [[COPY1:%[0-9]+]]:_(s32) = COPY [[COPY]](s32)
247 ; CHECK: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[C]](s32)
248 ; CHECK: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[COPY1]], [[TRUNC]](s8)
249 ; CHECK: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[C]](s32)
250 ; CHECK: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[TRUNC1]](s8)
251 ; CHECK: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[ASHR]](s32)
252 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s128) = G_ANYEXT [[SITOFP]](s64)
253 ; CHECK: $xmm0 = COPY [[ANYEXT]](s128)
254 ; CHECK: RET 0, implicit $xmm0
255 %1:_(s32) = COPY $edi
256 %0:_(s16) = G_TRUNC %1(s32)
257 %2:_(s64) = G_SITOFP %0(s16)
258 %3:_(s128) = G_ANYEXT %2(s64)
259 $xmm0 = COPY %3(s128)
260 RET 0, implicit $xmm0
264 name: int32_to_double
266 tracksRegLiveness: true
268 - { id: 0, class: _ }
269 - { id: 1, class: _ }
270 - { id: 2, class: _ }
275 ; CHECK-LABEL: name: int32_to_double
276 ; CHECK: liveins: $edi
277 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $edi
278 ; CHECK: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[COPY]](s32)
279 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s128) = G_ANYEXT [[SITOFP]](s64)
280 ; CHECK: $xmm0 = COPY [[ANYEXT]](s128)
281 ; CHECK: RET 0, implicit $xmm0
282 %0:_(s32) = COPY $edi
283 %1:_(s64) = G_SITOFP %0(s32)
284 %2:_(s128) = G_ANYEXT %1(s64)
285 $xmm0 = COPY %2(s128)
286 RET 0, implicit $xmm0
290 name: int64_to_double
292 tracksRegLiveness: true
294 - { id: 0, class: _ }
295 - { id: 1, class: _ }
296 - { id: 2, class: _ }
301 ; CHECK-LABEL: name: int64_to_double
302 ; CHECK: liveins: $rdi
303 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $rdi
304 ; CHECK: [[SITOFP:%[0-9]+]]:_(s64) = G_SITOFP [[COPY]](s64)
305 ; CHECK: [[ANYEXT:%[0-9]+]]:_(s128) = G_ANYEXT [[SITOFP]](s64)
306 ; CHECK: $xmm0 = COPY [[ANYEXT]](s128)
307 ; CHECK: RET 0, implicit $xmm0
308 %0:_(s64) = COPY $rdi
309 %1:_(s64) = G_SITOFP %0(s64)
310 %2:_(s128) = G_ANYEXT %1(s64)
311 $xmm0 = COPY %2(s128)
312 RET 0, implicit $xmm0