1# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2# RUN: llc -mtriple=mipsel-unknown-linux-gnu -mattr=+micromips -mcpu=mips32r2 \
3# RUN:     -verify-machineinstrs -run-pass micromips-reduce-size \
4# RUN:      %s -o - | FileCheck %s
5
6--- |
7  define i64 @move1() { ret i64 0 }
8  define i64 @move2() { ret i64 0 }
9
10  declare i64 @f(i64 signext)
11  declare i64 @g()
12
13...
14---
15name:            move1
16stack:
17  - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
18      stack-id: default, callee-saved-register: '$ra', callee-saved-restored: true,
19      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
20constants:
21body:             |
22  bb.0:
23    liveins: $ra
24
25    ; CHECK-LABEL: name: move1
26    ; CHECK: ADDIUSP_MM -24
27    ; CHECK: CFI_INSTRUCTION def_cfa_offset 24
28    ; CHECK: SWSP_MM killed $ra, $sp, 20 :: (store 4 into %stack.0)
29    ; CHECK: CFI_INSTRUCTION offset $ra_64, -4
30    ; CHECK: JAL_MM @g, csr_o32, implicit-def dead $ra, implicit-def $sp, implicit-def $v0, implicit-def $v1
31    ; CHECK: $a0, $a1 = MOVEP_MM $v0, $v1
32    ; CHECK: JAL_MM @f, csr_o32, implicit-def dead $ra, implicit $a0, implicit $a1, implicit-def $sp, implicit-def $v0, implicit-def $v1
33    ; CHECK: $ra = LWSP_MM $sp, 20 :: (load 4 from %stack.0)
34    ; CHECK: ADDIUSP_MM 24
35    ; CHECK: PseudoReturn undef $ra, implicit $v0, implicit $v1
36    $sp = ADDiu $sp, -24
37    CFI_INSTRUCTION def_cfa_offset 24
38    SW killed $ra, $sp, 20 :: (store 4 into %stack.0)
39    CFI_INSTRUCTION offset $ra_64, -4
40    JAL_MM @g, csr_o32, implicit-def dead $ra, implicit-def $sp, implicit-def $v0, implicit-def $v1
41    $a0 = MOVE16_MM $v0
42    $a1 = MOVE16_MM $v1
43    JAL_MM @f, csr_o32, implicit-def dead $ra, implicit $a0, implicit $a1, implicit-def $sp, implicit-def $v0, implicit-def $v1
44    $ra = LW $sp, 20 :: (load 4 from %stack.0)
45    $sp = ADDiu $sp, 24
46    PseudoReturn undef $ra, implicit $v0, implicit $v1
47
48...
49---
50name:            move2
51stack:
52  - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
53      stack-id: default, callee-saved-register: '$ra', callee-saved-restored: true,
54      debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
55constants:
56body:             |
57  bb.0:
58    liveins: $ra
59
60    ; CHECK-LABEL: name: move2
61    ; CHECK: ADDIUSP_MM -24
62    ; CHECK: CFI_INSTRUCTION def_cfa_offset 24
63    ; CHECK: SWSP_MM killed $ra, $sp, 20 :: (store 4 into %stack.0)
64    ; CHECK: CFI_INSTRUCTION offset $ra_64, -4
65    ; CHECK: JAL_MM @g, csr_o32, implicit-def dead $ra, implicit-def $sp, implicit-def $v0, implicit-def $v1
66    ; CHECK: $a0, $a1 = MOVEP_MM $v0, $v1
67    ; CHECK: JAL_MM @f, csr_o32, implicit-def dead $ra, implicit $a0, implicit $a1, implicit-def $sp, implicit-def $v0, implicit-def $v1
68    ; CHECK: $ra = LWSP_MM $sp, 20 :: (load 4 from %stack.0)
69    ; CHECK: ADDIUSP_MM 24
70    ; CHECK: PseudoReturn undef $ra, implicit $v0, implicit $v1
71    $sp = ADDiu $sp, -24
72    CFI_INSTRUCTION def_cfa_offset 24
73    SW killed $ra, $sp, 20 :: (store 4 into %stack.0)
74    CFI_INSTRUCTION offset $ra_64, -4
75    JAL_MM @g, csr_o32, implicit-def dead $ra, implicit-def $sp, implicit-def $v0, implicit-def $v1
76    $a1 = MOVE16_MM $v1
77    $a0 = MOVE16_MM $v0
78    JAL_MM @f, csr_o32, implicit-def dead $ra, implicit $a0, implicit $a1, implicit-def $sp, implicit-def $v0, implicit-def $v1
79    $ra = LW $sp, 20 :: (load 4 from %stack.0)
80    $sp = ADDiu $sp, 24
81    PseudoReturn undef $ra, implicit $v0, implicit $v1
82
83...
84---
85
86
87