1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -verify-machineinstrs %s -o -| FileCheck %s -check-prefixes=MIPS32,FP32
3 ; RUN: llc -O0 -mtriple=mipsel-linux-gnu -mattr=+fp64,+mips32r2 -global-isel -verify-machineinstrs %s -o -| FileCheck %s -check-prefixes=MIPS32,FP64
5 define float @i64tof32(i64 signext %a) {
6 ; MIPS32-LABEL: i64tof32:
7 ; MIPS32: # %bb.0: # %entry
8 ; MIPS32-NEXT: addiu $sp, $sp, -24
9 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
10 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
11 ; MIPS32-NEXT: .cfi_offset 31, -4
12 ; MIPS32-NEXT: jal __floatdisf
14 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
15 ; MIPS32-NEXT: addiu $sp, $sp, 24
19 %conv = sitofp i64 %a to float
23 define float @i32tof32(i32 signext %a) {
24 ; MIPS32-LABEL: i32tof32:
25 ; MIPS32: # %bb.0: # %entry
26 ; MIPS32-NEXT: mtc1 $4, $f0
27 ; MIPS32-NEXT: cvt.s.w $f0, $f0
31 %conv = sitofp i32 %a to float
35 define float @i16tof32(i16 signext %a) {
36 ; MIPS32-LABEL: i16tof32:
37 ; MIPS32: # %bb.0: # %entry
38 ; MIPS32-NEXT: sll $1, $4, 16
39 ; MIPS32-NEXT: sra $1, $1, 16
40 ; MIPS32-NEXT: mtc1 $1, $f0
41 ; MIPS32-NEXT: cvt.s.w $f0, $f0
45 %conv = sitofp i16 %a to float
49 define float @i8tof32(i8 signext %a) {
50 ; MIPS32-LABEL: i8tof32:
51 ; MIPS32: # %bb.0: # %entry
52 ; MIPS32-NEXT: sll $1, $4, 24
53 ; MIPS32-NEXT: sra $1, $1, 24
54 ; MIPS32-NEXT: mtc1 $1, $f0
55 ; MIPS32-NEXT: cvt.s.w $f0, $f0
59 %conv = sitofp i8 %a to float
63 define double @i64tof64(i64 signext %a) {
64 ; MIPS32-LABEL: i64tof64:
65 ; MIPS32: # %bb.0: # %entry
66 ; MIPS32-NEXT: addiu $sp, $sp, -24
67 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
68 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
69 ; MIPS32-NEXT: .cfi_offset 31, -4
70 ; MIPS32-NEXT: jal __floatdidf
72 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
73 ; MIPS32-NEXT: addiu $sp, $sp, 24
77 %conv = sitofp i64 %a to double
81 define double @i32tof64(i32 signext %a) {
82 ; MIPS32-LABEL: i32tof64:
83 ; MIPS32: # %bb.0: # %entry
84 ; MIPS32-NEXT: mtc1 $4, $f0
85 ; MIPS32-NEXT: cvt.d.w $f0, $f0
89 %conv = sitofp i32 %a to double
93 define double @i16tof64(i16 signext %a) {
94 ; MIPS32-LABEL: i16tof64:
95 ; MIPS32: # %bb.0: # %entry
96 ; MIPS32-NEXT: sll $1, $4, 16
97 ; MIPS32-NEXT: sra $1, $1, 16
98 ; MIPS32-NEXT: mtc1 $1, $f0
99 ; MIPS32-NEXT: cvt.d.w $f0, $f0
100 ; MIPS32-NEXT: jr $ra
103 %conv = sitofp i16 %a to double
107 define double @i8tof64(i8 signext %a) {
108 ; MIPS32-LABEL: i8tof64:
109 ; MIPS32: # %bb.0: # %entry
110 ; MIPS32-NEXT: sll $1, $4, 24
111 ; MIPS32-NEXT: sra $1, $1, 24
112 ; MIPS32-NEXT: mtc1 $1, $f0
113 ; MIPS32-NEXT: cvt.d.w $f0, $f0
114 ; MIPS32-NEXT: jr $ra
117 %conv = sitofp i8 %a to double
121 define float @u64tof32(i64 zeroext %a) {
122 ; MIPS32-LABEL: u64tof32:
123 ; MIPS32: # %bb.0: # %entry
124 ; MIPS32-NEXT: addiu $sp, $sp, -24
125 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
126 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
127 ; MIPS32-NEXT: .cfi_offset 31, -4
128 ; MIPS32-NEXT: jal __floatundisf
130 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
131 ; MIPS32-NEXT: addiu $sp, $sp, 24
132 ; MIPS32-NEXT: jr $ra
135 %conv = uitofp i64 %a to float
139 define double @u64tof64(i64 zeroext %a) {
140 ; MIPS32-LABEL: u64tof64:
141 ; MIPS32: # %bb.0: # %entry
142 ; MIPS32-NEXT: addiu $sp, $sp, -24
143 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
144 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
145 ; MIPS32-NEXT: .cfi_offset 31, -4
146 ; MIPS32-NEXT: jal __floatundidf
148 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
149 ; MIPS32-NEXT: addiu $sp, $sp, 24
150 ; MIPS32-NEXT: jr $ra
153 %conv = uitofp i64 %a to double