1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=FP32
3 # RUN: llc -O0 -mtriple=mipsel-linux-gnu -mattr=+fp64,+mips32r2 -run-pass=legalizer -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=FP64
6 define void @f32toi64() {entry: ret void}
7 define void @f32toi32() {entry: ret void}
8 define void @f32toi16() {entry: ret void}
9 define void @f32toi8() {entry: ret void}
10 define void @f64toi64() {entry: ret void}
11 define void @f64toi32() {entry: ret void}
12 define void @f64toi16() {entry: ret void}
13 define void @f64toi8() {entry: ret void}
14 define void @f32tou64() {entry: ret void}
15 define void @f32tou32() {entry: ret void}
16 define void @f32tou16() {entry: ret void}
17 define void @f32tou8() {entry: ret void}
18 define void @f64tou64() {entry: ret void}
19 define void @f64tou32() {entry: ret void}
20 define void @f64tou16() {entry: ret void}
21 define void @f64tou8() {entry: ret void}
27 tracksRegLiveness: true
32 ; FP32-LABEL: name: f32toi64
35 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
36 ; FP32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
37 ; FP32-NEXT: $f12 = COPY [[COPY]](s32)
38 ; FP32-NEXT: JAL &__fixsfdi, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit-def $v0, implicit-def $v1
39 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $v0
40 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $v1
41 ; FP32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
42 ; FP32-NEXT: $v0 = COPY [[COPY1]](s32)
43 ; FP32-NEXT: $v1 = COPY [[COPY2]](s32)
44 ; FP32-NEXT: RetRA implicit $v0, implicit $v1
46 ; FP64-LABEL: name: f32toi64
49 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
50 ; FP64-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
51 ; FP64-NEXT: $f12 = COPY [[COPY]](s32)
52 ; FP64-NEXT: JAL &__fixsfdi, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $f12, implicit-def $v0, implicit-def $v1
53 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $v0
54 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $v1
55 ; FP64-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
56 ; FP64-NEXT: $v0 = COPY [[COPY1]](s32)
57 ; FP64-NEXT: $v1 = COPY [[COPY2]](s32)
58 ; FP64-NEXT: RetRA implicit $v0, implicit $v1
60 %1:_(s64) = G_FPTOSI %0(s32)
61 %2:_(s32), %3:_(s32) = G_UNMERGE_VALUES %1(s64)
64 RetRA implicit $v0, implicit $v1
70 tracksRegLiveness: true
75 ; FP32-LABEL: name: f32toi32
78 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
79 ; FP32-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s32)
80 ; FP32-NEXT: $v0 = COPY [[FPTOSI]](s32)
81 ; FP32-NEXT: RetRA implicit $v0
83 ; FP64-LABEL: name: f32toi32
86 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
87 ; FP64-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s32)
88 ; FP64-NEXT: $v0 = COPY [[FPTOSI]](s32)
89 ; FP64-NEXT: RetRA implicit $v0
91 %1:_(s32) = G_FPTOSI %0(s32)
99 tracksRegLiveness: true
104 ; FP32-LABEL: name: f32toi16
105 ; FP32: liveins: $f12
107 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
108 ; FP32-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s32)
109 ; FP32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
110 ; FP32-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[FPTOSI]], [[C]](s32)
111 ; FP32-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
112 ; FP32-NEXT: $v0 = COPY [[ASHR]](s32)
113 ; FP32-NEXT: RetRA implicit $v0
115 ; FP64-LABEL: name: f32toi16
116 ; FP64: liveins: $f12
118 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
119 ; FP64-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s32)
120 ; FP64-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
121 ; FP64-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[FPTOSI]], [[C]](s32)
122 ; FP64-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
123 ; FP64-NEXT: $v0 = COPY [[ASHR]](s32)
124 ; FP64-NEXT: RetRA implicit $v0
125 %0:_(s32) = COPY $f12
126 %1:_(s16) = G_FPTOSI %0(s32)
127 %2:_(s32) = G_SEXT %1(s16)
135 tracksRegLiveness: true
140 ; FP32-LABEL: name: f32toi8
141 ; FP32: liveins: $f12
143 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
144 ; FP32-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s32)
145 ; FP32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
146 ; FP32-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[FPTOSI]], [[C]](s32)
147 ; FP32-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
148 ; FP32-NEXT: $v0 = COPY [[ASHR]](s32)
149 ; FP32-NEXT: RetRA implicit $v0
151 ; FP64-LABEL: name: f32toi8
152 ; FP64: liveins: $f12
154 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
155 ; FP64-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s32)
156 ; FP64-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
157 ; FP64-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[FPTOSI]], [[C]](s32)
158 ; FP64-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
159 ; FP64-NEXT: $v0 = COPY [[ASHR]](s32)
160 ; FP64-NEXT: RetRA implicit $v0
161 %0:_(s32) = COPY $f12
162 %1:_(s8) = G_FPTOSI %0(s32)
163 %2:_(s32) = G_SEXT %1(s8)
171 tracksRegLiveness: true
176 ; FP32-LABEL: name: f64toi64
179 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
180 ; FP32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
181 ; FP32-NEXT: $d6 = COPY [[COPY]](s64)
182 ; FP32-NEXT: JAL &__fixdfdi, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit-def $v0, implicit-def $v1
183 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $v0
184 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $v1
185 ; FP32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
186 ; FP32-NEXT: $v0 = COPY [[COPY1]](s32)
187 ; FP32-NEXT: $v1 = COPY [[COPY2]](s32)
188 ; FP32-NEXT: RetRA implicit $v0, implicit $v1
190 ; FP64-LABEL: name: f64toi64
193 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
194 ; FP64-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
195 ; FP64-NEXT: $d12_64 = COPY [[COPY]](s64)
196 ; FP64-NEXT: JAL &__fixdfdi, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $d12_64, implicit-def $v0, implicit-def $v1
197 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $v0
198 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $v1
199 ; FP64-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
200 ; FP64-NEXT: $v0 = COPY [[COPY1]](s32)
201 ; FP64-NEXT: $v1 = COPY [[COPY2]](s32)
202 ; FP64-NEXT: RetRA implicit $v0, implicit $v1
204 %1:_(s64) = G_FPTOSI %0(s64)
205 %2:_(s32), %3:_(s32) = G_UNMERGE_VALUES %1(s64)
208 RetRA implicit $v0, implicit $v1
214 tracksRegLiveness: true
219 ; FP32-LABEL: name: f64toi32
222 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
223 ; FP32-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s64)
224 ; FP32-NEXT: $v0 = COPY [[FPTOSI]](s32)
225 ; FP32-NEXT: RetRA implicit $v0
227 ; FP64-LABEL: name: f64toi32
230 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
231 ; FP64-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s64)
232 ; FP64-NEXT: $v0 = COPY [[FPTOSI]](s32)
233 ; FP64-NEXT: RetRA implicit $v0
235 %1:_(s32) = G_FPTOSI %0(s64)
243 tracksRegLiveness: true
248 ; FP32-LABEL: name: f64toi16
251 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
252 ; FP32-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s64)
253 ; FP32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
254 ; FP32-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[FPTOSI]], [[C]](s32)
255 ; FP32-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
256 ; FP32-NEXT: $v0 = COPY [[ASHR]](s32)
257 ; FP32-NEXT: RetRA implicit $v0
259 ; FP64-LABEL: name: f64toi16
262 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
263 ; FP64-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s64)
264 ; FP64-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
265 ; FP64-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[FPTOSI]], [[C]](s32)
266 ; FP64-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
267 ; FP64-NEXT: $v0 = COPY [[ASHR]](s32)
268 ; FP64-NEXT: RetRA implicit $v0
270 %1:_(s16) = G_FPTOSI %0(s64)
271 %2:_(s32) = G_SEXT %1(s16)
279 tracksRegLiveness: true
284 ; FP32-LABEL: name: f64toi8
287 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
288 ; FP32-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s64)
289 ; FP32-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
290 ; FP32-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[FPTOSI]], [[C]](s32)
291 ; FP32-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
292 ; FP32-NEXT: $v0 = COPY [[ASHR]](s32)
293 ; FP32-NEXT: RetRA implicit $v0
295 ; FP64-LABEL: name: f64toi8
298 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
299 ; FP64-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s64)
300 ; FP64-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
301 ; FP64-NEXT: [[SHL:%[0-9]+]]:_(s32) = G_SHL [[FPTOSI]], [[C]](s32)
302 ; FP64-NEXT: [[ASHR:%[0-9]+]]:_(s32) = G_ASHR [[SHL]], [[C]](s32)
303 ; FP64-NEXT: $v0 = COPY [[ASHR]](s32)
304 ; FP64-NEXT: RetRA implicit $v0
306 %1:_(s8) = G_FPTOSI %0(s64)
307 %2:_(s32) = G_SEXT %1(s8)
315 tracksRegLiveness: true
320 ; FP32-LABEL: name: f32tou64
321 ; FP32: liveins: $f12
323 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
324 ; FP32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
325 ; FP32-NEXT: $f12 = COPY [[COPY]](s32)
326 ; FP32-NEXT: JAL &__fixunssfdi, csr_o32, implicit-def $ra, implicit-def $sp, implicit $f12, implicit-def $v0, implicit-def $v1
327 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $v0
328 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $v1
329 ; FP32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
330 ; FP32-NEXT: $v0 = COPY [[COPY1]](s32)
331 ; FP32-NEXT: $v1 = COPY [[COPY2]](s32)
332 ; FP32-NEXT: RetRA implicit $v0, implicit $v1
334 ; FP64-LABEL: name: f32tou64
335 ; FP64: liveins: $f12
337 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
338 ; FP64-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
339 ; FP64-NEXT: $f12 = COPY [[COPY]](s32)
340 ; FP64-NEXT: JAL &__fixunssfdi, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $f12, implicit-def $v0, implicit-def $v1
341 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $v0
342 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $v1
343 ; FP64-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
344 ; FP64-NEXT: $v0 = COPY [[COPY1]](s32)
345 ; FP64-NEXT: $v1 = COPY [[COPY2]](s32)
346 ; FP64-NEXT: RetRA implicit $v0, implicit $v1
347 %0:_(s32) = COPY $f12
348 %1:_(s64) = G_FPTOUI %0(s32)
349 %2:_(s32), %3:_(s32) = G_UNMERGE_VALUES %1(s64)
352 RetRA implicit $v0, implicit $v1
358 tracksRegLiveness: true
363 ; FP32-LABEL: name: f32tou32
364 ; FP32: liveins: $f12
366 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
367 ; FP32-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s32)
368 ; FP32-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0x41E0000000000000
369 ; FP32-NEXT: [[FSUB:%[0-9]+]]:_(s32) = G_FSUB [[COPY]], [[C]]
370 ; FP32-NEXT: [[FPTOSI1:%[0-9]+]]:_(s32) = G_FPTOSI [[FSUB]](s32)
371 ; FP32-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
372 ; FP32-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[FPTOSI1]], [[C1]]
373 ; FP32-NEXT: [[FCMP:%[0-9]+]]:_(s32) = G_FCMP floatpred(ult), [[COPY]](s32), [[C]]
374 ; FP32-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[FCMP]](s32), [[FPTOSI]], [[XOR]]
375 ; FP32-NEXT: $v0 = COPY [[SELECT]](s32)
376 ; FP32-NEXT: RetRA implicit $v0
378 ; FP64-LABEL: name: f32tou32
379 ; FP64: liveins: $f12
381 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
382 ; FP64-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s32)
383 ; FP64-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0x41E0000000000000
384 ; FP64-NEXT: [[FSUB:%[0-9]+]]:_(s32) = G_FSUB [[COPY]], [[C]]
385 ; FP64-NEXT: [[FPTOSI1:%[0-9]+]]:_(s32) = G_FPTOSI [[FSUB]](s32)
386 ; FP64-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
387 ; FP64-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[FPTOSI1]], [[C1]]
388 ; FP64-NEXT: [[FCMP:%[0-9]+]]:_(s32) = G_FCMP floatpred(ult), [[COPY]](s32), [[C]]
389 ; FP64-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[FCMP]](s32), [[FPTOSI]], [[XOR]]
390 ; FP64-NEXT: $v0 = COPY [[SELECT]](s32)
391 ; FP64-NEXT: RetRA implicit $v0
392 %0:_(s32) = COPY $f12
393 %1:_(s32) = G_FPTOUI %0(s32)
401 tracksRegLiveness: true
406 ; FP32-LABEL: name: f32tou16
407 ; FP32: liveins: $f12
409 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
410 ; FP32-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s32)
411 ; FP32-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0x41E0000000000000
412 ; FP32-NEXT: [[FSUB:%[0-9]+]]:_(s32) = G_FSUB [[COPY]], [[C]]
413 ; FP32-NEXT: [[FPTOSI1:%[0-9]+]]:_(s32) = G_FPTOSI [[FSUB]](s32)
414 ; FP32-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
415 ; FP32-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[FPTOSI1]], [[C1]]
416 ; FP32-NEXT: [[FCMP:%[0-9]+]]:_(s32) = G_FCMP floatpred(ult), [[COPY]](s32), [[C]]
417 ; FP32-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[FCMP]](s32), [[FPTOSI]], [[XOR]]
418 ; FP32-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
419 ; FP32-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SELECT]], [[C2]]
420 ; FP32-NEXT: $v0 = COPY [[AND]](s32)
421 ; FP32-NEXT: RetRA implicit $v0
423 ; FP64-LABEL: name: f32tou16
424 ; FP64: liveins: $f12
426 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
427 ; FP64-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s32)
428 ; FP64-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0x41E0000000000000
429 ; FP64-NEXT: [[FSUB:%[0-9]+]]:_(s32) = G_FSUB [[COPY]], [[C]]
430 ; FP64-NEXT: [[FPTOSI1:%[0-9]+]]:_(s32) = G_FPTOSI [[FSUB]](s32)
431 ; FP64-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
432 ; FP64-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[FPTOSI1]], [[C1]]
433 ; FP64-NEXT: [[FCMP:%[0-9]+]]:_(s32) = G_FCMP floatpred(ult), [[COPY]](s32), [[C]]
434 ; FP64-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[FCMP]](s32), [[FPTOSI]], [[XOR]]
435 ; FP64-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
436 ; FP64-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SELECT]], [[C2]]
437 ; FP64-NEXT: $v0 = COPY [[AND]](s32)
438 ; FP64-NEXT: RetRA implicit $v0
439 %0:_(s32) = COPY $f12
440 %1:_(s16) = G_FPTOUI %0(s32)
441 %2:_(s32) = G_ZEXT %1(s16)
449 tracksRegLiveness: true
454 ; FP32-LABEL: name: f32tou8
455 ; FP32: liveins: $f12
457 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
458 ; FP32-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s32)
459 ; FP32-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0x41E0000000000000
460 ; FP32-NEXT: [[FSUB:%[0-9]+]]:_(s32) = G_FSUB [[COPY]], [[C]]
461 ; FP32-NEXT: [[FPTOSI1:%[0-9]+]]:_(s32) = G_FPTOSI [[FSUB]](s32)
462 ; FP32-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
463 ; FP32-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[FPTOSI1]], [[C1]]
464 ; FP32-NEXT: [[FCMP:%[0-9]+]]:_(s32) = G_FCMP floatpred(ult), [[COPY]](s32), [[C]]
465 ; FP32-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[FCMP]](s32), [[FPTOSI]], [[XOR]]
466 ; FP32-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
467 ; FP32-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SELECT]], [[C2]]
468 ; FP32-NEXT: $v0 = COPY [[AND]](s32)
469 ; FP32-NEXT: RetRA implicit $v0
471 ; FP64-LABEL: name: f32tou8
472 ; FP64: liveins: $f12
474 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $f12
475 ; FP64-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s32)
476 ; FP64-NEXT: [[C:%[0-9]+]]:_(s32) = G_FCONSTANT float 0x41E0000000000000
477 ; FP64-NEXT: [[FSUB:%[0-9]+]]:_(s32) = G_FSUB [[COPY]], [[C]]
478 ; FP64-NEXT: [[FPTOSI1:%[0-9]+]]:_(s32) = G_FPTOSI [[FSUB]](s32)
479 ; FP64-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
480 ; FP64-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[FPTOSI1]], [[C1]]
481 ; FP64-NEXT: [[FCMP:%[0-9]+]]:_(s32) = G_FCMP floatpred(ult), [[COPY]](s32), [[C]]
482 ; FP64-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[FCMP]](s32), [[FPTOSI]], [[XOR]]
483 ; FP64-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
484 ; FP64-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SELECT]], [[C2]]
485 ; FP64-NEXT: $v0 = COPY [[AND]](s32)
486 ; FP64-NEXT: RetRA implicit $v0
487 %0:_(s32) = COPY $f12
488 %1:_(s8) = G_FPTOUI %0(s32)
489 %2:_(s32) = G_ZEXT %1(s8)
497 tracksRegLiveness: true
502 ; FP32-LABEL: name: f64tou64
505 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
506 ; FP32-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
507 ; FP32-NEXT: $d6 = COPY [[COPY]](s64)
508 ; FP32-NEXT: JAL &__fixunsdfdi, csr_o32, implicit-def $ra, implicit-def $sp, implicit $d6, implicit-def $v0, implicit-def $v1
509 ; FP32-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $v0
510 ; FP32-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $v1
511 ; FP32-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
512 ; FP32-NEXT: $v0 = COPY [[COPY1]](s32)
513 ; FP32-NEXT: $v1 = COPY [[COPY2]](s32)
514 ; FP32-NEXT: RetRA implicit $v0, implicit $v1
516 ; FP64-LABEL: name: f64tou64
519 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
520 ; FP64-NEXT: ADJCALLSTACKDOWN 16, 0, implicit-def $sp, implicit $sp
521 ; FP64-NEXT: $d12_64 = COPY [[COPY]](s64)
522 ; FP64-NEXT: JAL &__fixunsdfdi, csr_o32_fp64, implicit-def $ra, implicit-def $sp, implicit $d12_64, implicit-def $v0, implicit-def $v1
523 ; FP64-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $v0
524 ; FP64-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $v1
525 ; FP64-NEXT: ADJCALLSTACKUP 16, 0, implicit-def $sp, implicit $sp
526 ; FP64-NEXT: $v0 = COPY [[COPY1]](s32)
527 ; FP64-NEXT: $v1 = COPY [[COPY2]](s32)
528 ; FP64-NEXT: RetRA implicit $v0, implicit $v1
530 %1:_(s64) = G_FPTOUI %0(s64)
531 %2:_(s32), %3:_(s32) = G_UNMERGE_VALUES %1(s64)
534 RetRA implicit $v0, implicit $v1
540 tracksRegLiveness: true
545 ; FP32-LABEL: name: f64tou32
548 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
549 ; FP32-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s64)
550 ; FP32-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0x41E0000000000000
551 ; FP32-NEXT: [[FSUB:%[0-9]+]]:_(s64) = G_FSUB [[COPY]], [[C]]
552 ; FP32-NEXT: [[FPTOSI1:%[0-9]+]]:_(s32) = G_FPTOSI [[FSUB]](s64)
553 ; FP32-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
554 ; FP32-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[FPTOSI1]], [[C1]]
555 ; FP32-NEXT: [[FCMP:%[0-9]+]]:_(s32) = G_FCMP floatpred(ult), [[COPY]](s64), [[C]]
556 ; FP32-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[FCMP]](s32), [[FPTOSI]], [[XOR]]
557 ; FP32-NEXT: $v0 = COPY [[SELECT]](s32)
558 ; FP32-NEXT: RetRA implicit $v0
560 ; FP64-LABEL: name: f64tou32
563 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
564 ; FP64-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s64)
565 ; FP64-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0x41E0000000000000
566 ; FP64-NEXT: [[FSUB:%[0-9]+]]:_(s64) = G_FSUB [[COPY]], [[C]]
567 ; FP64-NEXT: [[FPTOSI1:%[0-9]+]]:_(s32) = G_FPTOSI [[FSUB]](s64)
568 ; FP64-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
569 ; FP64-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[FPTOSI1]], [[C1]]
570 ; FP64-NEXT: [[FCMP:%[0-9]+]]:_(s32) = G_FCMP floatpred(ult), [[COPY]](s64), [[C]]
571 ; FP64-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[FCMP]](s32), [[FPTOSI]], [[XOR]]
572 ; FP64-NEXT: $v0 = COPY [[SELECT]](s32)
573 ; FP64-NEXT: RetRA implicit $v0
575 %1:_(s32) = G_FPTOUI %0(s64)
583 tracksRegLiveness: true
588 ; FP32-LABEL: name: f64tou16
591 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
592 ; FP32-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s64)
593 ; FP32-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0x41E0000000000000
594 ; FP32-NEXT: [[FSUB:%[0-9]+]]:_(s64) = G_FSUB [[COPY]], [[C]]
595 ; FP32-NEXT: [[FPTOSI1:%[0-9]+]]:_(s32) = G_FPTOSI [[FSUB]](s64)
596 ; FP32-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
597 ; FP32-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[FPTOSI1]], [[C1]]
598 ; FP32-NEXT: [[FCMP:%[0-9]+]]:_(s32) = G_FCMP floatpred(ult), [[COPY]](s64), [[C]]
599 ; FP32-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[FCMP]](s32), [[FPTOSI]], [[XOR]]
600 ; FP32-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
601 ; FP32-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SELECT]], [[C2]]
602 ; FP32-NEXT: $v0 = COPY [[AND]](s32)
603 ; FP32-NEXT: RetRA implicit $v0
605 ; FP64-LABEL: name: f64tou16
608 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
609 ; FP64-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s64)
610 ; FP64-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0x41E0000000000000
611 ; FP64-NEXT: [[FSUB:%[0-9]+]]:_(s64) = G_FSUB [[COPY]], [[C]]
612 ; FP64-NEXT: [[FPTOSI1:%[0-9]+]]:_(s32) = G_FPTOSI [[FSUB]](s64)
613 ; FP64-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
614 ; FP64-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[FPTOSI1]], [[C1]]
615 ; FP64-NEXT: [[FCMP:%[0-9]+]]:_(s32) = G_FCMP floatpred(ult), [[COPY]](s64), [[C]]
616 ; FP64-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[FCMP]](s32), [[FPTOSI]], [[XOR]]
617 ; FP64-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 65535
618 ; FP64-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SELECT]], [[C2]]
619 ; FP64-NEXT: $v0 = COPY [[AND]](s32)
620 ; FP64-NEXT: RetRA implicit $v0
622 %1:_(s16) = G_FPTOUI %0(s64)
623 %2:_(s32) = G_ZEXT %1(s16)
631 tracksRegLiveness: true
636 ; FP32-LABEL: name: f64tou8
639 ; FP32-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
640 ; FP32-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s64)
641 ; FP32-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0x41E0000000000000
642 ; FP32-NEXT: [[FSUB:%[0-9]+]]:_(s64) = G_FSUB [[COPY]], [[C]]
643 ; FP32-NEXT: [[FPTOSI1:%[0-9]+]]:_(s32) = G_FPTOSI [[FSUB]](s64)
644 ; FP32-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
645 ; FP32-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[FPTOSI1]], [[C1]]
646 ; FP32-NEXT: [[FCMP:%[0-9]+]]:_(s32) = G_FCMP floatpred(ult), [[COPY]](s64), [[C]]
647 ; FP32-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[FCMP]](s32), [[FPTOSI]], [[XOR]]
648 ; FP32-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
649 ; FP32-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SELECT]], [[C2]]
650 ; FP32-NEXT: $v0 = COPY [[AND]](s32)
651 ; FP32-NEXT: RetRA implicit $v0
653 ; FP64-LABEL: name: f64tou8
656 ; FP64-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $d6
657 ; FP64-NEXT: [[FPTOSI:%[0-9]+]]:_(s32) = G_FPTOSI [[COPY]](s64)
658 ; FP64-NEXT: [[C:%[0-9]+]]:_(s64) = G_FCONSTANT double 0x41E0000000000000
659 ; FP64-NEXT: [[FSUB:%[0-9]+]]:_(s64) = G_FSUB [[COPY]], [[C]]
660 ; FP64-NEXT: [[FPTOSI1:%[0-9]+]]:_(s32) = G_FPTOSI [[FSUB]](s64)
661 ; FP64-NEXT: [[C1:%[0-9]+]]:_(s32) = G_CONSTANT i32 -2147483648
662 ; FP64-NEXT: [[XOR:%[0-9]+]]:_(s32) = G_XOR [[FPTOSI1]], [[C1]]
663 ; FP64-NEXT: [[FCMP:%[0-9]+]]:_(s32) = G_FCMP floatpred(ult), [[COPY]](s64), [[C]]
664 ; FP64-NEXT: [[SELECT:%[0-9]+]]:_(s32) = G_SELECT [[FCMP]](s32), [[FPTOSI]], [[XOR]]
665 ; FP64-NEXT: [[C2:%[0-9]+]]:_(s32) = G_CONSTANT i32 255
666 ; FP64-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[SELECT]], [[C2]]
667 ; FP64-NEXT: $v0 = COPY [[AND]](s32)
668 ; FP64-NEXT: RetRA implicit $v0
670 %1:_(s8) = G_FPTOUI %0(s64)
671 %2:_(s32) = G_ZEXT %1(s8)