1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -csky-no-aliases -mattr=+e2 -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 i32 @addRR(i32 %x, i32 %y) {
7 ; CHECK: # %bb.0: # %entry
8 ; CHECK-NEXT: addu16 a0, a1
11 ; GENERIC-LABEL: addRR:
12 ; GENERIC: # %bb.0: # %entry
13 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
14 ; GENERIC-NEXT: subi16 sp, sp, 4
15 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
16 ; GENERIC-NEXT: addu16 a0, a1, a0
17 ; GENERIC-NEXT: addi16 sp, sp, 4
20 %add = add nsw i32 %y, %x
24 define i32 @addRI(i32 %x) {
26 ; CHECK: # %bb.0: # %entry
27 ; CHECK-NEXT: addi16 a0, 10
30 ; GENERIC-LABEL: addRI:
31 ; GENERIC: # %bb.0: # %entry
32 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
33 ; GENERIC-NEXT: subi16 sp, sp, 4
34 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
35 ; GENERIC-NEXT: addi16 a0, 10
36 ; GENERIC-NEXT: addi16 sp, sp, 4
39 %add = add nsw i32 %x, 10
43 define i32 @addRI_256(i32 %x) {
44 ; CHECK-LABEL: addRI_256:
45 ; CHECK: # %bb.0: # %entry
46 ; CHECK-NEXT: addi16 a0, 256
49 ; GENERIC-LABEL: addRI_256:
50 ; GENERIC: # %bb.0: # %entry
51 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
52 ; GENERIC-NEXT: subi16 sp, sp, 4
53 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
54 ; GENERIC-NEXT: addi16 a0, 256
55 ; GENERIC-NEXT: addi16 sp, sp, 4
58 %add = add nsw i32 %x, 256
62 define i32 @addRI_4096(i32 %x) {
63 ; CHECK-LABEL: addRI_4096:
64 ; CHECK: # %bb.0: # %entry
65 ; CHECK-NEXT: addi32 a0, a0, 4096
68 ; GENERIC-LABEL: addRI_4096:
69 ; GENERIC: # %bb.0: # %entry
70 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
71 ; GENERIC-NEXT: subi16 sp, sp, 4
72 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
73 ; GENERIC-NEXT: movi16 a1, 0
74 ; GENERIC-NEXT: lsli16 a2, a1, 24
75 ; GENERIC-NEXT: lsli16 a3, a1, 16
76 ; GENERIC-NEXT: or16 a3, a2
77 ; GENERIC-NEXT: movi16 a2, 16
78 ; GENERIC-NEXT: lsli16 a2, a2, 8
79 ; GENERIC-NEXT: or16 a2, a3
80 ; GENERIC-NEXT: or16 a2, a1
81 ; GENERIC-NEXT: addu16 a0, a0, a2
82 ; GENERIC-NEXT: addi16 sp, sp, 4
85 %add = add nsw i32 %x, 4096
89 define i32 @addRI_X(i32 %x) {
90 ; CHECK-LABEL: addRI_X:
91 ; CHECK: # %bb.0: # %entry
92 ; CHECK-NEXT: movi32 a1, 4097
93 ; CHECK-NEXT: addu16 a0, a1
96 ; GENERIC-LABEL: addRI_X:
97 ; GENERIC: # %bb.0: # %entry
98 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
99 ; GENERIC-NEXT: subi16 sp, sp, 4
100 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
101 ; GENERIC-NEXT: movi16 a1, 0
102 ; GENERIC-NEXT: lsli16 a2, a1, 24
103 ; GENERIC-NEXT: lsli16 a1, a1, 16
104 ; GENERIC-NEXT: or16 a1, a2
105 ; GENERIC-NEXT: movi16 a2, 16
106 ; GENERIC-NEXT: lsli16 a2, a2, 8
107 ; GENERIC-NEXT: or16 a2, a1
108 ; GENERIC-NEXT: movi16 a1, 1
109 ; GENERIC-NEXT: or16 a1, a2
110 ; GENERIC-NEXT: addu16 a0, a0, a1
111 ; GENERIC-NEXT: addi16 sp, sp, 4
112 ; GENERIC-NEXT: rts16
114 %add = add nsw i32 %x, 4097
118 define i64 @ADD_LONG(i64 %x, i64 %y) {
119 ; CHECK-LABEL: ADD_LONG:
120 ; CHECK: # %bb.0: # %entry
122 ; CHECK-NEXT: addc32 a0, a2, a0
123 ; CHECK-NEXT: addc32 a1, a3, a1
126 ; GENERIC-LABEL: ADD_LONG:
127 ; GENERIC: # %bb.0: # %entry
128 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
129 ; GENERIC-NEXT: subi16 sp, sp, 4
130 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
131 ; GENERIC-NEXT: clrc16
132 ; GENERIC-NEXT: addc16 a0, a2
133 ; GENERIC-NEXT: addc16 a1, a3
134 ; GENERIC-NEXT: addi16 sp, sp, 4
135 ; GENERIC-NEXT: rts16
137 %add = add nsw i64 %y, %x
141 define i64 @ADD_LONG_I(i64 %x) {
142 ; CHECK-LABEL: ADD_LONG_I:
143 ; CHECK: # %bb.0: # %entry
145 ; CHECK-NEXT: movi16 a2, 1
146 ; CHECK-NEXT: addc16 a0, a2
147 ; CHECK-NEXT: movi16 a2, 0
148 ; CHECK-NEXT: addc16 a1, a2
151 ; GENERIC-LABEL: ADD_LONG_I:
152 ; GENERIC: # %bb.0: # %entry
153 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
154 ; GENERIC-NEXT: subi16 sp, sp, 4
155 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
156 ; GENERIC-NEXT: clrc16
157 ; GENERIC-NEXT: movi16 a2, 1
158 ; GENERIC-NEXT: addc16 a0, a2
159 ; GENERIC-NEXT: movi16 a2, 0
160 ; GENERIC-NEXT: addc16 a1, a2
161 ; GENERIC-NEXT: addi16 sp, sp, 4
162 ; GENERIC-NEXT: rts16
164 %add = add nsw i64 %x, 1
168 define i16 @ADD_SHORT(i16 %x, i16 %y) {
169 ; CHECK-LABEL: ADD_SHORT:
170 ; CHECK: # %bb.0: # %entry
171 ; CHECK-NEXT: addu16 a0, a1
174 ; GENERIC-LABEL: ADD_SHORT:
175 ; GENERIC: # %bb.0: # %entry
176 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
177 ; GENERIC-NEXT: subi16 sp, sp, 4
178 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
179 ; GENERIC-NEXT: addu16 a0, a1, a0
180 ; GENERIC-NEXT: addi16 sp, sp, 4
181 ; GENERIC-NEXT: rts16
183 %add = add nsw i16 %y, %x
187 define i16 @ADD_SHORT_I(i16 %x) {
188 ; CHECK-LABEL: ADD_SHORT_I:
189 ; CHECK: # %bb.0: # %entry
190 ; CHECK-NEXT: addi16 a0, a0, 1
193 ; GENERIC-LABEL: ADD_SHORT_I:
194 ; GENERIC: # %bb.0: # %entry
195 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
196 ; GENERIC-NEXT: subi16 sp, sp, 4
197 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
198 ; GENERIC-NEXT: addi16 a0, 1
199 ; GENERIC-NEXT: addi16 sp, sp, 4
200 ; GENERIC-NEXT: rts16
202 %add = add nsw i16 %x, 1
206 define i8 @ADD_CHAR(i8 %x, i8 %y) {
207 ; CHECK-LABEL: ADD_CHAR:
208 ; CHECK: # %bb.0: # %entry
209 ; CHECK-NEXT: addu16 a0, a1
212 ; GENERIC-LABEL: ADD_CHAR:
213 ; GENERIC: # %bb.0: # %entry
214 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
215 ; GENERIC-NEXT: subi16 sp, sp, 4
216 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
217 ; GENERIC-NEXT: addu16 a0, a1, a0
218 ; GENERIC-NEXT: addi16 sp, sp, 4
219 ; GENERIC-NEXT: rts16
221 %add = add nsw i8 %y, %x
225 define i8 @ADD_CHAR_I(i8 %x) {
226 ; CHECK-LABEL: ADD_CHAR_I:
227 ; CHECK: # %bb.0: # %entry
228 ; CHECK-NEXT: addi16 a0, a0, 1
231 ; GENERIC-LABEL: ADD_CHAR_I:
232 ; GENERIC: # %bb.0: # %entry
233 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
234 ; GENERIC-NEXT: subi16 sp, sp, 4
235 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
236 ; GENERIC-NEXT: addi16 a0, 1
237 ; GENERIC-NEXT: addi16 sp, sp, 4
238 ; GENERIC-NEXT: rts16
240 %add = add nsw i8 %x, 1
245 define i32 @subRR(i32 %x, i32 %y) {
246 ; CHECK-LABEL: subRR:
247 ; CHECK: # %bb.0: # %entry
248 ; CHECK-NEXT: subu16 a0, a1, a0
251 ; GENERIC-LABEL: subRR:
252 ; GENERIC: # %bb.0: # %entry
253 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
254 ; GENERIC-NEXT: subi16 sp, sp, 4
255 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
256 ; GENERIC-NEXT: subu16 a0, a1, a0
257 ; GENERIC-NEXT: addi16 sp, sp, 4
258 ; GENERIC-NEXT: rts16
260 %sub = sub nsw i32 %y, %x
264 define i32 @subRI(i32 %x) {
265 ; CHECK-LABEL: subRI:
266 ; CHECK: # %bb.0: # %entry
267 ; CHECK-NEXT: subi16 a0, 10
270 ; GENERIC-LABEL: subRI:
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: subi16 a0, 10
276 ; GENERIC-NEXT: addi16 sp, sp, 4
277 ; GENERIC-NEXT: rts16
279 %sub = sub nsw i32 %x, 10
283 define i32 @subRI_256(i32 %x) {
284 ; CHECK-LABEL: subRI_256:
285 ; CHECK: # %bb.0: # %entry
286 ; CHECK-NEXT: subi16 a0, 256
289 ; GENERIC-LABEL: subRI_256:
290 ; GENERIC: # %bb.0: # %entry
291 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
292 ; GENERIC-NEXT: subi16 sp, sp, 4
293 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
294 ; GENERIC-NEXT: subi16 a0, 256
295 ; GENERIC-NEXT: addi16 sp, sp, 4
296 ; GENERIC-NEXT: rts16
298 %sub = sub nsw i32 %x, 256
302 define i32 @subRI_4096(i32 %x) {
303 ; CHECK-LABEL: subRI_4096:
304 ; CHECK: # %bb.0: # %entry
305 ; CHECK-NEXT: subi32 a0, a0, 4096
308 ; GENERIC-LABEL: subRI_4096:
309 ; GENERIC: # %bb.0: # %entry
310 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
311 ; GENERIC-NEXT: subi16 sp, sp, 4
312 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
313 ; GENERIC-NEXT: movi16 a1, 255
314 ; GENERIC-NEXT: lsli16 a2, a1, 24
315 ; GENERIC-NEXT: lsli16 a1, a1, 16
316 ; GENERIC-NEXT: or16 a1, a2
317 ; GENERIC-NEXT: movi16 a2, 240
318 ; GENERIC-NEXT: lsli16 a2, a2, 8
319 ; GENERIC-NEXT: or16 a2, a1
320 ; GENERIC-NEXT: movi16 a1, 0
321 ; GENERIC-NEXT: or16 a1, a2
322 ; GENERIC-NEXT: addu16 a0, a0, a1
323 ; GENERIC-NEXT: addi16 sp, sp, 4
324 ; GENERIC-NEXT: rts16
326 %sub = sub nsw i32 %x, 4096
330 define i32 @subRI_X(i32 %x) {
331 ; CHECK-LABEL: subRI_X:
332 ; CHECK: # %bb.0: # %entry
333 ; CHECK-NEXT: movih32 a1, 65535
334 ; CHECK-NEXT: ori32 a1, a1, 61439
335 ; CHECK-NEXT: addu16 a0, a1
338 ; GENERIC-LABEL: subRI_X:
339 ; GENERIC: # %bb.0: # %entry
340 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
341 ; GENERIC-NEXT: subi16 sp, sp, 4
342 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
343 ; GENERIC-NEXT: movi16 a1, 255
344 ; GENERIC-NEXT: lsli16 a2, a1, 24
345 ; GENERIC-NEXT: lsli16 a3, a1, 16
346 ; GENERIC-NEXT: or16 a3, a2
347 ; GENERIC-NEXT: movi16 a2, 239
348 ; GENERIC-NEXT: lsli16 a2, a2, 8
349 ; GENERIC-NEXT: or16 a2, a3
350 ; GENERIC-NEXT: or16 a2, a1
351 ; GENERIC-NEXT: addu16 a0, a0, a2
352 ; GENERIC-NEXT: addi16 sp, sp, 4
353 ; GENERIC-NEXT: rts16
355 %sub = sub nsw i32 %x, 4097
359 define i64 @SUB_LONG(i64 %x, i64 %y) {
360 ; CHECK-LABEL: SUB_LONG:
361 ; CHECK: # %bb.0: # %entry
363 ; CHECK-NEXT: subc32 a0, a2, a0
364 ; CHECK-NEXT: mvcv16 a2
365 ; CHECK-NEXT: btsti16 a2, 0
366 ; CHECK-NEXT: mvcv16 a2
367 ; CHECK-NEXT: btsti16 a2, 0
368 ; CHECK-NEXT: subc32 a1, a3, a1
371 ; GENERIC-LABEL: SUB_LONG:
372 ; GENERIC: # %bb.0: # %entry
373 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
374 ; GENERIC-NEXT: subi16 sp, sp, 4
375 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
376 ; GENERIC-NEXT: setc16
377 ; GENERIC-NEXT: subc16 a2, a0
378 ; GENERIC-NEXT: mvcv16 a0
379 ; GENERIC-NEXT: btsti16 a0, 0
380 ; GENERIC-NEXT: mvcv16 a0
381 ; GENERIC-NEXT: btsti16 a0, 0
382 ; GENERIC-NEXT: subc16 a3, a1
383 ; GENERIC-NEXT: mov16 a0, a2
384 ; GENERIC-NEXT: mov16 a1, a3
385 ; GENERIC-NEXT: addi16 sp, sp, 4
386 ; GENERIC-NEXT: rts16
388 %sub = sub nsw i64 %y, %x
392 define i64 @SUB_LONG_I(i64 %x) {
393 ; CHECK-LABEL: SUB_LONG_I:
394 ; CHECK: # %bb.0: # %entry
396 ; CHECK-NEXT: movih32 a2, 65535
397 ; CHECK-NEXT: ori32 a2, a2, 65535
398 ; CHECK-NEXT: addc16 a0, a2
399 ; CHECK-NEXT: addc16 a1, a2
402 ; GENERIC-LABEL: SUB_LONG_I:
403 ; GENERIC: # %bb.0: # %entry
404 ; GENERIC-NEXT: subi16 sp, sp, 4
405 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
406 ; GENERIC-NEXT: st16.w l0, (sp, 0) # 4-byte Folded Spill
407 ; GENERIC-NEXT: .cfi_offset l0, -4
408 ; GENERIC-NEXT: subi16 sp, sp, 4
409 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
410 ; GENERIC-NEXT: clrc16
411 ; GENERIC-NEXT: movi16 a2, 255
412 ; GENERIC-NEXT: lsli16 a3, a2, 24
413 ; GENERIC-NEXT: lsli16 l0, a2, 16
414 ; GENERIC-NEXT: or16 l0, a3
415 ; GENERIC-NEXT: lsli16 a3, a2, 8
416 ; GENERIC-NEXT: or16 a3, l0
417 ; GENERIC-NEXT: or16 a3, a2
418 ; GENERIC-NEXT: addc16 a0, a3
419 ; GENERIC-NEXT: addc16 a1, a3
420 ; GENERIC-NEXT: addi16 sp, sp, 4
421 ; GENERIC-NEXT: ld16.w l0, (sp, 0) # 4-byte Folded Reload
422 ; GENERIC-NEXT: addi16 sp, sp, 4
423 ; GENERIC-NEXT: rts16
425 %sub = sub nsw i64 %x, 1
429 define i16 @SUB_SHORT(i16 %x, i16 %y) {
430 ; CHECK-LABEL: SUB_SHORT:
431 ; CHECK: # %bb.0: # %entry
432 ; CHECK-NEXT: subu16 a0, a1, a0
435 ; GENERIC-LABEL: SUB_SHORT:
436 ; GENERIC: # %bb.0: # %entry
437 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
438 ; GENERIC-NEXT: subi16 sp, sp, 4
439 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
440 ; GENERIC-NEXT: subu16 a0, a1, a0
441 ; GENERIC-NEXT: addi16 sp, sp, 4
442 ; GENERIC-NEXT: rts16
444 %sub = sub nsw i16 %y, %x
448 define i16 @SUB_SHORT_I(i16 %x) {
449 ; CHECK-LABEL: SUB_SHORT_I:
450 ; CHECK: # %bb.0: # %entry
451 ; CHECK-NEXT: subi16 a0, a0, 1
454 ; GENERIC-LABEL: SUB_SHORT_I:
455 ; GENERIC: # %bb.0: # %entry
456 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
457 ; GENERIC-NEXT: subi16 sp, sp, 4
458 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
459 ; GENERIC-NEXT: subi16 a0, 1
460 ; GENERIC-NEXT: addi16 sp, sp, 4
461 ; GENERIC-NEXT: rts16
463 %sub = sub nsw i16 %x, 1
467 define i8 @SUB_CHAR(i8 %x, i8 %y) {
468 ; CHECK-LABEL: SUB_CHAR:
469 ; CHECK: # %bb.0: # %entry
470 ; CHECK-NEXT: subu16 a0, a1, a0
473 ; GENERIC-LABEL: SUB_CHAR:
474 ; GENERIC: # %bb.0: # %entry
475 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
476 ; GENERIC-NEXT: subi16 sp, sp, 4
477 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
478 ; GENERIC-NEXT: subu16 a0, a1, a0
479 ; GENERIC-NEXT: addi16 sp, sp, 4
480 ; GENERIC-NEXT: rts16
482 %sub = sub nsw i8 %y, %x
486 define i8 @SUB_CHAR_I(i8 %x) {
487 ; CHECK-LABEL: SUB_CHAR_I:
488 ; CHECK: # %bb.0: # %entry
489 ; CHECK-NEXT: subi16 a0, a0, 1
492 ; GENERIC-LABEL: SUB_CHAR_I:
493 ; GENERIC: # %bb.0: # %entry
494 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
495 ; GENERIC-NEXT: subi16 sp, sp, 4
496 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
497 ; GENERIC-NEXT: subi16 a0, 1
498 ; GENERIC-NEXT: addi16 sp, sp, 4
499 ; GENERIC-NEXT: rts16
501 %sub = sub nsw i8 %x, 1
505 define i32 @mulRR(i32 %x, i32 %y) {
506 ; CHECK-LABEL: mulRR:
507 ; CHECK: # %bb.0: # %entry
508 ; CHECK-NEXT: mult16 a0, a1
511 ; GENERIC-LABEL: mulRR:
512 ; GENERIC: # %bb.0: # %entry
513 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
514 ; GENERIC-NEXT: subi16 sp, sp, 4
515 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
516 ; GENERIC-NEXT: mult16 a0, a1
517 ; GENERIC-NEXT: addi16 sp, sp, 4
518 ; GENERIC-NEXT: rts16
520 %mul = mul nsw i32 %y, %x
524 define i32 @mulRI(i32 %x) {
525 ; CHECK-LABEL: mulRI:
526 ; CHECK: # %bb.0: # %entry
527 ; CHECK-NEXT: movi16 a1, 10
528 ; CHECK-NEXT: mult16 a0, a1
531 ; GENERIC-LABEL: mulRI:
532 ; GENERIC: # %bb.0: # %entry
533 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
534 ; GENERIC-NEXT: subi16 sp, sp, 4
535 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
536 ; GENERIC-NEXT: movi16 a1, 10
537 ; GENERIC-NEXT: mult16 a0, a1
538 ; GENERIC-NEXT: addi16 sp, sp, 4
539 ; GENERIC-NEXT: rts16
541 %mul = mul nsw i32 %x, 10
545 define i32 @mulRI_X(i32 %x) {
546 ; CHECK-LABEL: mulRI_X:
547 ; CHECK: # %bb.0: # %entry
548 ; CHECK-NEXT: lsli16 a1, a0, 12
549 ; CHECK-NEXT: addu16 a0, a1
552 ; GENERIC-LABEL: mulRI_X:
553 ; GENERIC: # %bb.0: # %entry
554 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
555 ; GENERIC-NEXT: subi16 sp, sp, 4
556 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
557 ; GENERIC-NEXT: lsli16 a1, a0, 12
558 ; GENERIC-NEXT: addu16 a0, a1, a0
559 ; GENERIC-NEXT: addi16 sp, sp, 4
560 ; GENERIC-NEXT: rts16
562 %mul = mul nsw i32 %x, 4097
566 define i16 @MUL_SHORT(i16 %x, i16 %y) {
567 ; CHECK-LABEL: MUL_SHORT:
568 ; CHECK: # %bb.0: # %entry
569 ; CHECK-NEXT: mult16 a0, a1
572 ; GENERIC-LABEL: MUL_SHORT:
573 ; GENERIC: # %bb.0: # %entry
574 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
575 ; GENERIC-NEXT: subi16 sp, sp, 4
576 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
577 ; GENERIC-NEXT: mult16 a0, a1
578 ; GENERIC-NEXT: addi16 sp, sp, 4
579 ; GENERIC-NEXT: rts16
581 %mul = mul nsw i16 %y, %x
585 define i16 @MUL_SHORT_I(i16 %x) {
586 ; CHECK-LABEL: MUL_SHORT_I:
587 ; CHECK: # %bb.0: # %entry
588 ; CHECK-NEXT: ixh32 a0, a0, a0
591 ; GENERIC-LABEL: MUL_SHORT_I:
592 ; GENERIC: # %bb.0: # %entry
593 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
594 ; GENERIC-NEXT: subi16 sp, sp, 4
595 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
596 ; GENERIC-NEXT: lsli16 a1, a0, 1
597 ; GENERIC-NEXT: addu16 a0, a1, a0
598 ; GENERIC-NEXT: addi16 sp, sp, 4
599 ; GENERIC-NEXT: rts16
601 %mul = mul nsw i16 %x, 3
605 define i8 @MUL_CHAR(i8 %x, i8 %y) {
606 ; CHECK-LABEL: MUL_CHAR:
607 ; CHECK: # %bb.0: # %entry
608 ; CHECK-NEXT: mult16 a0, a1
611 ; GENERIC-LABEL: MUL_CHAR:
612 ; GENERIC: # %bb.0: # %entry
613 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
614 ; GENERIC-NEXT: subi16 sp, sp, 4
615 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
616 ; GENERIC-NEXT: mult16 a0, a1
617 ; GENERIC-NEXT: addi16 sp, sp, 4
618 ; GENERIC-NEXT: rts16
620 %mul = mul nsw i8 %y, %x
624 define i8 @MUL_CHAR_I(i8 %x) {
625 ; CHECK-LABEL: MUL_CHAR_I:
626 ; CHECK: # %bb.0: # %entry
627 ; CHECK-NEXT: ixh32 a0, a0, a0
628 ; CHECK-NEXT: movi16 a1, 0
629 ; CHECK-NEXT: subu16 a0, a1, a0
632 ; GENERIC-LABEL: MUL_CHAR_I:
633 ; GENERIC: # %bb.0: # %entry
634 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
635 ; GENERIC-NEXT: subi16 sp, sp, 4
636 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
637 ; GENERIC-NEXT: lsli16 a1, a0, 1
638 ; GENERIC-NEXT: addu16 a0, a1, a0
639 ; GENERIC-NEXT: movi16 a1, 0
640 ; GENERIC-NEXT: subu16 a0, a1, a0
641 ; GENERIC-NEXT: addi16 sp, sp, 4
642 ; GENERIC-NEXT: rts16
644 %mul = mul nsw i8 %x, -3
648 define i32 @udivRR(i32 %x, i32 %y) {
649 ; CHECK-LABEL: udivRR:
650 ; CHECK: # %bb.0: # %entry
651 ; CHECK-NEXT: divu32 a0, a1, a0
654 ; GENERIC-LABEL: udivRR:
655 ; GENERIC: # %bb.0: # %entry
656 ; GENERIC-NEXT: subi16 sp, sp, 4
657 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
658 ; GENERIC-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
659 ; GENERIC-NEXT: .cfi_offset lr, -4
660 ; GENERIC-NEXT: subi16 sp, sp, 4
661 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
662 ; GENERIC-NEXT: mov16 a2, a0
663 ; GENERIC-NEXT: lrw32 a3, [.LCPI29_0]
664 ; GENERIC-NEXT: mov16 a0, a1
665 ; GENERIC-NEXT: mov16 a1, a2
666 ; GENERIC-NEXT: jsr16 a3
667 ; GENERIC-NEXT: addi16 sp, sp, 4
668 ; GENERIC-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
669 ; GENERIC-NEXT: addi16 sp, sp, 4
670 ; GENERIC-NEXT: rts16
671 ; GENERIC-NEXT: .p2align 1
672 ; GENERIC-NEXT: # %bb.1:
673 ; GENERIC-NEXT: .p2align 2, 0x0
674 ; GENERIC-NEXT: .LCPI29_0:
675 ; GENERIC-NEXT: .long __udivsi3
677 %udiv = udiv i32 %y, %x
681 define i32 @udivRI(i32 %x) {
682 ; CHECK-LABEL: udivRI:
683 ; CHECK: # %bb.0: # %entry
684 ; CHECK-NEXT: movi16 a1, 10
685 ; CHECK-NEXT: divu32 a0, a0, a1
688 ; GENERIC-LABEL: udivRI:
689 ; GENERIC: # %bb.0: # %entry
690 ; GENERIC-NEXT: subi16 sp, sp, 4
691 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
692 ; GENERIC-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
693 ; GENERIC-NEXT: .cfi_offset lr, -4
694 ; GENERIC-NEXT: subi16 sp, sp, 4
695 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
696 ; GENERIC-NEXT: lrw32 a2, [.LCPI30_0]
697 ; GENERIC-NEXT: movi16 a1, 10
698 ; GENERIC-NEXT: jsr16 a2
699 ; GENERIC-NEXT: addi16 sp, sp, 4
700 ; GENERIC-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
701 ; GENERIC-NEXT: addi16 sp, sp, 4
702 ; GENERIC-NEXT: rts16
703 ; GENERIC-NEXT: .p2align 1
704 ; GENERIC-NEXT: # %bb.1:
705 ; GENERIC-NEXT: .p2align 2, 0x0
706 ; GENERIC-NEXT: .LCPI30_0:
707 ; GENERIC-NEXT: .long __udivsi3
709 %udiv = udiv i32 %x, 10
713 define i32 @udivRI_X(i32 %x) {
714 ; CHECK-LABEL: udivRI_X:
715 ; CHECK: # %bb.0: # %entry
716 ; CHECK-NEXT: movi32 a1, 4097
717 ; CHECK-NEXT: divu32 a0, a0, a1
720 ; GENERIC-LABEL: udivRI_X:
721 ; GENERIC: # %bb.0: # %entry
722 ; GENERIC-NEXT: subi16 sp, sp, 4
723 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
724 ; GENERIC-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
725 ; GENERIC-NEXT: .cfi_offset lr, -4
726 ; GENERIC-NEXT: subi16 sp, sp, 4
727 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
728 ; GENERIC-NEXT: movi16 a1, 0
729 ; GENERIC-NEXT: lsli16 a2, a1, 24
730 ; GENERIC-NEXT: lsli16 a1, a1, 16
731 ; GENERIC-NEXT: or16 a1, a2
732 ; GENERIC-NEXT: movi16 a2, 16
733 ; GENERIC-NEXT: lsli16 a2, a2, 8
734 ; GENERIC-NEXT: or16 a2, a1
735 ; GENERIC-NEXT: movi16 a1, 1
736 ; GENERIC-NEXT: or16 a1, a2
737 ; GENERIC-NEXT: lrw32 a2, [.LCPI31_0]
738 ; GENERIC-NEXT: jsr16 a2
739 ; GENERIC-NEXT: addi16 sp, sp, 4
740 ; GENERIC-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
741 ; GENERIC-NEXT: addi16 sp, sp, 4
742 ; GENERIC-NEXT: rts16
743 ; GENERIC-NEXT: .p2align 1
744 ; GENERIC-NEXT: # %bb.1:
745 ; GENERIC-NEXT: .p2align 2, 0x0
746 ; GENERIC-NEXT: .LCPI31_0:
747 ; GENERIC-NEXT: .long __udivsi3
749 %udiv = udiv i32 %x, 4097
753 define i16 @UDIV_SHORT(i16 %x, i16 %y) {
754 ; CHECK-LABEL: UDIV_SHORT:
755 ; CHECK: # %bb.0: # %entry
756 ; CHECK-NEXT: zexth16 a0, a0
757 ; CHECK-NEXT: zexth16 a1, a1
758 ; CHECK-NEXT: divu32 a0, a1, a0
761 ; GENERIC-LABEL: UDIV_SHORT:
762 ; GENERIC: # %bb.0: # %entry
763 ; GENERIC-NEXT: subi16 sp, sp, 8
764 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
765 ; GENERIC-NEXT: st16.w l0, (sp, 4) # 4-byte Folded Spill
766 ; GENERIC-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
767 ; GENERIC-NEXT: .cfi_offset l0, -4
768 ; GENERIC-NEXT: .cfi_offset lr, -8
769 ; GENERIC-NEXT: subi16 sp, sp, 4
770 ; GENERIC-NEXT: .cfi_def_cfa_offset 12
771 ; GENERIC-NEXT: mov16 a2, a1
772 ; GENERIC-NEXT: movi16 a1, 0
773 ; GENERIC-NEXT: lsli16 a3, a1, 24
774 ; GENERIC-NEXT: lsli16 l0, a1, 16
775 ; GENERIC-NEXT: or16 l0, a3
776 ; GENERIC-NEXT: movi16 a3, 255
777 ; GENERIC-NEXT: lsli16 a1, a3, 8
778 ; GENERIC-NEXT: or16 a1, l0
779 ; GENERIC-NEXT: or16 a1, a3
780 ; GENERIC-NEXT: and16 a2, a1
781 ; GENERIC-NEXT: and16 a1, a0
782 ; GENERIC-NEXT: lrw32 a3, [.LCPI32_0]
783 ; GENERIC-NEXT: mov16 a0, a2
784 ; GENERIC-NEXT: jsr16 a3
785 ; GENERIC-NEXT: addi16 sp, sp, 4
786 ; GENERIC-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
787 ; GENERIC-NEXT: ld16.w l0, (sp, 4) # 4-byte Folded Reload
788 ; GENERIC-NEXT: addi16 sp, sp, 8
789 ; GENERIC-NEXT: rts16
790 ; GENERIC-NEXT: .p2align 1
791 ; GENERIC-NEXT: # %bb.1:
792 ; GENERIC-NEXT: .p2align 2, 0x0
793 ; GENERIC-NEXT: .LCPI32_0:
794 ; GENERIC-NEXT: .long __udivsi3
796 %udiv = udiv i16 %y, %x
800 define i16 @UDIV_SHORT_I(i16 %x) {
801 ; CHECK-LABEL: UDIV_SHORT_I:
802 ; CHECK: # %bb.0: # %entry
803 ; CHECK-NEXT: zexth16 a0, a0
804 ; CHECK-NEXT: movi32 a1, 43691
805 ; CHECK-NEXT: mult16 a0, a1
806 ; CHECK-NEXT: lsri16 a0, a0, 17
809 ; GENERIC-LABEL: UDIV_SHORT_I:
810 ; GENERIC: # %bb.0: # %entry
811 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
812 ; GENERIC-NEXT: subi16 sp, sp, 4
813 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
814 ; GENERIC-NEXT: movi16 a1, 0
815 ; GENERIC-NEXT: lsli16 a2, a1, 24
816 ; GENERIC-NEXT: lsli16 a1, a1, 16
817 ; GENERIC-NEXT: or16 a1, a2
818 ; GENERIC-NEXT: movi16 a2, 255
819 ; GENERIC-NEXT: lsli16 a3, a2, 8
820 ; GENERIC-NEXT: or16 a3, a1
821 ; GENERIC-NEXT: or16 a3, a2
822 ; GENERIC-NEXT: and16 a3, a0
823 ; GENERIC-NEXT: movi16 a0, 170
824 ; GENERIC-NEXT: lsli16 a0, a0, 8
825 ; GENERIC-NEXT: or16 a0, a1
826 ; GENERIC-NEXT: movi16 a1, 171
827 ; GENERIC-NEXT: or16 a1, a0
828 ; GENERIC-NEXT: mult16 a1, a3
829 ; GENERIC-NEXT: lsri16 a0, a1, 17
830 ; GENERIC-NEXT: addi16 sp, sp, 4
831 ; GENERIC-NEXT: rts16
833 %udiv = udiv i16 %x, 3
837 define i8 @UDIV_CHAR(i8 %x, i8 %y) {
838 ; CHECK-LABEL: UDIV_CHAR:
839 ; CHECK: # %bb.0: # %entry
840 ; CHECK-NEXT: zextb16 a0, a0
841 ; CHECK-NEXT: zextb16 a1, a1
842 ; CHECK-NEXT: divu32 a0, a1, a0
845 ; GENERIC-LABEL: UDIV_CHAR:
846 ; GENERIC: # %bb.0: # %entry
847 ; GENERIC-NEXT: subi16 sp, sp, 4
848 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
849 ; GENERIC-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
850 ; GENERIC-NEXT: .cfi_offset lr, -4
851 ; GENERIC-NEXT: subi16 sp, sp, 4
852 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
853 ; GENERIC-NEXT: mov16 a2, a1
854 ; GENERIC-NEXT: movi16 a1, 255
855 ; GENERIC-NEXT: and16 a2, a1
856 ; GENERIC-NEXT: and16 a1, a0
857 ; GENERIC-NEXT: lrw32 a3, [.LCPI34_0]
858 ; GENERIC-NEXT: mov16 a0, a2
859 ; GENERIC-NEXT: jsr16 a3
860 ; GENERIC-NEXT: addi16 sp, sp, 4
861 ; GENERIC-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
862 ; GENERIC-NEXT: addi16 sp, sp, 4
863 ; GENERIC-NEXT: rts16
864 ; GENERIC-NEXT: .p2align 1
865 ; GENERIC-NEXT: # %bb.1:
866 ; GENERIC-NEXT: .p2align 2, 0x0
867 ; GENERIC-NEXT: .LCPI34_0:
868 ; GENERIC-NEXT: .long __udivsi3
870 %udiv = udiv i8 %y, %x
874 define i8 @UDIV_CHAR_I(i8 %x) {
875 ; CHECK-LABEL: UDIV_CHAR_I:
876 ; CHECK: # %bb.0: # %entry
877 ; CHECK-NEXT: zextb16 a0, a0
878 ; CHECK-NEXT: movi16 a1, 171
879 ; CHECK-NEXT: mult16 a0, a1
880 ; CHECK-NEXT: lsri16 a0, a0, 9
883 ; GENERIC-LABEL: UDIV_CHAR_I:
884 ; GENERIC: # %bb.0: # %entry
885 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
886 ; GENERIC-NEXT: subi16 sp, sp, 4
887 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
888 ; GENERIC-NEXT: movi16 a1, 255
889 ; GENERIC-NEXT: and16 a1, a0
890 ; GENERIC-NEXT: movi16 a0, 171
891 ; GENERIC-NEXT: mult16 a0, a1
892 ; GENERIC-NEXT: lsri16 a0, a0, 9
893 ; GENERIC-NEXT: addi16 sp, sp, 4
894 ; GENERIC-NEXT: rts16
896 %udiv = udiv i8 %x, 3
900 define i32 @sdivRR(i32 %x, i32 %y) {
901 ; CHECK-LABEL: sdivRR:
902 ; CHECK: # %bb.0: # %entry
903 ; CHECK-NEXT: divs32 a0, a1, a0
906 ; GENERIC-LABEL: sdivRR:
907 ; GENERIC: # %bb.0: # %entry
908 ; GENERIC-NEXT: subi16 sp, sp, 4
909 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
910 ; GENERIC-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
911 ; GENERIC-NEXT: .cfi_offset lr, -4
912 ; GENERIC-NEXT: subi16 sp, sp, 4
913 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
914 ; GENERIC-NEXT: mov16 a2, a0
915 ; GENERIC-NEXT: lrw32 a3, [.LCPI36_0]
916 ; GENERIC-NEXT: mov16 a0, a1
917 ; GENERIC-NEXT: mov16 a1, a2
918 ; GENERIC-NEXT: jsr16 a3
919 ; GENERIC-NEXT: addi16 sp, sp, 4
920 ; GENERIC-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
921 ; GENERIC-NEXT: addi16 sp, sp, 4
922 ; GENERIC-NEXT: rts16
923 ; GENERIC-NEXT: .p2align 1
924 ; GENERIC-NEXT: # %bb.1:
925 ; GENERIC-NEXT: .p2align 2, 0x0
926 ; GENERIC-NEXT: .LCPI36_0:
927 ; GENERIC-NEXT: .long __divsi3
929 %sdiv = sdiv i32 %y, %x
933 define i32 @sdivRI(i32 %x) {
934 ; CHECK-LABEL: sdivRI:
935 ; CHECK: # %bb.0: # %entry
936 ; CHECK-NEXT: movi16 a1, 10
937 ; CHECK-NEXT: divs32 a0, a0, a1
940 ; GENERIC-LABEL: sdivRI:
941 ; GENERIC: # %bb.0: # %entry
942 ; GENERIC-NEXT: subi16 sp, sp, 4
943 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
944 ; GENERIC-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
945 ; GENERIC-NEXT: .cfi_offset lr, -4
946 ; GENERIC-NEXT: subi16 sp, sp, 4
947 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
948 ; GENERIC-NEXT: lrw32 a2, [.LCPI37_0]
949 ; GENERIC-NEXT: movi16 a1, 10
950 ; GENERIC-NEXT: jsr16 a2
951 ; GENERIC-NEXT: addi16 sp, sp, 4
952 ; GENERIC-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
953 ; GENERIC-NEXT: addi16 sp, sp, 4
954 ; GENERIC-NEXT: rts16
955 ; GENERIC-NEXT: .p2align 1
956 ; GENERIC-NEXT: # %bb.1:
957 ; GENERIC-NEXT: .p2align 2, 0x0
958 ; GENERIC-NEXT: .LCPI37_0:
959 ; GENERIC-NEXT: .long __divsi3
961 %sdiv = sdiv i32 %x, 10
965 define i32 @sdivRI_X(i32 %x) {
966 ; CHECK-LABEL: sdivRI_X:
967 ; CHECK: # %bb.0: # %entry
968 ; CHECK-NEXT: movi32 a1, 4097
969 ; CHECK-NEXT: divs32 a0, a0, a1
972 ; GENERIC-LABEL: sdivRI_X:
973 ; GENERIC: # %bb.0: # %entry
974 ; GENERIC-NEXT: subi16 sp, sp, 4
975 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
976 ; GENERIC-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
977 ; GENERIC-NEXT: .cfi_offset lr, -4
978 ; GENERIC-NEXT: subi16 sp, sp, 4
979 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
980 ; GENERIC-NEXT: movi16 a1, 0
981 ; GENERIC-NEXT: lsli16 a2, a1, 24
982 ; GENERIC-NEXT: lsli16 a1, a1, 16
983 ; GENERIC-NEXT: or16 a1, a2
984 ; GENERIC-NEXT: movi16 a2, 16
985 ; GENERIC-NEXT: lsli16 a2, a2, 8
986 ; GENERIC-NEXT: or16 a2, a1
987 ; GENERIC-NEXT: movi16 a1, 1
988 ; GENERIC-NEXT: or16 a1, a2
989 ; GENERIC-NEXT: lrw32 a2, [.LCPI38_0]
990 ; GENERIC-NEXT: jsr16 a2
991 ; GENERIC-NEXT: addi16 sp, sp, 4
992 ; GENERIC-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
993 ; GENERIC-NEXT: addi16 sp, sp, 4
994 ; GENERIC-NEXT: rts16
995 ; GENERIC-NEXT: .p2align 1
996 ; GENERIC-NEXT: # %bb.1:
997 ; GENERIC-NEXT: .p2align 2, 0x0
998 ; GENERIC-NEXT: .LCPI38_0:
999 ; GENERIC-NEXT: .long __divsi3
1001 %sdiv = sdiv i32 %x, 4097
1005 define i16 @SDIV_SHORT(i16 %x, i16 %y) {
1006 ; CHECK-LABEL: SDIV_SHORT:
1007 ; CHECK: # %bb.0: # %entry
1008 ; CHECK-NEXT: sexth16 a0, a0
1009 ; CHECK-NEXT: sexth16 a1, a1
1010 ; CHECK-NEXT: divs32 a0, a1, a0
1013 ; GENERIC-LABEL: SDIV_SHORT:
1014 ; GENERIC: # %bb.0: # %entry
1015 ; GENERIC-NEXT: subi16 sp, sp, 4
1016 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1017 ; GENERIC-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
1018 ; GENERIC-NEXT: .cfi_offset lr, -4
1019 ; GENERIC-NEXT: subi16 sp, sp, 4
1020 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
1021 ; GENERIC-NEXT: sexth16 a2, a1
1022 ; GENERIC-NEXT: sexth16 a1, a0
1023 ; GENERIC-NEXT: lrw32 a3, [.LCPI39_0]
1024 ; GENERIC-NEXT: mov16 a0, a2
1025 ; GENERIC-NEXT: jsr16 a3
1026 ; GENERIC-NEXT: addi16 sp, sp, 4
1027 ; GENERIC-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
1028 ; GENERIC-NEXT: addi16 sp, sp, 4
1029 ; GENERIC-NEXT: rts16
1030 ; GENERIC-NEXT: .p2align 1
1031 ; GENERIC-NEXT: # %bb.1:
1032 ; GENERIC-NEXT: .p2align 2, 0x0
1033 ; GENERIC-NEXT: .LCPI39_0:
1034 ; GENERIC-NEXT: .long __divsi3
1036 %sdiv = sdiv i16 %y, %x
1040 define i16 @SDIV_SHORT_I(i16 %x) {
1041 ; CHECK-LABEL: SDIV_SHORT_I:
1042 ; CHECK: # %bb.0: # %entry
1043 ; CHECK-NEXT: sexth16 a0, a0
1044 ; CHECK-NEXT: movi32 a1, 21846
1045 ; CHECK-NEXT: mult16 a0, a1
1046 ; CHECK-NEXT: lsri16 a1, a0, 31
1047 ; CHECK-NEXT: lsri16 a0, a0, 16
1048 ; CHECK-NEXT: addu16 a0, a1
1051 ; GENERIC-LABEL: SDIV_SHORT_I:
1052 ; GENERIC: # %bb.0: # %entry
1053 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1054 ; GENERIC-NEXT: subi16 sp, sp, 4
1055 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1056 ; GENERIC-NEXT: sexth16 a0, a0
1057 ; GENERIC-NEXT: movi16 a1, 0
1058 ; GENERIC-NEXT: lsli16 a2, a1, 24
1059 ; GENERIC-NEXT: lsli16 a1, a1, 16
1060 ; GENERIC-NEXT: or16 a1, a2
1061 ; GENERIC-NEXT: movi16 a2, 85
1062 ; GENERIC-NEXT: lsli16 a2, a2, 8
1063 ; GENERIC-NEXT: or16 a2, a1
1064 ; GENERIC-NEXT: movi16 a1, 86
1065 ; GENERIC-NEXT: or16 a1, a2
1066 ; GENERIC-NEXT: mult16 a1, a0
1067 ; GENERIC-NEXT: lsri16 a0, a1, 31
1068 ; GENERIC-NEXT: lsri16 a1, a1, 16
1069 ; GENERIC-NEXT: addu16 a0, a1, a0
1070 ; GENERIC-NEXT: addi16 sp, sp, 4
1071 ; GENERIC-NEXT: rts16
1073 %sdiv = sdiv i16 %x, 3
1077 define i8 @SDIV_CHAR(i8 %x, i8 %y) {
1078 ; CHECK-LABEL: SDIV_CHAR:
1079 ; CHECK: # %bb.0: # %entry
1080 ; CHECK-NEXT: sextb16 a0, a0
1081 ; CHECK-NEXT: sextb16 a1, a1
1082 ; CHECK-NEXT: divs32 a0, a1, a0
1085 ; GENERIC-LABEL: SDIV_CHAR:
1086 ; GENERIC: # %bb.0: # %entry
1087 ; GENERIC-NEXT: subi16 sp, sp, 4
1088 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1089 ; GENERIC-NEXT: st32.w lr, (sp, 0) # 4-byte Folded Spill
1090 ; GENERIC-NEXT: .cfi_offset lr, -4
1091 ; GENERIC-NEXT: subi16 sp, sp, 4
1092 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
1093 ; GENERIC-NEXT: sextb16 a2, a1
1094 ; GENERIC-NEXT: sextb16 a1, a0
1095 ; GENERIC-NEXT: lrw32 a3, [.LCPI41_0]
1096 ; GENERIC-NEXT: mov16 a0, a2
1097 ; GENERIC-NEXT: jsr16 a3
1098 ; GENERIC-NEXT: addi16 sp, sp, 4
1099 ; GENERIC-NEXT: ld32.w lr, (sp, 0) # 4-byte Folded Reload
1100 ; GENERIC-NEXT: addi16 sp, sp, 4
1101 ; GENERIC-NEXT: rts16
1102 ; GENERIC-NEXT: .p2align 1
1103 ; GENERIC-NEXT: # %bb.1:
1104 ; GENERIC-NEXT: .p2align 2, 0x0
1105 ; GENERIC-NEXT: .LCPI41_0:
1106 ; GENERIC-NEXT: .long __divsi3
1108 %sdiv = sdiv i8 %y, %x
1112 define i8 @SDIV_CHAR_I(i8 %x) {
1113 ; CHECK-LABEL: SDIV_CHAR_I:
1114 ; CHECK: # %bb.0: # %entry
1115 ; CHECK-NEXT: sextb16 a1, a0
1116 ; CHECK-NEXT: movi16 a2, 85
1117 ; CHECK-NEXT: mult16 a1, a2
1118 ; CHECK-NEXT: lsri16 a1, a1, 8
1119 ; CHECK-NEXT: subu16 a0, a1, a0
1120 ; CHECK-NEXT: andi32 a1, a0, 128
1121 ; CHECK-NEXT: lsri16 a1, a1, 7
1122 ; CHECK-NEXT: sextb16 a0, a0
1123 ; CHECK-NEXT: asri16 a0, a0, 1
1124 ; CHECK-NEXT: addu16 a0, a1
1127 ; GENERIC-LABEL: SDIV_CHAR_I:
1128 ; GENERIC: # %bb.0: # %entry
1129 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1130 ; GENERIC-NEXT: subi16 sp, sp, 4
1131 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1132 ; GENERIC-NEXT: sextb16 a1, a0
1133 ; GENERIC-NEXT: movi16 a2, 85
1134 ; GENERIC-NEXT: mult16 a2, a1
1135 ; GENERIC-NEXT: lsri16 a1, a2, 8
1136 ; GENERIC-NEXT: subu16 a0, a1, a0
1137 ; GENERIC-NEXT: movi16 a1, 128
1138 ; GENERIC-NEXT: and16 a1, a0
1139 ; GENERIC-NEXT: lsri16 a1, a1, 7
1140 ; GENERIC-NEXT: sextb16 a0, a0
1141 ; GENERIC-NEXT: asri16 a0, a0, 1
1142 ; GENERIC-NEXT: addu16 a0, a0, a1
1143 ; GENERIC-NEXT: addi16 sp, sp, 4
1144 ; GENERIC-NEXT: rts16
1146 %sdiv = sdiv i8 %x, -3
1150 define i32 @shlRR(i32 %x, i32 %y) {
1151 ; CHECK-LABEL: shlRR:
1152 ; CHECK: # %bb.0: # %entry
1153 ; CHECK-NEXT: lsl32 a0, a1, a0
1156 ; GENERIC-LABEL: shlRR:
1157 ; GENERIC: # %bb.0: # %entry
1158 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1159 ; GENERIC-NEXT: subi16 sp, sp, 4
1160 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1161 ; GENERIC-NEXT: lsl16 a1, a0
1162 ; GENERIC-NEXT: mov16 a0, a1
1163 ; GENERIC-NEXT: addi16 sp, sp, 4
1164 ; GENERIC-NEXT: rts16
1166 %shl = shl nsw i32 %y, %x
1170 define i32 @shlRI(i32 %x) {
1171 ; CHECK-LABEL: shlRI:
1172 ; CHECK: # %bb.0: # %entry
1173 ; CHECK-NEXT: lsli16 a0, a0, 10
1176 ; GENERIC-LABEL: shlRI:
1177 ; GENERIC: # %bb.0: # %entry
1178 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1179 ; GENERIC-NEXT: subi16 sp, sp, 4
1180 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1181 ; GENERIC-NEXT: lsli16 a0, a0, 10
1182 ; GENERIC-NEXT: addi16 sp, sp, 4
1183 ; GENERIC-NEXT: rts16
1185 %shl = shl nsw i32 %x, 10
1190 define i64 @SHL_LONG_I(i64 %x) {
1191 ; CHECK-LABEL: SHL_LONG_I:
1192 ; CHECK: # %bb.0: # %entry
1193 ; CHECK-NEXT: lsri16 a2, a0, 25
1194 ; CHECK-NEXT: lsli16 a1, a1, 7
1195 ; CHECK-NEXT: or16 a1, a2
1196 ; CHECK-NEXT: lsli16 a0, a0, 7
1199 ; GENERIC-LABEL: SHL_LONG_I:
1200 ; GENERIC: # %bb.0: # %entry
1201 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1202 ; GENERIC-NEXT: subi16 sp, sp, 4
1203 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1204 ; GENERIC-NEXT: lsri16 a2, a0, 25
1205 ; GENERIC-NEXT: lsli16 a1, a1, 7
1206 ; GENERIC-NEXT: or16 a1, a2
1207 ; GENERIC-NEXT: lsli16 a0, a0, 7
1208 ; GENERIC-NEXT: addi16 sp, sp, 4
1209 ; GENERIC-NEXT: rts16
1211 %shl = shl nsw i64 %x, 7
1215 define i16 @SHL_SHORT(i16 %x, i16 %y) {
1216 ; CHECK-LABEL: SHL_SHORT:
1217 ; CHECK: # %bb.0: # %entry
1218 ; CHECK-NEXT: zexth16 a0, a0
1219 ; CHECK-NEXT: lsl32 a0, a1, a0
1222 ; GENERIC-LABEL: SHL_SHORT:
1223 ; GENERIC: # %bb.0: # %entry
1224 ; GENERIC-NEXT: subi16 sp, sp, 4
1225 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1226 ; GENERIC-NEXT: st16.w l0, (sp, 0) # 4-byte Folded Spill
1227 ; GENERIC-NEXT: .cfi_offset l0, -4
1228 ; GENERIC-NEXT: subi16 sp, sp, 4
1229 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
1230 ; GENERIC-NEXT: movi16 a2, 0
1231 ; GENERIC-NEXT: lsli16 a3, a2, 24
1232 ; GENERIC-NEXT: lsli16 a2, a2, 16
1233 ; GENERIC-NEXT: or16 a2, a3
1234 ; GENERIC-NEXT: movi16 a3, 255
1235 ; GENERIC-NEXT: lsli16 l0, a3, 8
1236 ; GENERIC-NEXT: or16 l0, a2
1237 ; GENERIC-NEXT: or16 l0, a3
1238 ; GENERIC-NEXT: and16 l0, a0
1239 ; GENERIC-NEXT: lsl16 a1, l0
1240 ; GENERIC-NEXT: mov16 a0, a1
1241 ; GENERIC-NEXT: addi16 sp, sp, 4
1242 ; GENERIC-NEXT: ld16.w l0, (sp, 0) # 4-byte Folded Reload
1243 ; GENERIC-NEXT: addi16 sp, sp, 4
1244 ; GENERIC-NEXT: rts16
1246 %shl = shl nsw i16 %y, %x
1250 define i16 @SHL_SHORT_I(i16 %x) {
1251 ; CHECK-LABEL: SHL_SHORT_I:
1252 ; CHECK: # %bb.0: # %entry
1253 ; CHECK-NEXT: lsli16 a0, a0, 1
1256 ; GENERIC-LABEL: SHL_SHORT_I:
1257 ; GENERIC: # %bb.0: # %entry
1258 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1259 ; GENERIC-NEXT: subi16 sp, sp, 4
1260 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1261 ; GENERIC-NEXT: lsli16 a0, a0, 1
1262 ; GENERIC-NEXT: addi16 sp, sp, 4
1263 ; GENERIC-NEXT: rts16
1265 %shl = shl nsw i16 %x, 1
1269 define i8 @SHL_CHAR(i8 %x, i8 %y) {
1270 ; CHECK-LABEL: SHL_CHAR:
1271 ; CHECK: # %bb.0: # %entry
1272 ; CHECK-NEXT: zextb16 a0, a0
1273 ; CHECK-NEXT: lsl32 a0, a1, a0
1276 ; GENERIC-LABEL: SHL_CHAR:
1277 ; GENERIC: # %bb.0: # %entry
1278 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1279 ; GENERIC-NEXT: subi16 sp, sp, 4
1280 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1281 ; GENERIC-NEXT: movi16 a2, 255
1282 ; GENERIC-NEXT: and16 a2, a0
1283 ; GENERIC-NEXT: lsl16 a1, a2
1284 ; GENERIC-NEXT: mov16 a0, a1
1285 ; GENERIC-NEXT: addi16 sp, sp, 4
1286 ; GENERIC-NEXT: rts16
1288 %shl = shl nsw i8 %y, %x
1292 define i8 @SHL_CHAR_I(i8 %x) {
1293 ; CHECK-LABEL: SHL_CHAR_I:
1294 ; CHECK: # %bb.0: # %entry
1295 ; CHECK-NEXT: lsli16 a0, a0, 1
1298 ; GENERIC-LABEL: SHL_CHAR_I:
1299 ; GENERIC: # %bb.0: # %entry
1300 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1301 ; GENERIC-NEXT: subi16 sp, sp, 4
1302 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1303 ; GENERIC-NEXT: lsli16 a0, a0, 1
1304 ; GENERIC-NEXT: addi16 sp, sp, 4
1305 ; GENERIC-NEXT: rts16
1307 %shl = shl nsw i8 %x, 1
1311 define i32 @andRR(i32 %x, i32 %y) {
1312 ; CHECK-LABEL: andRR:
1313 ; CHECK: # %bb.0: # %entry
1314 ; CHECK-NEXT: and16 a0, a1
1317 ; GENERIC-LABEL: andRR:
1318 ; GENERIC: # %bb.0: # %entry
1319 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1320 ; GENERIC-NEXT: subi16 sp, sp, 4
1321 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1322 ; GENERIC-NEXT: and16 a0, a1
1323 ; GENERIC-NEXT: addi16 sp, sp, 4
1324 ; GENERIC-NEXT: rts16
1326 %and = and i32 %y, %x
1330 define i32 @andRI(i32 %x) {
1331 ; CHECK-LABEL: andRI:
1332 ; CHECK: # %bb.0: # %entry
1333 ; CHECK-NEXT: andi32 a0, a0, 10
1336 ; GENERIC-LABEL: andRI:
1337 ; GENERIC: # %bb.0: # %entry
1338 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1339 ; GENERIC-NEXT: subi16 sp, sp, 4
1340 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1341 ; GENERIC-NEXT: movi16 a1, 10
1342 ; GENERIC-NEXT: and16 a0, a1
1343 ; GENERIC-NEXT: addi16 sp, sp, 4
1344 ; GENERIC-NEXT: rts16
1346 %and = and i32 %x, 10
1350 define i32 @andRI_X(i32 %x) {
1351 ; CHECK-LABEL: andRI_X:
1352 ; CHECK: # %bb.0: # %entry
1353 ; CHECK-NEXT: movi32 a1, 4097
1354 ; CHECK-NEXT: and16 a0, a1
1357 ; GENERIC-LABEL: andRI_X:
1358 ; GENERIC: # %bb.0: # %entry
1359 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1360 ; GENERIC-NEXT: subi16 sp, sp, 4
1361 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1362 ; GENERIC-NEXT: movi16 a1, 0
1363 ; GENERIC-NEXT: lsli16 a2, a1, 24
1364 ; GENERIC-NEXT: lsli16 a1, a1, 16
1365 ; GENERIC-NEXT: or16 a1, a2
1366 ; GENERIC-NEXT: movi16 a2, 16
1367 ; GENERIC-NEXT: lsli16 a2, a2, 8
1368 ; GENERIC-NEXT: or16 a2, a1
1369 ; GENERIC-NEXT: movi16 a1, 1
1370 ; GENERIC-NEXT: or16 a1, a2
1371 ; GENERIC-NEXT: and16 a0, a1
1372 ; GENERIC-NEXT: addi16 sp, sp, 4
1373 ; GENERIC-NEXT: rts16
1375 %and = and i32 %x, 4097
1379 define i64 @AND_LONG(i64 %x, i64 %y) {
1380 ; CHECK-LABEL: AND_LONG:
1381 ; CHECK: # %bb.0: # %entry
1382 ; CHECK-NEXT: and16 a0, a2
1383 ; CHECK-NEXT: and16 a1, a3
1386 ; GENERIC-LABEL: AND_LONG:
1387 ; GENERIC: # %bb.0: # %entry
1388 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1389 ; GENERIC-NEXT: subi16 sp, sp, 4
1390 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1391 ; GENERIC-NEXT: and16 a0, a2
1392 ; GENERIC-NEXT: and16 a1, a3
1393 ; GENERIC-NEXT: addi16 sp, sp, 4
1394 ; GENERIC-NEXT: rts16
1396 %and = and i64 %y, %x
1400 define i64 @AND_LONG_I(i64 %x) {
1401 ; CHECK-LABEL: AND_LONG_I:
1402 ; CHECK: # %bb.0: # %entry
1403 ; CHECK-NEXT: andi32 a0, a0, 1
1404 ; CHECK-NEXT: movi16 a1, 0
1407 ; GENERIC-LABEL: AND_LONG_I:
1408 ; GENERIC: # %bb.0: # %entry
1409 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1410 ; GENERIC-NEXT: subi16 sp, sp, 4
1411 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1412 ; GENERIC-NEXT: movi16 a1, 1
1413 ; GENERIC-NEXT: and16 a0, a1
1414 ; GENERIC-NEXT: movi16 a1, 0
1415 ; GENERIC-NEXT: addi16 sp, sp, 4
1416 ; GENERIC-NEXT: rts16
1418 %and = and i64 %x, 1
1422 define i16 @AND_SHORT(i16 %x, i16 %y) {
1423 ; CHECK-LABEL: AND_SHORT:
1424 ; CHECK: # %bb.0: # %entry
1425 ; CHECK-NEXT: and16 a0, a1
1428 ; GENERIC-LABEL: AND_SHORT:
1429 ; GENERIC: # %bb.0: # %entry
1430 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1431 ; GENERIC-NEXT: subi16 sp, sp, 4
1432 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1433 ; GENERIC-NEXT: and16 a0, a1
1434 ; GENERIC-NEXT: addi16 sp, sp, 4
1435 ; GENERIC-NEXT: rts16
1437 %and = and i16 %y, %x
1441 define i16 @AND_SHORT_I(i16 %x) {
1442 ; CHECK-LABEL: AND_SHORT_I:
1443 ; CHECK: # %bb.0: # %entry
1444 ; CHECK-NEXT: andi32 a0, a0, 1
1447 ; GENERIC-LABEL: AND_SHORT_I:
1448 ; GENERIC: # %bb.0: # %entry
1449 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1450 ; GENERIC-NEXT: subi16 sp, sp, 4
1451 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1452 ; GENERIC-NEXT: movi16 a1, 1
1453 ; GENERIC-NEXT: and16 a0, a1
1454 ; GENERIC-NEXT: addi16 sp, sp, 4
1455 ; GENERIC-NEXT: rts16
1457 %and = and i16 %x, 1
1461 define i8 @AND_CHAR(i8 %x, i8 %y) {
1462 ; CHECK-LABEL: AND_CHAR:
1463 ; CHECK: # %bb.0: # %entry
1464 ; CHECK-NEXT: and16 a0, a1
1467 ; GENERIC-LABEL: AND_CHAR:
1468 ; GENERIC: # %bb.0: # %entry
1469 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1470 ; GENERIC-NEXT: subi16 sp, sp, 4
1471 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1472 ; GENERIC-NEXT: and16 a0, a1
1473 ; GENERIC-NEXT: addi16 sp, sp, 4
1474 ; GENERIC-NEXT: rts16
1476 %and = and i8 %y, %x
1480 define i8 @AND_CHAR_I(i8 %x) {
1481 ; CHECK-LABEL: AND_CHAR_I:
1482 ; CHECK: # %bb.0: # %entry
1483 ; CHECK-NEXT: andi32 a0, a0, 1
1486 ; GENERIC-LABEL: AND_CHAR_I:
1487 ; GENERIC: # %bb.0: # %entry
1488 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1489 ; GENERIC-NEXT: subi16 sp, sp, 4
1490 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1491 ; GENERIC-NEXT: movi16 a1, 1
1492 ; GENERIC-NEXT: and16 a0, a1
1493 ; GENERIC-NEXT: addi16 sp, sp, 4
1494 ; GENERIC-NEXT: rts16
1500 define i32 @ashrRR(i32 %x, i32 %y) {
1501 ; CHECK-LABEL: ashrRR:
1502 ; CHECK: # %bb.0: # %entry
1503 ; CHECK-NEXT: asr32 a0, a1, a0
1506 ; GENERIC-LABEL: ashrRR:
1507 ; GENERIC: # %bb.0: # %entry
1508 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1509 ; GENERIC-NEXT: subi16 sp, sp, 4
1510 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1511 ; GENERIC-NEXT: asr16 a1, a0
1512 ; GENERIC-NEXT: mov16 a0, a1
1513 ; GENERIC-NEXT: addi16 sp, sp, 4
1514 ; GENERIC-NEXT: rts16
1516 %ashr = ashr i32 %y, %x
1520 define i32 @ashrRI(i32 %x) {
1521 ; CHECK-LABEL: ashrRI:
1522 ; CHECK: # %bb.0: # %entry
1523 ; CHECK-NEXT: asri16 a0, a0, 10
1526 ; GENERIC-LABEL: ashrRI:
1527 ; GENERIC: # %bb.0: # %entry
1528 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1529 ; GENERIC-NEXT: subi16 sp, sp, 4
1530 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1531 ; GENERIC-NEXT: asri16 a0, a0, 10
1532 ; GENERIC-NEXT: addi16 sp, sp, 4
1533 ; GENERIC-NEXT: rts16
1535 %ashr = ashr i32 %x, 10
1540 define i64 @ASHR_LONG_I(i64 %x) {
1541 ; CHECK-LABEL: ASHR_LONG_I:
1542 ; CHECK: # %bb.0: # %entry
1543 ; CHECK-NEXT: lsli16 a2, a1, 25
1544 ; CHECK-NEXT: lsri16 a0, a0, 7
1545 ; CHECK-NEXT: or16 a0, a2
1546 ; CHECK-NEXT: asri16 a1, a1, 7
1549 ; GENERIC-LABEL: ASHR_LONG_I:
1550 ; GENERIC: # %bb.0: # %entry
1551 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1552 ; GENERIC-NEXT: subi16 sp, sp, 4
1553 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1554 ; GENERIC-NEXT: lsli16 a2, a1, 25
1555 ; GENERIC-NEXT: lsri16 a0, a0, 7
1556 ; GENERIC-NEXT: or16 a0, a2
1557 ; GENERIC-NEXT: asri16 a1, a1, 7
1558 ; GENERIC-NEXT: addi16 sp, sp, 4
1559 ; GENERIC-NEXT: rts16
1561 %ashr = ashr i64 %x, 7
1565 define i16 @ASHR_SHORT(i16 %x, i16 %y) {
1566 ; CHECK-LABEL: ASHR_SHORT:
1567 ; CHECK: # %bb.0: # %entry
1568 ; CHECK-NEXT: sexth16 a1, a1
1569 ; CHECK-NEXT: zexth16 a0, a0
1570 ; CHECK-NEXT: asr32 a0, a1, a0
1573 ; GENERIC-LABEL: ASHR_SHORT:
1574 ; GENERIC: # %bb.0: # %entry
1575 ; GENERIC-NEXT: subi16 sp, sp, 4
1576 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1577 ; GENERIC-NEXT: st16.w l0, (sp, 0) # 4-byte Folded Spill
1578 ; GENERIC-NEXT: .cfi_offset l0, -4
1579 ; GENERIC-NEXT: subi16 sp, sp, 4
1580 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
1581 ; GENERIC-NEXT: sexth16 a1, a1
1582 ; GENERIC-NEXT: movi16 a2, 0
1583 ; GENERIC-NEXT: lsli16 a3, a2, 24
1584 ; GENERIC-NEXT: lsli16 a2, a2, 16
1585 ; GENERIC-NEXT: or16 a2, a3
1586 ; GENERIC-NEXT: movi16 a3, 255
1587 ; GENERIC-NEXT: lsli16 l0, a3, 8
1588 ; GENERIC-NEXT: or16 l0, a2
1589 ; GENERIC-NEXT: or16 l0, a3
1590 ; GENERIC-NEXT: and16 l0, a0
1591 ; GENERIC-NEXT: asr16 a1, l0
1592 ; GENERIC-NEXT: mov16 a0, a1
1593 ; GENERIC-NEXT: addi16 sp, sp, 4
1594 ; GENERIC-NEXT: ld16.w l0, (sp, 0) # 4-byte Folded Reload
1595 ; GENERIC-NEXT: addi16 sp, sp, 4
1596 ; GENERIC-NEXT: rts16
1598 %ashr = ashr i16 %y, %x
1602 define i16 @ASHR_SHORT_I(i16 %x) {
1603 ; CHECK-LABEL: ASHR_SHORT_I:
1604 ; CHECK: # %bb.0: # %entry
1605 ; CHECK-NEXT: sexth16 a0, a0
1606 ; CHECK-NEXT: asri16 a0, a0, 1
1609 ; GENERIC-LABEL: ASHR_SHORT_I:
1610 ; GENERIC: # %bb.0: # %entry
1611 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1612 ; GENERIC-NEXT: subi16 sp, sp, 4
1613 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1614 ; GENERIC-NEXT: sexth16 a0, a0
1615 ; GENERIC-NEXT: asri16 a0, a0, 1
1616 ; GENERIC-NEXT: addi16 sp, sp, 4
1617 ; GENERIC-NEXT: rts16
1619 %ashr = ashr i16 %x, 1
1623 define i8 @ASHR_CHAR(i8 %x, i8 %y) {
1624 ; CHECK-LABEL: ASHR_CHAR:
1625 ; CHECK: # %bb.0: # %entry
1626 ; CHECK-NEXT: sextb16 a1, a1
1627 ; CHECK-NEXT: zextb16 a0, a0
1628 ; CHECK-NEXT: asr32 a0, a1, a0
1631 ; GENERIC-LABEL: ASHR_CHAR:
1632 ; GENERIC: # %bb.0: # %entry
1633 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1634 ; GENERIC-NEXT: subi16 sp, sp, 4
1635 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1636 ; GENERIC-NEXT: sextb16 a1, a1
1637 ; GENERIC-NEXT: movi16 a2, 255
1638 ; GENERIC-NEXT: and16 a2, a0
1639 ; GENERIC-NEXT: asr16 a1, a2
1640 ; GENERIC-NEXT: mov16 a0, a1
1641 ; GENERIC-NEXT: addi16 sp, sp, 4
1642 ; GENERIC-NEXT: rts16
1644 %ashr = ashr i8 %y, %x
1648 define i8 @ASHR_CHAR_I(i8 %x) {
1649 ; CHECK-LABEL: ASHR_CHAR_I:
1650 ; CHECK: # %bb.0: # %entry
1651 ; CHECK-NEXT: sextb16 a0, a0
1652 ; CHECK-NEXT: asri16 a0, a0, 1
1655 ; GENERIC-LABEL: ASHR_CHAR_I:
1656 ; GENERIC: # %bb.0: # %entry
1657 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1658 ; GENERIC-NEXT: subi16 sp, sp, 4
1659 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1660 ; GENERIC-NEXT: sextb16 a0, a0
1661 ; GENERIC-NEXT: asri16 a0, a0, 1
1662 ; GENERIC-NEXT: addi16 sp, sp, 4
1663 ; GENERIC-NEXT: rts16
1665 %ashr = ashr i8 %x, 1
1670 define i32 @lshrRR(i32 %x, i32 %y) {
1671 ; CHECK-LABEL: lshrRR:
1672 ; CHECK: # %bb.0: # %entry
1673 ; CHECK-NEXT: lsr32 a0, a1, a0
1676 ; GENERIC-LABEL: lshrRR:
1677 ; GENERIC: # %bb.0: # %entry
1678 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1679 ; GENERIC-NEXT: subi16 sp, sp, 4
1680 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1681 ; GENERIC-NEXT: lsr16 a1, a0
1682 ; GENERIC-NEXT: mov16 a0, a1
1683 ; GENERIC-NEXT: addi16 sp, sp, 4
1684 ; GENERIC-NEXT: rts16
1686 %lshr = lshr i32 %y, %x
1690 define i32 @lshrRI(i32 %x) {
1691 ; CHECK-LABEL: lshrRI:
1692 ; CHECK: # %bb.0: # %entry
1693 ; CHECK-NEXT: lsri16 a0, a0, 10
1696 ; GENERIC-LABEL: lshrRI:
1697 ; GENERIC: # %bb.0: # %entry
1698 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1699 ; GENERIC-NEXT: subi16 sp, sp, 4
1700 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1701 ; GENERIC-NEXT: lsri16 a0, a0, 10
1702 ; GENERIC-NEXT: addi16 sp, sp, 4
1703 ; GENERIC-NEXT: rts16
1705 %lshr = lshr i32 %x, 10
1709 define i64 @LSHR_LONG_I(i64 %x) {
1710 ; CHECK-LABEL: LSHR_LONG_I:
1711 ; CHECK: # %bb.0: # %entry
1712 ; CHECK-NEXT: lsli16 a2, a1, 25
1713 ; CHECK-NEXT: lsri16 a0, a0, 7
1714 ; CHECK-NEXT: or16 a0, a2
1715 ; CHECK-NEXT: lsri16 a1, a1, 7
1718 ; GENERIC-LABEL: LSHR_LONG_I:
1719 ; GENERIC: # %bb.0: # %entry
1720 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1721 ; GENERIC-NEXT: subi16 sp, sp, 4
1722 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1723 ; GENERIC-NEXT: lsli16 a2, a1, 25
1724 ; GENERIC-NEXT: lsri16 a0, a0, 7
1725 ; GENERIC-NEXT: or16 a0, a2
1726 ; GENERIC-NEXT: lsri16 a1, a1, 7
1727 ; GENERIC-NEXT: addi16 sp, sp, 4
1728 ; GENERIC-NEXT: rts16
1730 %lshr = lshr i64 %x, 7
1734 define i16 @LSHR_SHORT(i16 %x, i16 %y) {
1735 ; CHECK-LABEL: LSHR_SHORT:
1736 ; CHECK: # %bb.0: # %entry
1737 ; CHECK-NEXT: zexth16 a1, a1
1738 ; CHECK-NEXT: zexth16 a0, a0
1739 ; CHECK-NEXT: lsr32 a0, a1, a0
1742 ; GENERIC-LABEL: LSHR_SHORT:
1743 ; GENERIC: # %bb.0: # %entry
1744 ; GENERIC-NEXT: subi16 sp, sp, 4
1745 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1746 ; GENERIC-NEXT: st16.w l0, (sp, 0) # 4-byte Folded Spill
1747 ; GENERIC-NEXT: .cfi_offset l0, -4
1748 ; GENERIC-NEXT: subi16 sp, sp, 4
1749 ; GENERIC-NEXT: .cfi_def_cfa_offset 8
1750 ; GENERIC-NEXT: movi16 a2, 0
1751 ; GENERIC-NEXT: lsli16 a3, a2, 24
1752 ; GENERIC-NEXT: lsli16 a2, a2, 16
1753 ; GENERIC-NEXT: or16 a2, a3
1754 ; GENERIC-NEXT: movi16 a3, 255
1755 ; GENERIC-NEXT: lsli16 l0, a3, 8
1756 ; GENERIC-NEXT: or16 l0, a2
1757 ; GENERIC-NEXT: or16 l0, a3
1758 ; GENERIC-NEXT: and16 a1, l0
1759 ; GENERIC-NEXT: and16 l0, a0
1760 ; GENERIC-NEXT: lsr16 a1, l0
1761 ; GENERIC-NEXT: mov16 a0, a1
1762 ; GENERIC-NEXT: addi16 sp, sp, 4
1763 ; GENERIC-NEXT: ld16.w l0, (sp, 0) # 4-byte Folded Reload
1764 ; GENERIC-NEXT: addi16 sp, sp, 4
1765 ; GENERIC-NEXT: rts16
1767 %lshr = lshr i16 %y, %x
1771 define i16 @LSHR_SHORT_I(i16 %x) {
1772 ; CHECK-LABEL: LSHR_SHORT_I:
1773 ; CHECK: # %bb.0: # %entry
1774 ; CHECK-NEXT: movi32 a1, 65534
1775 ; CHECK-NEXT: and16 a0, a1
1776 ; CHECK-NEXT: lsri16 a0, a0, 1
1779 ; GENERIC-LABEL: LSHR_SHORT_I:
1780 ; GENERIC: # %bb.0: # %entry
1781 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1782 ; GENERIC-NEXT: subi16 sp, sp, 4
1783 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1784 ; GENERIC-NEXT: movi16 a1, 0
1785 ; GENERIC-NEXT: lsli16 a2, a1, 24
1786 ; GENERIC-NEXT: lsli16 a1, a1, 16
1787 ; GENERIC-NEXT: or16 a1, a2
1788 ; GENERIC-NEXT: movi16 a2, 255
1789 ; GENERIC-NEXT: lsli16 a2, a2, 8
1790 ; GENERIC-NEXT: or16 a2, a1
1791 ; GENERIC-NEXT: movi16 a1, 254
1792 ; GENERIC-NEXT: or16 a1, a2
1793 ; GENERIC-NEXT: and16 a1, a0
1794 ; GENERIC-NEXT: lsri16 a0, a1, 1
1795 ; GENERIC-NEXT: addi16 sp, sp, 4
1796 ; GENERIC-NEXT: rts16
1798 %lshr = lshr i16 %x, 1
1802 define i8 @LSHR_CHAR(i8 %x, i8 %y) {
1803 ; CHECK-LABEL: LSHR_CHAR:
1804 ; CHECK: # %bb.0: # %entry
1805 ; CHECK-NEXT: zextb16 a1, a1
1806 ; CHECK-NEXT: zextb16 a0, a0
1807 ; CHECK-NEXT: lsr32 a0, a1, a0
1810 ; GENERIC-LABEL: LSHR_CHAR:
1811 ; GENERIC: # %bb.0: # %entry
1812 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1813 ; GENERIC-NEXT: subi16 sp, sp, 4
1814 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1815 ; GENERIC-NEXT: movi16 a2, 255
1816 ; GENERIC-NEXT: and16 a1, a2
1817 ; GENERIC-NEXT: and16 a0, a2
1818 ; GENERIC-NEXT: lsr16 a1, a0
1819 ; GENERIC-NEXT: mov16 a0, a1
1820 ; GENERIC-NEXT: addi16 sp, sp, 4
1821 ; GENERIC-NEXT: rts16
1823 %lshr = lshr i8 %y, %x
1827 define i8 @LSHR_CHAR_I(i8 %x) {
1828 ; CHECK-LABEL: LSHR_CHAR_I:
1829 ; CHECK: # %bb.0: # %entry
1830 ; CHECK-NEXT: andi32 a0, a0, 254
1831 ; CHECK-NEXT: lsri16 a0, a0, 1
1834 ; GENERIC-LABEL: LSHR_CHAR_I:
1835 ; GENERIC: # %bb.0: # %entry
1836 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1837 ; GENERIC-NEXT: subi16 sp, sp, 4
1838 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1839 ; GENERIC-NEXT: movi16 a1, 254
1840 ; GENERIC-NEXT: and16 a1, a0
1841 ; GENERIC-NEXT: lsri16 a0, a1, 1
1842 ; GENERIC-NEXT: addi16 sp, sp, 4
1843 ; GENERIC-NEXT: rts16
1845 %lshr = lshr i8 %x, 1
1849 define i1 @LSHR_BIT(i1 %x, i1 %y) {
1850 ; CHECK-LABEL: LSHR_BIT:
1851 ; CHECK: # %bb.0: # %entry
1852 ; CHECK-NEXT: mov16 a0, a1
1855 ; GENERIC-LABEL: LSHR_BIT:
1856 ; GENERIC: # %bb.0: # %entry
1857 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1858 ; GENERIC-NEXT: subi16 sp, sp, 4
1859 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1860 ; GENERIC-NEXT: mov16 a0, a1
1861 ; GENERIC-NEXT: addi16 sp, sp, 4
1862 ; GENERIC-NEXT: rts16
1864 %lshr = lshr i1 %y, %x
1868 define i1 @LSHR_BIT_I(i1 %x) {
1869 ; CHECK-LABEL: LSHR_BIT_I:
1870 ; CHECK: # %bb.0: # %entry
1873 ; GENERIC-LABEL: LSHR_BIT_I:
1874 ; GENERIC: # %bb.0: # %entry
1875 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1876 ; GENERIC-NEXT: subi16 sp, sp, 4
1877 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1878 ; GENERIC-NEXT: addi16 sp, sp, 4
1879 ; GENERIC-NEXT: rts16
1881 %lshr = lshr i1 %x, 1
1885 define i32 @orRR(i32 %x, i32 %y) {
1886 ; CHECK-LABEL: orRR:
1887 ; CHECK: # %bb.0: # %entry
1888 ; CHECK-NEXT: or16 a0, a1
1891 ; GENERIC-LABEL: orRR:
1892 ; GENERIC: # %bb.0: # %entry
1893 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1894 ; GENERIC-NEXT: subi16 sp, sp, 4
1895 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1896 ; GENERIC-NEXT: or16 a0, a1
1897 ; GENERIC-NEXT: addi16 sp, sp, 4
1898 ; GENERIC-NEXT: rts16
1904 define i32 @orRI(i32 %x) {
1905 ; CHECK-LABEL: orRI:
1906 ; CHECK: # %bb.0: # %entry
1907 ; CHECK-NEXT: ori32 a0, a0, 10
1910 ; GENERIC-LABEL: orRI:
1911 ; GENERIC: # %bb.0: # %entry
1912 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1913 ; GENERIC-NEXT: subi16 sp, sp, 4
1914 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1915 ; GENERIC-NEXT: movi16 a1, 10
1916 ; GENERIC-NEXT: or16 a0, a1
1917 ; GENERIC-NEXT: addi16 sp, sp, 4
1918 ; GENERIC-NEXT: rts16
1924 define i32 @orRI_X(i32 %x) {
1925 ; CHECK-LABEL: orRI_X:
1926 ; CHECK: # %bb.0: # %entry
1927 ; CHECK-NEXT: ori32 a0, a0, 4097
1930 ; GENERIC-LABEL: orRI_X:
1931 ; GENERIC: # %bb.0: # %entry
1932 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1933 ; GENERIC-NEXT: subi16 sp, sp, 4
1934 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1935 ; GENERIC-NEXT: movi16 a1, 0
1936 ; GENERIC-NEXT: lsli16 a2, a1, 24
1937 ; GENERIC-NEXT: lsli16 a1, a1, 16
1938 ; GENERIC-NEXT: or16 a1, a2
1939 ; GENERIC-NEXT: movi16 a2, 16
1940 ; GENERIC-NEXT: lsli16 a2, a2, 8
1941 ; GENERIC-NEXT: or16 a2, a1
1942 ; GENERIC-NEXT: movi16 a1, 1
1943 ; GENERIC-NEXT: or16 a1, a2
1944 ; GENERIC-NEXT: or16 a0, a1
1945 ; GENERIC-NEXT: addi16 sp, sp, 4
1946 ; GENERIC-NEXT: rts16
1948 %or = or i32 %x, 4097
1952 define i64 @OR_LONG(i64 %x, i64 %y) {
1953 ; CHECK-LABEL: OR_LONG:
1954 ; CHECK: # %bb.0: # %entry
1955 ; CHECK-NEXT: or16 a0, a2
1956 ; CHECK-NEXT: or16 a1, a3
1959 ; GENERIC-LABEL: OR_LONG:
1960 ; GENERIC: # %bb.0: # %entry
1961 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1962 ; GENERIC-NEXT: subi16 sp, sp, 4
1963 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1964 ; GENERIC-NEXT: or16 a0, a2
1965 ; GENERIC-NEXT: or16 a1, a3
1966 ; GENERIC-NEXT: addi16 sp, sp, 4
1967 ; GENERIC-NEXT: rts16
1973 define i64 @OR_LONG_I(i64 %x) {
1974 ; CHECK-LABEL: OR_LONG_I:
1975 ; CHECK: # %bb.0: # %entry
1976 ; CHECK-NEXT: ori32 a0, a0, 1
1979 ; GENERIC-LABEL: OR_LONG_I:
1980 ; GENERIC: # %bb.0: # %entry
1981 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
1982 ; GENERIC-NEXT: subi16 sp, sp, 4
1983 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
1984 ; GENERIC-NEXT: movi16 a2, 1
1985 ; GENERIC-NEXT: or16 a0, a2
1986 ; GENERIC-NEXT: addi16 sp, sp, 4
1987 ; GENERIC-NEXT: rts16
1993 define i16 @OR_SHORT(i16 %x, i16 %y) {
1994 ; CHECK-LABEL: OR_SHORT:
1995 ; CHECK: # %bb.0: # %entry
1996 ; CHECK-NEXT: or16 a0, a1
1999 ; GENERIC-LABEL: OR_SHORT:
2000 ; GENERIC: # %bb.0: # %entry
2001 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2002 ; GENERIC-NEXT: subi16 sp, sp, 4
2003 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2004 ; GENERIC-NEXT: or16 a0, a1
2005 ; GENERIC-NEXT: addi16 sp, sp, 4
2006 ; GENERIC-NEXT: rts16
2012 define i16 @OR_SHORT_I(i16 %x) {
2013 ; CHECK-LABEL: OR_SHORT_I:
2014 ; CHECK: # %bb.0: # %entry
2015 ; CHECK-NEXT: ori32 a0, a0, 1
2018 ; GENERIC-LABEL: OR_SHORT_I:
2019 ; GENERIC: # %bb.0: # %entry
2020 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2021 ; GENERIC-NEXT: subi16 sp, sp, 4
2022 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2023 ; GENERIC-NEXT: movi16 a1, 1
2024 ; GENERIC-NEXT: or16 a0, a1
2025 ; GENERIC-NEXT: addi16 sp, sp, 4
2026 ; GENERIC-NEXT: rts16
2032 define i8 @OR_CHAR(i8 %x, i8 %y) {
2033 ; CHECK-LABEL: OR_CHAR:
2034 ; CHECK: # %bb.0: # %entry
2035 ; CHECK-NEXT: or16 a0, a1
2038 ; GENERIC-LABEL: OR_CHAR:
2039 ; GENERIC: # %bb.0: # %entry
2040 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2041 ; GENERIC-NEXT: subi16 sp, sp, 4
2042 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2043 ; GENERIC-NEXT: or16 a0, a1
2044 ; GENERIC-NEXT: addi16 sp, sp, 4
2045 ; GENERIC-NEXT: rts16
2051 define i8 @OR_CHAR_I(i8 %x) {
2052 ; CHECK-LABEL: OR_CHAR_I:
2053 ; CHECK: # %bb.0: # %entry
2054 ; CHECK-NEXT: ori32 a0, a0, 1
2057 ; GENERIC-LABEL: OR_CHAR_I:
2058 ; GENERIC: # %bb.0: # %entry
2059 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2060 ; GENERIC-NEXT: subi16 sp, sp, 4
2061 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2062 ; GENERIC-NEXT: movi16 a1, 1
2063 ; GENERIC-NEXT: or16 a0, a1
2064 ; GENERIC-NEXT: addi16 sp, sp, 4
2065 ; GENERIC-NEXT: rts16
2072 define i32 @xorRR(i32 %x, i32 %y) {
2073 ; CHECK-LABEL: xorRR:
2074 ; CHECK: # %bb.0: # %entry
2075 ; CHECK-NEXT: xor16 a0, a1
2078 ; GENERIC-LABEL: xorRR:
2079 ; GENERIC: # %bb.0: # %entry
2080 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2081 ; GENERIC-NEXT: subi16 sp, sp, 4
2082 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2083 ; GENERIC-NEXT: xor16 a0, a1
2084 ; GENERIC-NEXT: addi16 sp, sp, 4
2085 ; GENERIC-NEXT: rts16
2087 %xor = xor i32 %y, %x
2091 define i32 @xorRI(i32 %x) {
2092 ; CHECK-LABEL: xorRI:
2093 ; CHECK: # %bb.0: # %entry
2094 ; CHECK-NEXT: xori32 a0, a0, 10
2097 ; GENERIC-LABEL: xorRI:
2098 ; GENERIC: # %bb.0: # %entry
2099 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2100 ; GENERIC-NEXT: subi16 sp, sp, 4
2101 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2102 ; GENERIC-NEXT: movi16 a1, 10
2103 ; GENERIC-NEXT: xor16 a0, a1
2104 ; GENERIC-NEXT: addi16 sp, sp, 4
2105 ; GENERIC-NEXT: rts16
2107 %xor = xor i32 %x, 10
2111 define i32 @xorRI_X(i32 %x) {
2112 ; CHECK-LABEL: xorRI_X:
2113 ; CHECK: # %bb.0: # %entry
2114 ; CHECK-NEXT: movi32 a1, 4097
2115 ; CHECK-NEXT: xor16 a0, a1
2118 ; GENERIC-LABEL: xorRI_X:
2119 ; GENERIC: # %bb.0: # %entry
2120 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2121 ; GENERIC-NEXT: subi16 sp, sp, 4
2122 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2123 ; GENERIC-NEXT: movi16 a1, 0
2124 ; GENERIC-NEXT: lsli16 a2, a1, 24
2125 ; GENERIC-NEXT: lsli16 a1, a1, 16
2126 ; GENERIC-NEXT: or16 a1, a2
2127 ; GENERIC-NEXT: movi16 a2, 16
2128 ; GENERIC-NEXT: lsli16 a2, a2, 8
2129 ; GENERIC-NEXT: or16 a2, a1
2130 ; GENERIC-NEXT: movi16 a1, 1
2131 ; GENERIC-NEXT: or16 a1, a2
2132 ; GENERIC-NEXT: xor16 a0, a1
2133 ; GENERIC-NEXT: addi16 sp, sp, 4
2134 ; GENERIC-NEXT: rts16
2136 %xor = xor i32 %x, 4097
2140 define i64 @XOR_LONG(i64 %x, i64 %y) {
2141 ; CHECK-LABEL: XOR_LONG:
2142 ; CHECK: # %bb.0: # %entry
2143 ; CHECK-NEXT: xor16 a0, a2
2144 ; CHECK-NEXT: xor16 a1, a3
2147 ; GENERIC-LABEL: XOR_LONG:
2148 ; GENERIC: # %bb.0: # %entry
2149 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2150 ; GENERIC-NEXT: subi16 sp, sp, 4
2151 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2152 ; GENERIC-NEXT: xor16 a0, a2
2153 ; GENERIC-NEXT: xor16 a1, a3
2154 ; GENERIC-NEXT: addi16 sp, sp, 4
2155 ; GENERIC-NEXT: rts16
2157 %xor = xor i64 %y, %x
2161 define i64 @XOR_LONG_I(i64 %x) {
2162 ; CHECK-LABEL: XOR_LONG_I:
2163 ; CHECK: # %bb.0: # %entry
2164 ; CHECK-NEXT: xori32 a0, a0, 1
2167 ; GENERIC-LABEL: XOR_LONG_I:
2168 ; GENERIC: # %bb.0: # %entry
2169 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2170 ; GENERIC-NEXT: subi16 sp, sp, 4
2171 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2172 ; GENERIC-NEXT: movi16 a2, 1
2173 ; GENERIC-NEXT: xor16 a0, a2
2174 ; GENERIC-NEXT: addi16 sp, sp, 4
2175 ; GENERIC-NEXT: rts16
2177 %xor = xor i64 %x, 1
2181 define i16 @XOR_SHORT(i16 %x, i16 %y) {
2182 ; CHECK-LABEL: XOR_SHORT:
2183 ; CHECK: # %bb.0: # %entry
2184 ; CHECK-NEXT: xor16 a0, a1
2187 ; GENERIC-LABEL: XOR_SHORT:
2188 ; GENERIC: # %bb.0: # %entry
2189 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2190 ; GENERIC-NEXT: subi16 sp, sp, 4
2191 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2192 ; GENERIC-NEXT: xor16 a0, a1
2193 ; GENERIC-NEXT: addi16 sp, sp, 4
2194 ; GENERIC-NEXT: rts16
2196 %xor = xor i16 %y, %x
2200 define i16 @XOR_SHORT_I(i16 %x) {
2201 ; CHECK-LABEL: XOR_SHORT_I:
2202 ; CHECK: # %bb.0: # %entry
2203 ; CHECK-NEXT: xori32 a0, a0, 1
2206 ; GENERIC-LABEL: XOR_SHORT_I:
2207 ; GENERIC: # %bb.0: # %entry
2208 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2209 ; GENERIC-NEXT: subi16 sp, sp, 4
2210 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2211 ; GENERIC-NEXT: movi16 a1, 1
2212 ; GENERIC-NEXT: xor16 a0, a1
2213 ; GENERIC-NEXT: addi16 sp, sp, 4
2214 ; GENERIC-NEXT: rts16
2216 %xor = xor i16 %x, 1
2220 define i8 @XOR_CHAR(i8 %x, i8 %y) {
2221 ; CHECK-LABEL: XOR_CHAR:
2222 ; CHECK: # %bb.0: # %entry
2223 ; CHECK-NEXT: xor16 a0, a1
2226 ; GENERIC-LABEL: XOR_CHAR:
2227 ; GENERIC: # %bb.0: # %entry
2228 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2229 ; GENERIC-NEXT: subi16 sp, sp, 4
2230 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2231 ; GENERIC-NEXT: xor16 a0, a1
2232 ; GENERIC-NEXT: addi16 sp, sp, 4
2233 ; GENERIC-NEXT: rts16
2235 %xor = xor i8 %y, %x
2239 define i8 @XOR_CHAR_I(i8 %x) {
2240 ; CHECK-LABEL: XOR_CHAR_I:
2241 ; CHECK: # %bb.0: # %entry
2242 ; CHECK-NEXT: xori32 a0, a0, 1
2245 ; GENERIC-LABEL: XOR_CHAR_I:
2246 ; GENERIC: # %bb.0: # %entry
2247 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2248 ; GENERIC-NEXT: subi16 sp, sp, 4
2249 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2250 ; GENERIC-NEXT: movi16 a1, 1
2251 ; GENERIC-NEXT: xor16 a0, a1
2252 ; GENERIC-NEXT: addi16 sp, sp, 4
2253 ; GENERIC-NEXT: rts16
2259 ; i64 --> i32/i16/i8/i1
2260 define i32 @truncR_i64_0(i64 %x) {
2261 ; CHECK-LABEL: truncR_i64_0:
2262 ; CHECK: # %bb.0: # %entry
2265 ; GENERIC-LABEL: truncR_i64_0:
2266 ; GENERIC: # %bb.0: # %entry
2267 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2268 ; GENERIC-NEXT: subi16 sp, sp, 4
2269 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2270 ; GENERIC-NEXT: addi16 sp, sp, 4
2271 ; GENERIC-NEXT: rts16
2273 %trunc = trunc i64 %x to i32
2277 define i16 @truncR_i64_1(i64 %x) {
2278 ; CHECK-LABEL: truncR_i64_1:
2279 ; CHECK: # %bb.0: # %entry
2282 ; GENERIC-LABEL: truncR_i64_1:
2283 ; GENERIC: # %bb.0: # %entry
2284 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2285 ; GENERIC-NEXT: subi16 sp, sp, 4
2286 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2287 ; GENERIC-NEXT: addi16 sp, sp, 4
2288 ; GENERIC-NEXT: rts16
2290 %trunc = trunc i64 %x to i16
2294 define i8 @truncR_i64_2(i64 %x) {
2295 ; CHECK-LABEL: truncR_i64_2:
2296 ; CHECK: # %bb.0: # %entry
2299 ; GENERIC-LABEL: truncR_i64_2:
2300 ; GENERIC: # %bb.0: # %entry
2301 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2302 ; GENERIC-NEXT: subi16 sp, sp, 4
2303 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2304 ; GENERIC-NEXT: addi16 sp, sp, 4
2305 ; GENERIC-NEXT: rts16
2307 %trunc = trunc i64 %x to i8
2311 define i1 @truncR_i64_3(i64 %x) {
2312 ; CHECK-LABEL: truncR_i64_3:
2313 ; CHECK: # %bb.0: # %entry
2316 ; GENERIC-LABEL: truncR_i64_3:
2317 ; GENERIC: # %bb.0: # %entry
2318 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2319 ; GENERIC-NEXT: subi16 sp, sp, 4
2320 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2321 ; GENERIC-NEXT: addi16 sp, sp, 4
2322 ; GENERIC-NEXT: rts16
2324 %trunc = trunc i64 %x to i1
2330 define i16 @truncR_i32_1(i32 %x) {
2331 ; CHECK-LABEL: truncR_i32_1:
2332 ; CHECK: # %bb.0: # %entry
2335 ; GENERIC-LABEL: truncR_i32_1:
2336 ; GENERIC: # %bb.0: # %entry
2337 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2338 ; GENERIC-NEXT: subi16 sp, sp, 4
2339 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2340 ; GENERIC-NEXT: addi16 sp, sp, 4
2341 ; GENERIC-NEXT: rts16
2343 %trunc = trunc i32 %x to i16
2347 define i8 @truncR_i32_2(i32 %x) {
2348 ; CHECK-LABEL: truncR_i32_2:
2349 ; CHECK: # %bb.0: # %entry
2352 ; GENERIC-LABEL: truncR_i32_2:
2353 ; GENERIC: # %bb.0: # %entry
2354 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2355 ; GENERIC-NEXT: subi16 sp, sp, 4
2356 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2357 ; GENERIC-NEXT: addi16 sp, sp, 4
2358 ; GENERIC-NEXT: rts16
2360 %trunc = trunc i32 %x to i8
2364 define i1 @truncR_i32_3(i32 %x) {
2365 ; CHECK-LABEL: truncR_i32_3:
2366 ; CHECK: # %bb.0: # %entry
2369 ; GENERIC-LABEL: truncR_i32_3:
2370 ; GENERIC: # %bb.0: # %entry
2371 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2372 ; GENERIC-NEXT: subi16 sp, sp, 4
2373 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2374 ; GENERIC-NEXT: addi16 sp, sp, 4
2375 ; GENERIC-NEXT: rts16
2377 %trunc = trunc i32 %x to i1
2382 define i8 @truncR_i16_2(i16 %x) {
2383 ; CHECK-LABEL: truncR_i16_2:
2384 ; CHECK: # %bb.0: # %entry
2387 ; GENERIC-LABEL: truncR_i16_2:
2388 ; GENERIC: # %bb.0: # %entry
2389 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2390 ; GENERIC-NEXT: subi16 sp, sp, 4
2391 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2392 ; GENERIC-NEXT: addi16 sp, sp, 4
2393 ; GENERIC-NEXT: rts16
2395 %trunc = trunc i16 %x to i8
2399 define i1 @truncR_i16_3(i16 %x) {
2400 ; CHECK-LABEL: truncR_i16_3:
2401 ; CHECK: # %bb.0: # %entry
2404 ; GENERIC-LABEL: truncR_i16_3:
2405 ; GENERIC: # %bb.0: # %entry
2406 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2407 ; GENERIC-NEXT: subi16 sp, sp, 4
2408 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2409 ; GENERIC-NEXT: addi16 sp, sp, 4
2410 ; GENERIC-NEXT: rts16
2412 %trunc = trunc i16 %x to i1
2418 define i1 @truncR_i8_3(i8 %x) {
2419 ; CHECK-LABEL: truncR_i8_3:
2420 ; CHECK: # %bb.0: # %entry
2423 ; GENERIC-LABEL: truncR_i8_3:
2424 ; GENERIC: # %bb.0: # %entry
2425 ; GENERIC-NEXT: .cfi_def_cfa_offset 0
2426 ; GENERIC-NEXT: subi16 sp, sp, 4
2427 ; GENERIC-NEXT: .cfi_def_cfa_offset 4
2428 ; GENERIC-NEXT: addi16 sp, sp, 4
2429 ; GENERIC-NEXT: rts16
2431 %trunc = trunc i8 %x to i1