[MIPS GlobalISel] NarrowScalar G_ZEXTLOAD and G_SEXTLOAD
[llvm-complete.git] / test / CodeGen / Mips / GlobalISel / llvm-ir / sitofp_and_uitofp.ll
blob3803c661e17b10743ed305cf52eb5e7d73edfc7d
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
13 ; MIPS32-NEXT:    nop
14 ; MIPS32-NEXT:    lw $ra, 20($sp) # 4-byte Folded Reload
15 ; MIPS32-NEXT:    addiu $sp, $sp, 24
16 ; MIPS32-NEXT:    jr $ra
17 ; MIPS32-NEXT:    nop
18 entry:
19   %conv = sitofp i64 %a to float
20   ret float %conv
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
28 ; MIPS32-NEXT:    jr $ra
29 ; MIPS32-NEXT:    nop
30 entry:
31   %conv = sitofp i32 %a to float
32   ret float %conv
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
42 ; MIPS32-NEXT:    jr $ra
43 ; MIPS32-NEXT:    nop
44 entry:
45   %conv = sitofp i16 %a to float
46   ret float %conv
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
56 ; MIPS32-NEXT:    jr $ra
57 ; MIPS32-NEXT:    nop
58 entry:
59   %conv = sitofp i8 %a to float
60   ret float %conv
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
71 ; MIPS32-NEXT:    nop
72 ; MIPS32-NEXT:    lw $ra, 20($sp) # 4-byte Folded Reload
73 ; MIPS32-NEXT:    addiu $sp, $sp, 24
74 ; MIPS32-NEXT:    jr $ra
75 ; MIPS32-NEXT:    nop
76 entry:
77   %conv = sitofp i64 %a to double
78   ret double %conv
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
86 ; MIPS32-NEXT:    jr $ra
87 ; MIPS32-NEXT:    nop
88 entry:
89   %conv = sitofp i32 %a to double
90   ret double %conv
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
101 ; MIPS32-NEXT:    nop
102 entry:
103   %conv = sitofp i16 %a to double
104   ret double %conv
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
115 ; MIPS32-NEXT:    nop
116 entry:
117   %conv = sitofp i8 %a to double
118   ret double %conv
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
129 ; MIPS32-NEXT:    nop
130 ; MIPS32-NEXT:    lw $ra, 20($sp) # 4-byte Folded Reload
131 ; MIPS32-NEXT:    addiu $sp, $sp, 24
132 ; MIPS32-NEXT:    jr $ra
133 ; MIPS32-NEXT:    nop
134 entry:
135   %conv = uitofp i64 %a to float
136   ret float %conv
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
147 ; MIPS32-NEXT:    nop
148 ; MIPS32-NEXT:    lw $ra, 20($sp) # 4-byte Folded Reload
149 ; MIPS32-NEXT:    addiu $sp, $sp, 24
150 ; MIPS32-NEXT:    jr $ra
151 ; MIPS32-NEXT:    nop
152 entry:
153   %conv = uitofp i64 %a to double
154   ret double %conv