1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 ; RUN: llc -O0 -mtriple=mipsel-linux-gnu -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32
5 define signext i8 @sext_arg_i8(i8 signext %a) {
6 ; MIPS32-LABEL: name: sext_arg_i8
9 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
10 ; MIPS32: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
11 ; MIPS32: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC]](s8)
12 ; MIPS32: $v0 = COPY [[SEXT]](s32)
13 ; MIPS32: RetRA implicit $v0
18 define zeroext i8 @zext_arg_i8(i8 zeroext %a) {
19 ; MIPS32-LABEL: name: zext_arg_i8
21 ; MIPS32: liveins: $a0
22 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
23 ; MIPS32: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
24 ; MIPS32: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[TRUNC]](s8)
25 ; MIPS32: $v0 = COPY [[ZEXT]](s32)
26 ; MIPS32: RetRA implicit $v0
31 define i8 @aext_arg_i8(i8 %a) {
32 ; MIPS32-LABEL: name: aext_arg_i8
34 ; MIPS32: liveins: $a0
35 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
36 ; MIPS32: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
37 ; MIPS32: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[TRUNC]](s8)
38 ; MIPS32: $v0 = COPY [[ANYEXT]](s32)
39 ; MIPS32: RetRA implicit $v0
44 declare signext i8 @sext_stack_arg_i8(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i8 %a)
45 declare zeroext i8 @zext_stack_arg_i8(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i8 %a)
46 declare i8 @aext_stack_arg_i8(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i8 %a)
48 define signext i8 @call_sext_stack_arg_i8(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i8 signext %a) {
49 ; MIPS32-LABEL: name: call_sext_stack_arg_i8
51 ; MIPS32: liveins: $a0, $a1, $a2, $a3
52 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
53 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
54 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
55 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
56 ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
57 ; MIPS32: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load 4 from %fixed-stack.0, align 8)
58 ; MIPS32: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD]](s32)
59 ; MIPS32: ADJCALLSTACKDOWN 24, 0, implicit-def $sp, implicit $sp
60 ; MIPS32: $a0 = COPY [[COPY]](s32)
61 ; MIPS32: $a1 = COPY [[COPY1]](s32)
62 ; MIPS32: $a2 = COPY [[COPY2]](s32)
63 ; MIPS32: $a3 = COPY [[COPY3]](s32)
64 ; MIPS32: [[COPY4:%[0-9]+]]:_(p0) = COPY $sp
65 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
66 ; MIPS32: [[GEP:%[0-9]+]]:_(p0) = G_GEP [[COPY4]], [[C]](s32)
67 ; MIPS32: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC]](s8)
68 ; MIPS32: G_STORE [[SEXT]](s32), [[GEP]](p0) :: (store 4 into stack + 16, align 8)
69 ; MIPS32: JAL @sext_stack_arg_i8, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit $a2, implicit $a3, implicit-def $v0
70 ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY $v0
71 ; MIPS32: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY5]](s32)
72 ; MIPS32: ADJCALLSTACKUP 24, 0, implicit-def $sp, implicit $sp
73 ; MIPS32: [[SEXT1:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC1]](s8)
74 ; MIPS32: $v0 = COPY [[SEXT1]](s32)
75 ; MIPS32: RetRA implicit $v0
77 %call = call signext i8 @sext_stack_arg_i8(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i8 signext %a)
81 define zeroext i8 @call_zext_stack_arg_i8(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i8 zeroext %a) {
82 ; MIPS32-LABEL: name: call_zext_stack_arg_i8
84 ; MIPS32: liveins: $a0, $a1, $a2, $a3
85 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
86 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
87 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
88 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
89 ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
90 ; MIPS32: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load 4 from %fixed-stack.0, align 8)
91 ; MIPS32: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD]](s32)
92 ; MIPS32: ADJCALLSTACKDOWN 24, 0, implicit-def $sp, implicit $sp
93 ; MIPS32: $a0 = COPY [[COPY]](s32)
94 ; MIPS32: $a1 = COPY [[COPY1]](s32)
95 ; MIPS32: $a2 = COPY [[COPY2]](s32)
96 ; MIPS32: $a3 = COPY [[COPY3]](s32)
97 ; MIPS32: [[COPY4:%[0-9]+]]:_(p0) = COPY $sp
98 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
99 ; MIPS32: [[GEP:%[0-9]+]]:_(p0) = G_GEP [[COPY4]], [[C]](s32)
100 ; MIPS32: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[TRUNC]](s8)
101 ; MIPS32: G_STORE [[ZEXT]](s32), [[GEP]](p0) :: (store 4 into stack + 16, align 8)
102 ; MIPS32: JAL @zext_stack_arg_i8, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit $a2, implicit $a3, implicit-def $v0
103 ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY $v0
104 ; MIPS32: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY5]](s32)
105 ; MIPS32: ADJCALLSTACKUP 24, 0, implicit-def $sp, implicit $sp
106 ; MIPS32: [[ZEXT1:%[0-9]+]]:_(s32) = G_ZEXT [[TRUNC1]](s8)
107 ; MIPS32: $v0 = COPY [[ZEXT1]](s32)
108 ; MIPS32: RetRA implicit $v0
110 %call = call zeroext i8 @zext_stack_arg_i8(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i8 zeroext %a)
114 define i8 @call_aext_stack_arg_i8(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i8 %a) {
115 ; MIPS32-LABEL: name: call_aext_stack_arg_i8
116 ; MIPS32: bb.1.entry:
117 ; MIPS32: liveins: $a0, $a1, $a2, $a3
118 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
119 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
120 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
121 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
122 ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
123 ; MIPS32: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load 4 from %fixed-stack.0, align 8)
124 ; MIPS32: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[LOAD]](s32)
125 ; MIPS32: ADJCALLSTACKDOWN 24, 0, implicit-def $sp, implicit $sp
126 ; MIPS32: $a0 = COPY [[COPY]](s32)
127 ; MIPS32: $a1 = COPY [[COPY1]](s32)
128 ; MIPS32: $a2 = COPY [[COPY2]](s32)
129 ; MIPS32: $a3 = COPY [[COPY3]](s32)
130 ; MIPS32: [[COPY4:%[0-9]+]]:_(p0) = COPY $sp
131 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
132 ; MIPS32: [[GEP:%[0-9]+]]:_(p0) = G_GEP [[COPY4]], [[C]](s32)
133 ; MIPS32: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[TRUNC]](s8)
134 ; MIPS32: G_STORE [[ANYEXT]](s32), [[GEP]](p0) :: (store 4 into stack + 16, align 8)
135 ; MIPS32: JAL @aext_stack_arg_i8, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit $a2, implicit $a3, implicit-def $v0
136 ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY $v0
137 ; MIPS32: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY5]](s32)
138 ; MIPS32: ADJCALLSTACKUP 24, 0, implicit-def $sp, implicit $sp
139 ; MIPS32: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[TRUNC1]](s8)
140 ; MIPS32: $v0 = COPY [[ANYEXT1]](s32)
141 ; MIPS32: RetRA implicit $v0
143 %call = call i8 @aext_stack_arg_i8(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i8 %a)
148 define signext i16 @sext_arg_i16(i16 signext %a) {
149 ; MIPS32-LABEL: name: sext_arg_i16
150 ; MIPS32: bb.1.entry:
151 ; MIPS32: liveins: $a0
152 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
153 ; MIPS32: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
154 ; MIPS32: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC]](s16)
155 ; MIPS32: $v0 = COPY [[SEXT]](s32)
156 ; MIPS32: RetRA implicit $v0
161 define zeroext i16 @zext_arg_i16(i16 zeroext %a) {
162 ; MIPS32-LABEL: name: zext_arg_i16
163 ; MIPS32: bb.1.entry:
164 ; MIPS32: liveins: $a0
165 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
166 ; MIPS32: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
167 ; MIPS32: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[TRUNC]](s16)
168 ; MIPS32: $v0 = COPY [[ZEXT]](s32)
169 ; MIPS32: RetRA implicit $v0
174 define i16 @aext_arg_i16(i16 %a) {
175 ; MIPS32-LABEL: name: aext_arg_i16
176 ; MIPS32: bb.1.entry:
177 ; MIPS32: liveins: $a0
178 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
179 ; MIPS32: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
180 ; MIPS32: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[TRUNC]](s16)
181 ; MIPS32: $v0 = COPY [[ANYEXT]](s32)
182 ; MIPS32: RetRA implicit $v0
187 declare signext i16 @sext_stack_arg_i16(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i16 %a)
188 declare zeroext i16 @zext_stack_arg_i16(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i16 %a)
189 declare i16 @aext_stack_arg_i16(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i16 %a)
191 define signext i16 @call_sext_stack_arg_i16(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i16 signext %a) {
192 ; MIPS32-LABEL: name: call_sext_stack_arg_i16
193 ; MIPS32: bb.1.entry:
194 ; MIPS32: liveins: $a0, $a1, $a2, $a3
195 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
196 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
197 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
198 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
199 ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
200 ; MIPS32: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load 4 from %fixed-stack.0, align 8)
201 ; MIPS32: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[LOAD]](s32)
202 ; MIPS32: ADJCALLSTACKDOWN 24, 0, implicit-def $sp, implicit $sp
203 ; MIPS32: $a0 = COPY [[COPY]](s32)
204 ; MIPS32: $a1 = COPY [[COPY1]](s32)
205 ; MIPS32: $a2 = COPY [[COPY2]](s32)
206 ; MIPS32: $a3 = COPY [[COPY3]](s32)
207 ; MIPS32: [[COPY4:%[0-9]+]]:_(p0) = COPY $sp
208 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
209 ; MIPS32: [[GEP:%[0-9]+]]:_(p0) = G_GEP [[COPY4]], [[C]](s32)
210 ; MIPS32: [[SEXT:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC]](s16)
211 ; MIPS32: G_STORE [[SEXT]](s32), [[GEP]](p0) :: (store 4 into stack + 16, align 8)
212 ; MIPS32: JAL @sext_stack_arg_i16, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit $a2, implicit $a3, implicit-def $v0
213 ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY $v0
214 ; MIPS32: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY5]](s32)
215 ; MIPS32: ADJCALLSTACKUP 24, 0, implicit-def $sp, implicit $sp
216 ; MIPS32: [[SEXT1:%[0-9]+]]:_(s32) = G_SEXT [[TRUNC1]](s16)
217 ; MIPS32: $v0 = COPY [[SEXT1]](s32)
218 ; MIPS32: RetRA implicit $v0
220 %call = call signext i16 @sext_stack_arg_i16(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i16 signext %a)
224 define zeroext i16 @call_zext_stack_arg_i16(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i16 zeroext %a) {
225 ; MIPS32-LABEL: name: call_zext_stack_arg_i16
226 ; MIPS32: bb.1.entry:
227 ; MIPS32: liveins: $a0, $a1, $a2, $a3
228 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
229 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
230 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
231 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
232 ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
233 ; MIPS32: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load 4 from %fixed-stack.0, align 8)
234 ; MIPS32: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[LOAD]](s32)
235 ; MIPS32: ADJCALLSTACKDOWN 24, 0, implicit-def $sp, implicit $sp
236 ; MIPS32: $a0 = COPY [[COPY]](s32)
237 ; MIPS32: $a1 = COPY [[COPY1]](s32)
238 ; MIPS32: $a2 = COPY [[COPY2]](s32)
239 ; MIPS32: $a3 = COPY [[COPY3]](s32)
240 ; MIPS32: [[COPY4:%[0-9]+]]:_(p0) = COPY $sp
241 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
242 ; MIPS32: [[GEP:%[0-9]+]]:_(p0) = G_GEP [[COPY4]], [[C]](s32)
243 ; MIPS32: [[ZEXT:%[0-9]+]]:_(s32) = G_ZEXT [[TRUNC]](s16)
244 ; MIPS32: G_STORE [[ZEXT]](s32), [[GEP]](p0) :: (store 4 into stack + 16, align 8)
245 ; MIPS32: JAL @zext_stack_arg_i16, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit $a2, implicit $a3, implicit-def $v0
246 ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY $v0
247 ; MIPS32: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY5]](s32)
248 ; MIPS32: ADJCALLSTACKUP 24, 0, implicit-def $sp, implicit $sp
249 ; MIPS32: [[ZEXT1:%[0-9]+]]:_(s32) = G_ZEXT [[TRUNC1]](s16)
250 ; MIPS32: $v0 = COPY [[ZEXT1]](s32)
251 ; MIPS32: RetRA implicit $v0
253 %call = call zeroext i16 @zext_stack_arg_i16(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i16 zeroext %a)
257 define i16 @call_aext_stack_arg_i16(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i16 %a) {
258 ; MIPS32-LABEL: name: call_aext_stack_arg_i16
259 ; MIPS32: bb.1.entry:
260 ; MIPS32: liveins: $a0, $a1, $a2, $a3
261 ; MIPS32: [[COPY:%[0-9]+]]:_(s32) = COPY $a0
262 ; MIPS32: [[COPY1:%[0-9]+]]:_(s32) = COPY $a1
263 ; MIPS32: [[COPY2:%[0-9]+]]:_(s32) = COPY $a2
264 ; MIPS32: [[COPY3:%[0-9]+]]:_(s32) = COPY $a3
265 ; MIPS32: [[FRAME_INDEX:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.0
266 ; MIPS32: [[LOAD:%[0-9]+]]:_(s32) = G_LOAD [[FRAME_INDEX]](p0) :: (load 4 from %fixed-stack.0, align 8)
267 ; MIPS32: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[LOAD]](s32)
268 ; MIPS32: ADJCALLSTACKDOWN 24, 0, implicit-def $sp, implicit $sp
269 ; MIPS32: $a0 = COPY [[COPY]](s32)
270 ; MIPS32: $a1 = COPY [[COPY1]](s32)
271 ; MIPS32: $a2 = COPY [[COPY2]](s32)
272 ; MIPS32: $a3 = COPY [[COPY3]](s32)
273 ; MIPS32: [[COPY4:%[0-9]+]]:_(p0) = COPY $sp
274 ; MIPS32: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
275 ; MIPS32: [[GEP:%[0-9]+]]:_(p0) = G_GEP [[COPY4]], [[C]](s32)
276 ; MIPS32: [[ANYEXT:%[0-9]+]]:_(s32) = G_ANYEXT [[TRUNC]](s16)
277 ; MIPS32: G_STORE [[ANYEXT]](s32), [[GEP]](p0) :: (store 4 into stack + 16, align 8)
278 ; MIPS32: JAL @aext_stack_arg_i16, csr_o32, implicit-def $ra, implicit-def $sp, implicit $a0, implicit $a1, implicit $a2, implicit $a3, implicit-def $v0
279 ; MIPS32: [[COPY5:%[0-9]+]]:_(s32) = COPY $v0
280 ; MIPS32: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY5]](s32)
281 ; MIPS32: ADJCALLSTACKUP 24, 0, implicit-def $sp, implicit $sp
282 ; MIPS32: [[ANYEXT1:%[0-9]+]]:_(s32) = G_ANYEXT [[TRUNC1]](s16)
283 ; MIPS32: $v0 = COPY [[ANYEXT1]](s32)
284 ; MIPS32: RetRA implicit $v0
286 %call = call i16 @aext_stack_arg_i16(i32 %x1, i32 %x2, i32 %x3, i32 %x4, i16 %a)