1# RUN: llc -mtriple=mipsel-unknown-linux-gnu -mattr=+micromips -mcpu=mips32r2 \ 2# RUN: -verify-machineinstrs -run-pass micromips-reduce-size \ 3# RUN: %s -o - | FileCheck %s 4 5--- | 6 define void @f1(i32* %adr, i32 %val) { ret void } 7 define void @f2(i32* %adr, i32 %val) { ret void } 8 define void @f3(i32* %adr, i32 %val) { ret void } 9 define void @f4(i32* %adr, i32 %val) { ret void } 10 11 declare i32* @f() 12 13 ; Function Attrs: nounwind 14 declare void @llvm.stackprotector(i8*, i8**) 15 16... 17--- 18# CHECK-LABEL: name: f1 19# CHECK: SWP_MM 20# CHECK: LWP_MM 21name: f1 22alignment: 4 23exposesReturnsTwice: false 24legalized: false 25regBankSelected: false 26selected: false 27tracksRegLiveness: true 28registers: 29liveins: 30 - { reg: '$a0', virtual-reg: '' } 31 - { reg: '$a1', virtual-reg: '' } 32frameInfo: 33 isFrameAddressTaken: false 34 isReturnAddressTaken: false 35 hasStackMap: false 36 hasPatchPoint: false 37 stackSize: 32 38 offsetAdjustment: 0 39 maxAlignment: 4 40 adjustsStack: true 41 hasCalls: true 42 stackProtector: '' 43 maxCallFrameSize: 16 44 hasOpaqueSPAdjustment: false 45 hasVAStart: false 46 hasMustTailInVarArgFunc: false 47 savePoint: '' 48 restorePoint: '' 49fixedStack: 50stack: 51 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4, 52 stack-id: default, callee-saved-register: '$ra', callee-saved-restored: true, 53 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 54 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4, 55 stack-id: default, callee-saved-register: '$s1', callee-saved-restored: true, 56 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 57 - { id: 2, name: '', type: spill-slot, offset: -12, size: 4, alignment: 4, 58 stack-id: default, callee-saved-register: '$s0', callee-saved-restored: true, 59 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 60constants: 61body: | 62 bb.0: 63 liveins: $a0, $a1, $ra, $s1, $s0 64 65 $sp = ADDiu $sp, -32 66 CFI_INSTRUCTION def_cfa_offset 32 67 SW killed $ra, $sp, 28 :: (store 4 into %stack.0) 68 SW killed $s1, $sp, 24 :: (store 4 into %stack.1) 69 SW killed $s0, $sp, 20 :: (store 4 into %stack.2) 70 CFI_INSTRUCTION offset $ra_64, -4 71 CFI_INSTRUCTION offset $s1_64, -8 72 CFI_INSTRUCTION offset $s0_64, -12 73 $s1 = MOVE16_MM $a1 74 $s0 = MOVE16_MM $a0 75 JAL @f, csr_o32, implicit-def dead $ra, implicit-def $sp, implicit-def dead $v0 76 SW16_MM killed renamable $s1, killed renamable $s0, 0 :: (store 4 into %ir.adr) 77 $v0 = LI16_MM 0 78 $s0 = LW $sp, 20 :: (load 4 from %stack.2) 79 $s1 = LW $sp, 24 :: (load 4 from %stack.1) 80 $ra = LW $sp, 28 :: (load 4 from %stack.0) 81 $sp = ADDiu $sp, 32 82 PseudoReturn undef $ra, implicit killed $v0 83 84... 85--- 86# CHECK-LABEL: name: f2 87# CHECK: SWP_MM 88# CHECK: LWP_MM 89name: f2 90alignment: 4 91exposesReturnsTwice: false 92legalized: false 93regBankSelected: false 94selected: false 95tracksRegLiveness: true 96registers: 97liveins: 98 - { reg: '$a0', virtual-reg: '' } 99 - { reg: '$a1', virtual-reg: '' } 100frameInfo: 101 isFrameAddressTaken: false 102 isReturnAddressTaken: false 103 hasStackMap: false 104 hasPatchPoint: false 105 stackSize: 32 106 offsetAdjustment: 0 107 maxAlignment: 4 108 adjustsStack: true 109 hasCalls: true 110 stackProtector: '' 111 maxCallFrameSize: 16 112 hasOpaqueSPAdjustment: false 113 hasVAStart: false 114 hasMustTailInVarArgFunc: false 115 savePoint: '' 116 restorePoint: '' 117fixedStack: 118stack: 119 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4, 120 stack-id: default, callee-saved-register: '$ra', callee-saved-restored: true, 121 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 122 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4, 123 stack-id: default, callee-saved-register: '$s1', callee-saved-restored: true, 124 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 125 - { id: 2, name: '', type: spill-slot, offset: -12, size: 4, alignment: 4, 126 stack-id: default, callee-saved-register: '$s0', callee-saved-restored: true, 127 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 128constants: 129body: | 130 bb.0: 131 liveins: $a0, $a1, $ra, $s1, $s0 132 133 $sp = ADDiu $sp, -32 134 CFI_INSTRUCTION def_cfa_offset 32 135 SW killed $ra, $sp, 28 :: (store 4 into %stack.0) 136 SW_MM killed $s1, $sp, 24 :: (store 4 into %stack.1) 137 SW_MM killed $s0, $sp, 20 :: (store 4 into %stack.2) 138 CFI_INSTRUCTION offset $ra_64, -4 139 CFI_INSTRUCTION offset $s1_64, -8 140 CFI_INSTRUCTION offset $s0_64, -12 141 $s1 = MOVE16_MM $a1 142 $s0 = MOVE16_MM $a0 143 JAL @f, csr_o32, implicit-def dead $ra, implicit-def $sp, implicit-def dead $v0 144 SW16_MM killed renamable $s1, killed renamable $s0, 0 :: (store 4 into %ir.adr) 145 $v0 = LI16_MM 0 146 $s0 = LW_MM $sp, 20 :: (load 4 from %stack.2) 147 $s1 = LW_MM $sp, 24 :: (load 4 from %stack.1) 148 $ra = LW $sp, 28 :: (load 4 from %stack.0) 149 $sp = ADDiu $sp, 32 150 PseudoReturn undef $ra, implicit killed $v0 151 152... 153--- 154# CHECK-LABEL: name: f3 155# CHECK: SWP_MM 156# CHECK: LWP_MM 157name: f3 158alignment: 4 159exposesReturnsTwice: false 160legalized: false 161regBankSelected: false 162selected: false 163tracksRegLiveness: true 164registers: 165liveins: 166 - { reg: '$a0', virtual-reg: '' } 167 - { reg: '$a1', virtual-reg: '' } 168frameInfo: 169 isFrameAddressTaken: false 170 isReturnAddressTaken: false 171 hasStackMap: false 172 hasPatchPoint: false 173 stackSize: 32 174 offsetAdjustment: 0 175 maxAlignment: 4 176 adjustsStack: true 177 hasCalls: true 178 stackProtector: '' 179 maxCallFrameSize: 16 180 hasOpaqueSPAdjustment: false 181 hasVAStart: false 182 hasMustTailInVarArgFunc: false 183 savePoint: '' 184 restorePoint: '' 185fixedStack: 186stack: 187 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4, 188 stack-id: default, callee-saved-register: '$ra', callee-saved-restored: true, 189 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 190 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4, 191 stack-id: default, callee-saved-register: '$s1', callee-saved-restored: true, 192 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 193 - { id: 2, name: '', type: spill-slot, offset: -12, size: 4, alignment: 4, 194 stack-id: default, callee-saved-register: '$s0', callee-saved-restored: true, 195 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 196constants: 197body: | 198 bb.0: 199 liveins: $a0, $a1, $ra, $s1, $s0 200 201 $sp = ADDiu $sp, -32 202 CFI_INSTRUCTION def_cfa_offset 32 203 SW killed $ra, $sp, 28 :: (store 4 into %stack.0) 204 SW_MM killed $s1, $sp, 24 :: (store 4 into %stack.1) 205 SW killed $s0, $sp, 20 :: (store 4 into %stack.2) 206 CFI_INSTRUCTION offset $ra_64, -4 207 CFI_INSTRUCTION offset $s1_64, -8 208 CFI_INSTRUCTION offset $s0_64, -12 209 $s1 = MOVE16_MM $a1 210 $s0 = MOVE16_MM $a0 211 JAL @f, csr_o32, implicit-def dead $ra, implicit-def $sp, implicit-def dead $v0 212 SW16_MM killed renamable $s1, killed renamable $s0, 0 :: (store 4 into %ir.adr) 213 $v0 = LI16_MM 0 214 $s0 = LW_MM $sp, 20 :: (load 4 from %stack.2) 215 $s1 = LW $sp, 24 :: (load 4 from %stack.1) 216 $ra = LW $sp, 28 :: (load 4 from %stack.0) 217 $sp = ADDiu $sp, 32 218 PseudoReturn undef $ra, implicit killed $v0 219 220... 221--- 222# CHECK-LABEL: name: f4 223# CHECK: SWP_MM 224# CHECK: LWP_MM 225name: f4 226alignment: 4 227exposesReturnsTwice: false 228legalized: false 229regBankSelected: false 230selected: false 231tracksRegLiveness: true 232registers: 233liveins: 234 - { reg: '$a0', virtual-reg: '' } 235 - { reg: '$a1', virtual-reg: '' } 236frameInfo: 237 isFrameAddressTaken: false 238 isReturnAddressTaken: false 239 hasStackMap: false 240 hasPatchPoint: false 241 stackSize: 32 242 offsetAdjustment: 0 243 maxAlignment: 4 244 adjustsStack: true 245 hasCalls: true 246 stackProtector: '' 247 maxCallFrameSize: 16 248 hasOpaqueSPAdjustment: false 249 hasVAStart: false 250 hasMustTailInVarArgFunc: false 251 savePoint: '' 252 restorePoint: '' 253fixedStack: 254stack: 255 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4, 256 stack-id: default, callee-saved-register: '$ra', callee-saved-restored: true, 257 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 258 - { id: 1, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4, 259 stack-id: default, callee-saved-register: '$s1', callee-saved-restored: true, 260 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 261 - { id: 2, name: '', type: spill-slot, offset: -12, size: 4, alignment: 4, 262 stack-id: default, callee-saved-register: '$s0', callee-saved-restored: true, 263 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' } 264constants: 265body: | 266 bb.0: 267 liveins: $a0, $a1, $ra, $s1, $s0 268 269 $sp = ADDiu $sp, -32 270 CFI_INSTRUCTION def_cfa_offset 32 271 SW killed $ra, $sp, 28 :: (store 4 into %stack.0) 272 SW killed $s1, $sp, 24 :: (store 4 into %stack.1) 273 SW_MM killed $s0, $sp, 20 :: (store 4 into %stack.2) 274 CFI_INSTRUCTION offset $ra_64, -4 275 CFI_INSTRUCTION offset $s1_64, -8 276 CFI_INSTRUCTION offset $s0_64, -12 277 $s1 = MOVE16_MM $a1 278 $s0 = MOVE16_MM $a0 279 JAL @f, csr_o32, implicit-def dead $ra, implicit-def $sp, implicit-def dead $v0 280 SW16_MM killed renamable $s1, killed renamable $s0, 0 :: (store 4 into %ir.adr) 281 $v0 = LI16_MM 0 282 $s0 = LW $sp, 20 :: (load 4 from %stack.2) 283 $s1 = LW_MM $sp, 24 :: (load 4 from %stack.1) 284 $ra = LW $sp, 28 :: (load 4 from %stack.0) 285 $sp = ADDiu $sp, 32 286 PseudoReturn undef $ra, implicit killed $v0 287 288... 289 290