1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -csky-no-aliases -mattr=+2e3 < %s -mtriple=csky | FileCheck %s
3 ; RUN: llc -verify-machineinstrs -csky-no-aliases < %s -mtriple=csky | FileCheck %s --check-prefix=GENERIC
5 define signext i1 @load_I_bits(ptr nocapture readonly %a) local_unnamed_addr #0 {
6 ; CHECK-LABEL: load_I_bits:
7 ; CHECK: # %bb.0: # %entry
8 ; CHECK-NEXT: ld16.b a0, (a0, 3)
9 ; CHECK-NEXT: sext32 a0, a0, 0, 0
12 ; GENERIC-LABEL: load_I_bits:
13 ; GENERIC: # %bb.0: # %entry
14 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
15 ; GENERIC-NEXT: subi16 sp, sp, 4
16 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
17 ; GENERIC-NEXT: ld16.b a0, (a0, 3)
18 ; GENERIC-NEXT: lsli16 a0, a0, 7
19 ; GENERIC-NEXT: asri16 a0, a0, 7
20 ; GENERIC-NEXT: addi16 sp, sp, 4
23 %arrayidx = getelementptr inbounds i1, ptr %a, i64 3
24 %0 = load i1, ptr %arrayidx, align 1
28 define zeroext i1 @load_I_bit_(ptr nocapture readonly %a) local_unnamed_addr #0 {
29 ; CHECK-LABEL: load_I_bit_:
30 ; CHECK: # %bb.0: # %entry
31 ; CHECK-NEXT: ld16.b a0, (a0, 3)
34 ; GENERIC-LABEL: load_I_bit_:
35 ; GENERIC: # %bb.0: # %entry
36 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
37 ; GENERIC-NEXT: subi16 sp, sp, 4
38 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
39 ; GENERIC-NEXT: ld16.b a0, (a0, 3)
40 ; GENERIC-NEXT: addi16 sp, sp, 4
43 %arrayidx = getelementptr inbounds i1, ptr %a, i64 3
44 %0 = load i1, ptr %arrayidx, align 1
48 define signext i8 @load_I_bs(ptr nocapture readonly %a) local_unnamed_addr #0 {
49 ; CHECK-LABEL: load_I_bs:
50 ; CHECK: # %bb.0: # %entry
51 ; CHECK-NEXT: ld32.bs a0, (a0, 3)
54 ; GENERIC-LABEL: load_I_bs:
55 ; GENERIC: # %bb.0: # %entry
56 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
57 ; GENERIC-NEXT: subi16 sp, sp, 4
58 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
59 ; GENERIC-NEXT: ld16.b a0, (a0, 3)
60 ; GENERIC-NEXT: sextb16 a0, a0
61 ; GENERIC-NEXT: addi16 sp, sp, 4
64 %arrayidx = getelementptr inbounds i8, ptr %a, i64 3
65 %0 = load i8, ptr %arrayidx, align 1
69 define zeroext i8 @load_I_b_(ptr nocapture readonly %a) local_unnamed_addr #0 {
70 ; CHECK-LABEL: load_I_b_:
71 ; CHECK: # %bb.0: # %entry
72 ; CHECK-NEXT: ld16.b a0, (a0, 3)
75 ; GENERIC-LABEL: load_I_b_:
76 ; GENERIC: # %bb.0: # %entry
77 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
78 ; GENERIC-NEXT: subi16 sp, sp, 4
79 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
80 ; GENERIC-NEXT: ld16.b a0, (a0, 3)
81 ; GENERIC-NEXT: addi16 sp, sp, 4
84 %arrayidx = getelementptr inbounds i8, ptr %a, i64 3
85 %0 = load i8, ptr %arrayidx, align 1
89 define signext i16 @load_I_hs(ptr nocapture readonly %a) local_unnamed_addr #0 {
90 ; CHECK-LABEL: load_I_hs:
91 ; CHECK: # %bb.0: # %entry
92 ; CHECK-NEXT: ld32.hs a0, (a0, 6)
95 ; GENERIC-LABEL: load_I_hs:
96 ; GENERIC: # %bb.0: # %entry
97 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
98 ; GENERIC-NEXT: subi16 sp, sp, 4
99 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
100 ; GENERIC-NEXT: ld16.h a0, (a0, 6)
101 ; GENERIC-NEXT: sexth16 a0, a0
102 ; GENERIC-NEXT: addi16 sp, sp, 4
103 ; GENERIC-NEXT: rts16
105 %arrayidx = getelementptr inbounds i16, ptr %a, i64 3
106 %0 = load i16, ptr %arrayidx, align 2
110 define zeroext i16 @load_I_h_(ptr nocapture readonly %a) local_unnamed_addr #0 {
111 ; CHECK-LABEL: load_I_h_:
112 ; CHECK: # %bb.0: # %entry
113 ; CHECK-NEXT: ld16.h a0, (a0, 6)
116 ; GENERIC-LABEL: load_I_h_:
117 ; GENERIC: # %bb.0: # %entry
118 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
119 ; GENERIC-NEXT: subi16 sp, sp, 4
120 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
121 ; GENERIC-NEXT: ld16.h a0, (a0, 6)
122 ; GENERIC-NEXT: addi16 sp, sp, 4
123 ; GENERIC-NEXT: rts16
125 %arrayidx = getelementptr inbounds i16, ptr %a, i64 3
126 %0 = load i16, ptr %arrayidx, align 2
130 define i32 @load_I_w(ptr nocapture readonly %a) local_unnamed_addr #0 {
131 ; CHECK-LABEL: load_I_w:
132 ; CHECK: # %bb.0: # %entry
133 ; CHECK-NEXT: ld16.w a0, (a0, 12)
136 ; GENERIC-LABEL: load_I_w:
137 ; GENERIC: # %bb.0: # %entry
138 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
139 ; GENERIC-NEXT: subi16 sp, sp, 4
140 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
141 ; GENERIC-NEXT: ld16.w a0, (a0, 12)
142 ; GENERIC-NEXT: addi16 sp, sp, 4
143 ; GENERIC-NEXT: rts16
145 %arrayidx = getelementptr inbounds i32, ptr %a, i64 3
146 %0 = load i32, ptr %arrayidx, align 4
150 define i64 @load_I_d(ptr nocapture readonly %a) local_unnamed_addr #0 {
151 ; CHECK-LABEL: load_I_d:
152 ; CHECK: # %bb.0: # %entry
153 ; CHECK-NEXT: ld16.w a2, (a0, 24)
154 ; CHECK-NEXT: ld16.w a1, (a0, 28)
155 ; CHECK-NEXT: mov16 a0, a2
158 ; GENERIC-LABEL: load_I_d:
159 ; GENERIC: # %bb.0: # %entry
160 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
161 ; GENERIC-NEXT: subi16 sp, sp, 4
162 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
163 ; GENERIC-NEXT: ld16.w a2, (a0, 24)
164 ; GENERIC-NEXT: ld16.w a1, (a0, 28)
165 ; GENERIC-NEXT: mov16 a0, a2
166 ; GENERIC-NEXT: addi16 sp, sp, 4
167 ; GENERIC-NEXT: rts16
169 %arrayidx = getelementptr inbounds i64, ptr %a, i64 3
170 %0 = load i64, ptr %arrayidx, align 4
174 define i8 @load_I_i8_anyext(ptr %p) {
175 ; CHECK-LABEL: load_I_i8_anyext:
176 ; CHECK: # %bb.0: # %entry
177 ; CHECK-NEXT: ld16.b a0, (a0, 0)
180 ; GENERIC-LABEL: load_I_i8_anyext:
181 ; GENERIC: # %bb.0: # %entry
182 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
183 ; GENERIC-NEXT: subi16 sp, sp, 4
184 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
185 ; GENERIC-NEXT: ld16.b a0, (a0, 0)
186 ; GENERIC-NEXT: addi16 sp, sp, 4
187 ; GENERIC-NEXT: rts16
189 %ret = load i8, ptr %p, align 1
193 define signext i1 @load_R_bits(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 {
194 ; CHECK-LABEL: load_R_bits:
195 ; CHECK: # %bb.0: # %entry
196 ; CHECK-NEXT: ldr32.bs a0, (a0, a1 << 0)
197 ; CHECK-NEXT: sext32 a0, a0, 0, 0
200 ; GENERIC-LABEL: load_R_bits:
201 ; GENERIC: # %bb.0: # %entry
202 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
203 ; GENERIC-NEXT: subi16 sp, sp, 4
204 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
205 ; GENERIC-NEXT: addu16 a0, a0, a1
206 ; GENERIC-NEXT: ld16.b a0, (a0, 0)
207 ; GENERIC-NEXT: lsli16 a0, a0, 7
208 ; GENERIC-NEXT: asri16 a0, a0, 7
209 ; GENERIC-NEXT: addi16 sp, sp, 4
210 ; GENERIC-NEXT: rts16
212 %idxprom = sext i32 %b to i64
213 %arrayidx = getelementptr inbounds i1, ptr %a, i64 %idxprom
214 %0 = load i1, ptr %arrayidx, align 1
218 define zeroext i1 @load_R_bit_(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 {
219 ; CHECK-LABEL: load_R_bit_:
220 ; CHECK: # %bb.0: # %entry
221 ; CHECK-NEXT: ldr32.b a0, (a0, a1 << 0)
224 ; GENERIC-LABEL: load_R_bit_:
225 ; GENERIC: # %bb.0: # %entry
226 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
227 ; GENERIC-NEXT: subi16 sp, sp, 4
228 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
229 ; GENERIC-NEXT: addu16 a0, a0, a1
230 ; GENERIC-NEXT: ld16.b a0, (a0, 0)
231 ; GENERIC-NEXT: addi16 sp, sp, 4
232 ; GENERIC-NEXT: rts16
234 %idxprom = sext i32 %b to i64
235 %arrayidx = getelementptr inbounds i1, ptr %a, i64 %idxprom
236 %0 = load i1, ptr %arrayidx, align 1
241 define signext i8 @load_R_bs(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 {
242 ; CHECK-LABEL: load_R_bs:
243 ; CHECK: # %bb.0: # %entry
244 ; CHECK-NEXT: ldr32.bs a0, (a0, a1 << 0)
247 ; GENERIC-LABEL: load_R_bs:
248 ; GENERIC: # %bb.0: # %entry
249 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
250 ; GENERIC-NEXT: subi16 sp, sp, 4
251 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
252 ; GENERIC-NEXT: addu16 a0, a0, a1
253 ; GENERIC-NEXT: ld16.b a0, (a0, 0)
254 ; GENERIC-NEXT: sextb16 a0, a0
255 ; GENERIC-NEXT: addi16 sp, sp, 4
256 ; GENERIC-NEXT: rts16
258 %idxprom = sext i32 %b to i64
259 %arrayidx = getelementptr inbounds i8, ptr %a, i64 %idxprom
260 %0 = load i8, ptr %arrayidx, align 1
264 define zeroext i8 @load_R_b_(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 {
265 ; CHECK-LABEL: load_R_b_:
266 ; CHECK: # %bb.0: # %entry
267 ; CHECK-NEXT: ldr32.b a0, (a0, a1 << 0)
270 ; GENERIC-LABEL: load_R_b_:
271 ; GENERIC: # %bb.0: # %entry
272 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
273 ; GENERIC-NEXT: subi16 sp, sp, 4
274 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
275 ; GENERIC-NEXT: addu16 a0, a0, a1
276 ; GENERIC-NEXT: ld16.b a0, (a0, 0)
277 ; GENERIC-NEXT: addi16 sp, sp, 4
278 ; GENERIC-NEXT: rts16
280 %idxprom = sext i32 %b to i64
281 %arrayidx = getelementptr inbounds i8, ptr %a, i64 %idxprom
282 %0 = load i8, ptr %arrayidx, align 1
286 define signext i16 @load_R_hs(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 {
287 ; CHECK-LABEL: load_R_hs:
288 ; CHECK: # %bb.0: # %entry
289 ; CHECK-NEXT: ldr32.hs a0, (a0, a1 << 1)
292 ; GENERIC-LABEL: load_R_hs:
293 ; GENERIC: # %bb.0: # %entry
294 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
295 ; GENERIC-NEXT: subi16 sp, sp, 4
296 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
297 ; GENERIC-NEXT: lsli16 a1, a1, 1
298 ; GENERIC-NEXT: addu16 a0, a0, a1
299 ; GENERIC-NEXT: ld16.h a0, (a0, 0)
300 ; GENERIC-NEXT: sexth16 a0, a0
301 ; GENERIC-NEXT: addi16 sp, sp, 4
302 ; GENERIC-NEXT: rts16
304 %idxprom = sext i32 %b to i64
305 %arrayidx = getelementptr inbounds i16, ptr %a, i64 %idxprom
306 %0 = load i16, ptr %arrayidx, align 2
310 define zeroext i16 @load_R_h_(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 {
311 ; CHECK-LABEL: load_R_h_:
312 ; CHECK: # %bb.0: # %entry
313 ; CHECK-NEXT: ldr32.h a0, (a0, a1 << 1)
316 ; GENERIC-LABEL: load_R_h_:
317 ; GENERIC: # %bb.0: # %entry
318 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
319 ; GENERIC-NEXT: subi16 sp, sp, 4
320 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
321 ; GENERIC-NEXT: lsli16 a1, a1, 1
322 ; GENERIC-NEXT: addu16 a0, a0, a1
323 ; GENERIC-NEXT: ld16.h a0, (a0, 0)
324 ; GENERIC-NEXT: addi16 sp, sp, 4
325 ; GENERIC-NEXT: rts16
327 %idxprom = sext i32 %b to i64
328 %arrayidx = getelementptr inbounds i16, ptr %a, i64 %idxprom
329 %0 = load i16, ptr %arrayidx, align 2
333 define i32 @load_R_w(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 {
334 ; CHECK-LABEL: load_R_w:
335 ; CHECK: # %bb.0: # %entry
336 ; CHECK-NEXT: ldr32.w a0, (a0, a1 << 2)
339 ; GENERIC-LABEL: load_R_w:
340 ; GENERIC: # %bb.0: # %entry
341 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
342 ; GENERIC-NEXT: subi16 sp, sp, 4
343 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
344 ; GENERIC-NEXT: lsli16 a1, a1, 2
345 ; GENERIC-NEXT: addu16 a0, a0, a1
346 ; GENERIC-NEXT: ld16.w a0, (a0, 0)
347 ; GENERIC-NEXT: addi16 sp, sp, 4
348 ; GENERIC-NEXT: rts16
350 %idxprom = sext i32 %b to i64
351 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
352 %0 = load i32, ptr %arrayidx, align 4
356 define i64 @load_R_d(ptr nocapture readonly %a, i32 %b) local_unnamed_addr #0 {
357 ; CHECK-LABEL: load_R_d:
358 ; CHECK: # %bb.0: # %entry
359 ; CHECK-NEXT: ixd32 a2, a0, a1
360 ; CHECK-NEXT: ldr32.w a0, (a0, a1 << 3)
361 ; CHECK-NEXT: ld16.w a1, (a2, 4)
364 ; GENERIC-LABEL: load_R_d:
365 ; GENERIC: # %bb.0: # %entry
366 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
367 ; GENERIC-NEXT: subi16 sp, sp, 4
368 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
369 ; GENERIC-NEXT: lsli16 a1, a1, 3
370 ; GENERIC-NEXT: addu16 a1, a0, a1
371 ; GENERIC-NEXT: ld16.w a0, (a1, 0)
372 ; GENERIC-NEXT: ld16.w a1, (a1, 4)
373 ; GENERIC-NEXT: addi16 sp, sp, 4
374 ; GENERIC-NEXT: rts16
376 %idxprom = sext i32 %b to i64
377 %arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom
378 %0 = load i64, ptr %arrayidx, align 4
382 define i8 @loadR_i8_anyext(ptr %c, i32 %a) {
383 ; CHECK-LABEL: loadR_i8_anyext:
384 ; CHECK: # %bb.0: # %entry
385 ; CHECK-NEXT: ldr32.bs a0, (a0, a1 << 0)
388 ; GENERIC-LABEL: loadR_i8_anyext:
389 ; GENERIC: # %bb.0: # %entry
390 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
391 ; GENERIC-NEXT: subi16 sp, sp, 4
392 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
393 ; GENERIC-NEXT: addu16 a0, a0, a1
394 ; GENERIC-NEXT: ld16.b a0, (a0, 0)
395 ; GENERIC-NEXT: addi16 sp, sp, 4
396 ; GENERIC-NEXT: rts16
398 %idxprom = sext i32 %a to i64
399 %arrayidx = getelementptr inbounds i8, ptr %c, i64 %idxprom
400 %0 = load i8, ptr %arrayidx, align 1
404 define signext i1 @store_I_bits(ptr %a, i1 %b) local_unnamed_addr #0 {
405 ; CHECK-LABEL: store_I_bits:
406 ; CHECK: # %bb.0: # %entry
407 ; CHECK-NEXT: andi32 a1, a1, 1
408 ; CHECK-NEXT: st16.b a1, (a0, 3)
409 ; CHECK-NEXT: movi16 a0, 0
412 ; GENERIC-LABEL: store_I_bits:
413 ; GENERIC: # %bb.0: # %entry
414 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
415 ; GENERIC-NEXT: subi16 sp, sp, 4
416 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
417 ; GENERIC-NEXT: movi16 a2, 1
418 ; GENERIC-NEXT: and16 a2, a1
419 ; GENERIC-NEXT: st16.b a2, (a0, 3)
420 ; GENERIC-NEXT: movi16 a0, 0
421 ; GENERIC-NEXT: addi16 sp, sp, 4
422 ; GENERIC-NEXT: rts16
424 %arrayidx = getelementptr inbounds i1, ptr %a, i64 3
425 store i1 %b, ptr %arrayidx, align 1
429 define zeroext i1 @store_I_bit_(ptr %a, i1 %b) local_unnamed_addr #0 {
430 ; CHECK-LABEL: store_I_bit_:
431 ; CHECK: # %bb.0: # %entry
432 ; CHECK-NEXT: andi32 a1, a1, 1
433 ; CHECK-NEXT: st16.b a1, (a0, 3)
434 ; CHECK-NEXT: movi16 a0, 0
437 ; GENERIC-LABEL: store_I_bit_:
438 ; GENERIC: # %bb.0: # %entry
439 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
440 ; GENERIC-NEXT: subi16 sp, sp, 4
441 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
442 ; GENERIC-NEXT: movi16 a2, 1
443 ; GENERIC-NEXT: and16 a2, a1
444 ; GENERIC-NEXT: st16.b a2, (a0, 3)
445 ; GENERIC-NEXT: movi16 a0, 0
446 ; GENERIC-NEXT: addi16 sp, sp, 4
447 ; GENERIC-NEXT: rts16
449 %arrayidx = getelementptr inbounds i1, ptr %a, i64 3
450 store i1 %b, ptr %arrayidx, align 1
454 define signext i8 @store_I_bs(ptr %a, i8 %b) local_unnamed_addr #0 {
455 ; CHECK-LABEL: store_I_bs:
456 ; CHECK: # %bb.0: # %entry
457 ; CHECK-NEXT: st16.b a1, (a0, 3)
458 ; CHECK-NEXT: movi16 a0, 0
461 ; GENERIC-LABEL: store_I_bs:
462 ; GENERIC: # %bb.0: # %entry
463 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
464 ; GENERIC-NEXT: subi16 sp, sp, 4
465 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
466 ; GENERIC-NEXT: st16.b a1, (a0, 3)
467 ; GENERIC-NEXT: movi16 a0, 0
468 ; GENERIC-NEXT: addi16 sp, sp, 4
469 ; GENERIC-NEXT: rts16
471 %arrayidx = getelementptr inbounds i8, ptr %a, i64 3
472 store i8 %b, ptr %arrayidx, align 1
476 define zeroext i8 @store_I_b_(ptr %a, i8 %b) local_unnamed_addr #0 {
477 ; CHECK-LABEL: store_I_b_:
478 ; CHECK: # %bb.0: # %entry
479 ; CHECK-NEXT: st16.b a1, (a0, 3)
480 ; CHECK-NEXT: movi16 a0, 0
483 ; GENERIC-LABEL: store_I_b_:
484 ; GENERIC: # %bb.0: # %entry
485 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
486 ; GENERIC-NEXT: subi16 sp, sp, 4
487 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
488 ; GENERIC-NEXT: st16.b a1, (a0, 3)
489 ; GENERIC-NEXT: movi16 a0, 0
490 ; GENERIC-NEXT: addi16 sp, sp, 4
491 ; GENERIC-NEXT: rts16
493 %arrayidx = getelementptr inbounds i8, ptr %a, i64 3
494 store i8 %b, ptr %arrayidx, align 1
498 define signext i16 @store_I_hs(ptr %a, i16 %b) local_unnamed_addr #0 {
499 ; CHECK-LABEL: store_I_hs:
500 ; CHECK: # %bb.0: # %entry
501 ; CHECK-NEXT: st16.h a1, (a0, 6)
502 ; CHECK-NEXT: movi16 a0, 0
505 ; GENERIC-LABEL: store_I_hs:
506 ; GENERIC: # %bb.0: # %entry
507 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
508 ; GENERIC-NEXT: subi16 sp, sp, 4
509 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
510 ; GENERIC-NEXT: st16.h a1, (a0, 6)
511 ; GENERIC-NEXT: movi16 a0, 0
512 ; GENERIC-NEXT: addi16 sp, sp, 4
513 ; GENERIC-NEXT: rts16
515 %arrayidx = getelementptr inbounds i16, ptr %a, i64 3
516 store i16 %b, ptr %arrayidx, align 2
520 define zeroext i16 @store_I_h_(ptr %a, i16 %b) local_unnamed_addr #0 {
521 ; CHECK-LABEL: store_I_h_:
522 ; CHECK: # %bb.0: # %entry
523 ; CHECK-NEXT: st16.h a1, (a0, 6)
524 ; CHECK-NEXT: movi16 a0, 0
527 ; GENERIC-LABEL: store_I_h_:
528 ; GENERIC: # %bb.0: # %entry
529 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
530 ; GENERIC-NEXT: subi16 sp, sp, 4
531 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
532 ; GENERIC-NEXT: st16.h a1, (a0, 6)
533 ; GENERIC-NEXT: movi16 a0, 0
534 ; GENERIC-NEXT: addi16 sp, sp, 4
535 ; GENERIC-NEXT: rts16
537 %arrayidx = getelementptr inbounds i16, ptr %a, i64 3
538 store i16 %b, ptr %arrayidx, align 2
542 define i32 @store_I_w(ptr %a, i32 %b) local_unnamed_addr #0 {
543 ; CHECK-LABEL: store_I_w:
544 ; CHECK: # %bb.0: # %entry
545 ; CHECK-NEXT: st16.w a1, (a0, 12)
546 ; CHECK-NEXT: movi16 a0, 0
549 ; GENERIC-LABEL: store_I_w:
550 ; GENERIC: # %bb.0: # %entry
551 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
552 ; GENERIC-NEXT: subi16 sp, sp, 4
553 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
554 ; GENERIC-NEXT: st16.w a1, (a0, 12)
555 ; GENERIC-NEXT: movi16 a0, 0
556 ; GENERIC-NEXT: addi16 sp, sp, 4
557 ; GENERIC-NEXT: rts16
559 %arrayidx = getelementptr inbounds i32, ptr %a, i64 3
560 store i32 %b, ptr %arrayidx, align 4
564 define i64 @store_I_d(ptr %a, i64 %b) local_unnamed_addr #0 {
565 ; CHECK-LABEL: store_I_d:
566 ; CHECK: # %bb.0: # %entry
567 ; CHECK-NEXT: st16.w a2, (a0, 28)
568 ; CHECK-NEXT: st16.w a1, (a0, 24)
569 ; CHECK-NEXT: movi16 a0, 0
570 ; CHECK-NEXT: movi16 a1, 0
573 ; GENERIC-LABEL: store_I_d:
574 ; GENERIC: # %bb.0: # %entry
575 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
576 ; GENERIC-NEXT: subi16 sp, sp, 4
577 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
578 ; GENERIC-NEXT: st16.w a2, (a0, 28)
579 ; GENERIC-NEXT: st16.w a1, (a0, 24)
580 ; GENERIC-NEXT: movi16 a0, 0
581 ; GENERIC-NEXT: movi16 a1, 0
582 ; GENERIC-NEXT: addi16 sp, sp, 4
583 ; GENERIC-NEXT: rts16
585 %arrayidx = getelementptr inbounds i64, ptr %a, i64 3
586 store i64 %b, ptr %arrayidx, align 4
590 define i8 @store_I_i8_anyext(ptr %p, i8 %b) {
591 ; CHECK-LABEL: store_I_i8_anyext:
592 ; CHECK: # %bb.0: # %entry
593 ; CHECK-NEXT: st16.b a1, (a0, 0)
594 ; CHECK-NEXT: movi16 a0, 0
597 ; GENERIC-LABEL: store_I_i8_anyext:
598 ; GENERIC: # %bb.0: # %entry
599 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
600 ; GENERIC-NEXT: subi16 sp, sp, 4
601 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
602 ; GENERIC-NEXT: st16.b a1, (a0, 0)
603 ; GENERIC-NEXT: movi16 a0, 0
604 ; GENERIC-NEXT: addi16 sp, sp, 4
605 ; GENERIC-NEXT: rts16
607 store i8 %b, ptr %p, align 1
611 define signext i1 @store_R_bits(ptr %a, i32 %b, i1 %c) local_unnamed_addr #0 {
612 ; CHECK-LABEL: store_R_bits:
613 ; CHECK: # %bb.0: # %entry
614 ; CHECK-NEXT: andi32 a2, a2, 1
615 ; CHECK-NEXT: str32.b a2, (a0, a1 << 0)
616 ; CHECK-NEXT: movi16 a0, 0
619 ; GENERIC-LABEL: store_R_bits:
620 ; GENERIC: # %bb.0: # %entry
621 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
622 ; GENERIC-NEXT: subi16 sp, sp, 4
623 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
624 ; GENERIC-NEXT: addu16 a0, a0, a1
625 ; GENERIC-NEXT: movi16 a1, 1
626 ; GENERIC-NEXT: and16 a1, a2
627 ; GENERIC-NEXT: st16.b a1, (a0, 0)
628 ; GENERIC-NEXT: movi16 a0, 0
629 ; GENERIC-NEXT: addi16 sp, sp, 4
630 ; GENERIC-NEXT: rts16
632 %idxprom = sext i32 %b to i64
633 %arrayidx = getelementptr inbounds i1, ptr %a, i64 %idxprom
634 store i1 %c, ptr %arrayidx, align 1
638 define zeroext i1 @store_R_bit_(ptr %a, i32 %b, i1 %c) local_unnamed_addr #0 {
639 ; CHECK-LABEL: store_R_bit_:
640 ; CHECK: # %bb.0: # %entry
641 ; CHECK-NEXT: andi32 a2, a2, 1
642 ; CHECK-NEXT: str32.b a2, (a0, a1 << 0)
643 ; CHECK-NEXT: movi16 a0, 0
646 ; GENERIC-LABEL: store_R_bit_:
647 ; GENERIC: # %bb.0: # %entry
648 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
649 ; GENERIC-NEXT: subi16 sp, sp, 4
650 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
651 ; GENERIC-NEXT: addu16 a0, a0, a1
652 ; GENERIC-NEXT: movi16 a1, 1
653 ; GENERIC-NEXT: and16 a1, a2
654 ; GENERIC-NEXT: st16.b a1, (a0, 0)
655 ; GENERIC-NEXT: movi16 a0, 0
656 ; GENERIC-NEXT: addi16 sp, sp, 4
657 ; GENERIC-NEXT: rts16
659 %idxprom = sext i32 %b to i64
660 %arrayidx = getelementptr inbounds i1, ptr %a, i64 %idxprom
661 store i1 %c, ptr %arrayidx, align 1
666 define signext i8 @store_R_bs(ptr %a, i32 %b, i8 %c) local_unnamed_addr #0 {
667 ; CHECK-LABEL: store_R_bs:
668 ; CHECK: # %bb.0: # %entry
669 ; CHECK-NEXT: str32.b a2, (a0, a1 << 0)
670 ; CHECK-NEXT: movi16 a0, 0
673 ; GENERIC-LABEL: store_R_bs:
674 ; GENERIC: # %bb.0: # %entry
675 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
676 ; GENERIC-NEXT: subi16 sp, sp, 4
677 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
678 ; GENERIC-NEXT: addu16 a0, a0, a1
679 ; GENERIC-NEXT: st16.b a2, (a0, 0)
680 ; GENERIC-NEXT: movi16 a0, 0
681 ; GENERIC-NEXT: addi16 sp, sp, 4
682 ; GENERIC-NEXT: rts16
684 %idxprom = sext i32 %b to i64
685 %arrayidx = getelementptr inbounds i8, ptr %a, i64 %idxprom
686 store i8 %c, ptr %arrayidx, align 1
690 define zeroext i8 @store_R_b_(ptr %a, i32 %b, i8 %c) local_unnamed_addr #0 {
691 ; CHECK-LABEL: store_R_b_:
692 ; CHECK: # %bb.0: # %entry
693 ; CHECK-NEXT: str32.b a2, (a0, a1 << 0)
694 ; CHECK-NEXT: movi16 a0, 0
697 ; GENERIC-LABEL: store_R_b_:
698 ; GENERIC: # %bb.0: # %entry
699 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
700 ; GENERIC-NEXT: subi16 sp, sp, 4
701 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
702 ; GENERIC-NEXT: addu16 a0, a0, a1
703 ; GENERIC-NEXT: st16.b a2, (a0, 0)
704 ; GENERIC-NEXT: movi16 a0, 0
705 ; GENERIC-NEXT: addi16 sp, sp, 4
706 ; GENERIC-NEXT: rts16
708 %idxprom = sext i32 %b to i64
709 %arrayidx = getelementptr inbounds i8, ptr %a, i64 %idxprom
710 store i8 %c, ptr %arrayidx, align 1
714 define signext i16 @store_R_hs(ptr %a, i32 %b, i16 %c) local_unnamed_addr #0 {
715 ; CHECK-LABEL: store_R_hs:
716 ; CHECK: # %bb.0: # %entry
717 ; CHECK-NEXT: str32.h a2, (a0, a1 << 1)
718 ; CHECK-NEXT: movi16 a0, 0
721 ; GENERIC-LABEL: store_R_hs:
722 ; GENERIC: # %bb.0: # %entry
723 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
724 ; GENERIC-NEXT: subi16 sp, sp, 4
725 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
726 ; GENERIC-NEXT: lsli16 a1, a1, 1
727 ; GENERIC-NEXT: addu16 a0, a0, a1
728 ; GENERIC-NEXT: st16.h a2, (a0, 0)
729 ; GENERIC-NEXT: movi16 a0, 0
730 ; GENERIC-NEXT: addi16 sp, sp, 4
731 ; GENERIC-NEXT: rts16
733 %idxprom = sext i32 %b to i64
734 %arrayidx = getelementptr inbounds i16, ptr %a, i64 %idxprom
735 store i16 %c, ptr %arrayidx, align 2
739 define zeroext i16 @store_R_h_(ptr %a, i32 %b, i16 %c) local_unnamed_addr #0 {
740 ; CHECK-LABEL: store_R_h_:
741 ; CHECK: # %bb.0: # %entry
742 ; CHECK-NEXT: str32.h a2, (a0, a1 << 1)
743 ; CHECK-NEXT: movi16 a0, 0
746 ; GENERIC-LABEL: store_R_h_:
747 ; GENERIC: # %bb.0: # %entry
748 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
749 ; GENERIC-NEXT: subi16 sp, sp, 4
750 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
751 ; GENERIC-NEXT: lsli16 a1, a1, 1
752 ; GENERIC-NEXT: addu16 a0, a0, a1
753 ; GENERIC-NEXT: st16.h a2, (a0, 0)
754 ; GENERIC-NEXT: movi16 a0, 0
755 ; GENERIC-NEXT: addi16 sp, sp, 4
756 ; GENERIC-NEXT: rts16
758 %idxprom = sext i32 %b to i64
759 %arrayidx = getelementptr inbounds i16, ptr %a, i64 %idxprom
760 store i16 %c, ptr %arrayidx, align 2
764 define i32 @store_R_w(ptr %a, i32 %b, i32 %c) local_unnamed_addr #0 {
765 ; CHECK-LABEL: store_R_w:
766 ; CHECK: # %bb.0: # %entry
767 ; CHECK-NEXT: str32.w a2, (a0, a1 << 2)
768 ; CHECK-NEXT: movi16 a0, 0
771 ; GENERIC-LABEL: store_R_w:
772 ; GENERIC: # %bb.0: # %entry
773 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
774 ; GENERIC-NEXT: subi16 sp, sp, 4
775 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
776 ; GENERIC-NEXT: lsli16 a1, a1, 2
777 ; GENERIC-NEXT: addu16 a0, a0, a1
778 ; GENERIC-NEXT: st16.w a2, (a0, 0)
779 ; GENERIC-NEXT: movi16 a0, 0
780 ; GENERIC-NEXT: addi16 sp, sp, 4
781 ; GENERIC-NEXT: rts16
783 %idxprom = sext i32 %b to i64
784 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %idxprom
785 store i32 %c, ptr %arrayidx, align 4
789 define i64 @store_R_d(ptr %a, i32 %b, i64 %c) local_unnamed_addr #0 {
790 ; CHECK-LABEL: store_R_d:
791 ; CHECK: # %bb.0: # %entry
792 ; CHECK-NEXT: ixd32 t0, a0, a1
793 ; CHECK-NEXT: str32.w a2, (a0, a1 << 3)
794 ; CHECK-NEXT: st32.w a3, (t0, 4)
795 ; CHECK-NEXT: movi16 a0, 0
796 ; CHECK-NEXT: movi16 a1, 0
799 ; GENERIC-LABEL: store_R_d:
800 ; GENERIC: # %bb.0: # %entry
801 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
802 ; GENERIC-NEXT: subi16 sp, sp, 4
803 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
804 ; GENERIC-NEXT: lsli16 a1, a1, 3
805 ; GENERIC-NEXT: addu16 a0, a0, a1
806 ; GENERIC-NEXT: st16.w a3, (a0, 4)
807 ; GENERIC-NEXT: st16.w a2, (a0, 0)
808 ; GENERIC-NEXT: movi16 a0, 0
809 ; GENERIC-NEXT: movi16 a1, 0
810 ; GENERIC-NEXT: addi16 sp, sp, 4
811 ; GENERIC-NEXT: rts16
813 %idxprom = sext i32 %b to i64
814 %arrayidx = getelementptr inbounds i64, ptr %a, i64 %idxprom
815 store i64 %c, ptr %arrayidx, align 4
819 define i8 @storeR_i8_anyext(ptr %c, i32 %a, i8 %d) {
820 ; CHECK-LABEL: storeR_i8_anyext:
821 ; CHECK: # %bb.0: # %entry
822 ; CHECK-NEXT: str32.b a2, (a0, a1 << 0)
823 ; CHECK-NEXT: movi16 a0, 0
826 ; GENERIC-LABEL: storeR_i8_anyext:
827 ; GENERIC: # %bb.0: # %entry
828 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
829 ; GENERIC-NEXT: subi16 sp, sp, 4
830 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
831 ; GENERIC-NEXT: addu16 a0, a0, a1
832 ; GENERIC-NEXT: st16.b a2, (a0, 0)
833 ; GENERIC-NEXT: movi16 a0, 0
834 ; GENERIC-NEXT: addi16 sp, sp, 4
835 ; GENERIC-NEXT: rts16
837 %idxprom = sext i32 %a to i64
838 %arrayidx = getelementptr inbounds i8, ptr %c, i64 %idxprom
839 store i8 %d, ptr %arrayidx, align 1