1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -run-pass x86-fixup-LEAs -mtriple=i386 -verify-machineinstrs -mcpu=corei7-avx -o - %s | FileCheck %s
4 ; ModuleID = 'test/CodeGen/X86/fixup-lea.ll'
5 source_filename = "test/CodeGen/X86/fixup-lea.ll"
6 target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
8 ;generated using: llc -stop-after x86-pad-short-functions fixup-lea.ll > leaFinxup32.mir
10 ;test2add_32: 3 operands LEA32r that can be replaced with 2 add instructions
11 ; where ADD32ri8 is chosen
12 define i32 @test2add_32() {
16 ;test2add_ebp_32: 3 operands LEA32r that can be replaced with 2 add instructions
17 ; where the base is rbp/r13/ebp register
18 define i32 @test2add_ebp_32() {
22 ;test1add_ebp_32: 2 operands LEA32r where base register is ebp and can be replaced
23 ; with an add instruction
24 define i32 @test1add_ebp_32() {
28 ;testleaadd_32: 3 operands LEA32r that can be replaced with 1 lea 1 add instructions
29 define i32 @testleaadd_32() {
33 ;testleaadd_ebp_32: 3 operands LEA32r that can be replaced with 1 lea 1 add instructions
34 ; where the base is ebp register
35 define i32 @testleaadd_ebp_32() {
39 ;test1lea_ebp_32: 2 operands LEA32r wher base register is rbp/r13/ebp and can be replaced
40 ; with a lea instruction
41 define i32 @test1lea_ebp_32() {
45 ;test2addi32_32: 3 operands LEA32r that can be replaced with 2 add instructions where ADD32ri32
47 define i32 @test2addi32_32() {
51 ;test1mov1add_ebp_32: 2 operands LEA32r that can be replaced with 1 add 1 mov instructions
52 ; where the base is rbp/r13/ebp register
53 define i32 @test1mov1add_ebp_32() {
57 ;testleaadd_ebp_index_32: 3 operands LEA32r that can be replaced with 1 lea 1 add instructions
58 ; where the base and the index are ebp register and there is offset
59 define i32 @testleaadd_ebp_index_32() {
63 ;testleaadd_ebp_index2_32: 3 operands LEA32r that can be replaced with 1 lea 1 add instructions
64 ; where the base and the index are ebp register and there is scale
65 define i32 @testleaadd_ebp_index2_32() {
69 ;test_skip_opt_32: 3 operands LEA32r that can not be replaced with 2 instructions
70 define i32 @test_skip_opt_32() {
74 ;test_skip_eflags_32: LEA32r that cannot be replaced since its not safe to clobber eflags
75 define i32 @test_skip_eflags_32() {
83 exposesReturnsTwice: false
85 regBankSelected: false
87 tracksRegLiveness: true
92 isFrameAddressTaken: false
93 isReturnAddressTaken: false
102 hasOpaqueSPAdjustment: false
104 hasMustTailInVarArgFunc: false
109 ; CHECK-LABEL: name: test2add_32
110 ; CHECK: liveins: $eax, $ebp
111 ; CHECK: $eax = ADD32rr $eax, $ebp, implicit-def $eflags
112 ; CHECK: $eax = ADD32ri8 $eax, -5, implicit-def $eflags
114 $eax = LEA32r killed $eax, 1, killed $ebp, -5, $noreg
119 name: test2add_ebp_32
121 exposesReturnsTwice: false
123 regBankSelected: false
125 tracksRegLiveness: true
130 isFrameAddressTaken: false
131 isReturnAddressTaken: false
140 hasOpaqueSPAdjustment: false
142 hasMustTailInVarArgFunc: false
147 ; CHECK-LABEL: name: test2add_ebp_32
148 ; CHECK: liveins: $eax, $ebp
149 ; CHECK: $ebp = ADD32rr $ebp, $eax, implicit-def $eflags
150 ; CHECK: $ebp = ADD32ri8 $ebp, -5, implicit-def $eflags
152 $ebp = LEA32r killed $ebp, 1, killed $eax, -5, $noreg
157 name: test1add_ebp_32
159 exposesReturnsTwice: false
161 regBankSelected: false
163 tracksRegLiveness: true
168 isFrameAddressTaken: false
169 isReturnAddressTaken: false
178 hasOpaqueSPAdjustment: false
180 hasMustTailInVarArgFunc: false
185 ; CHECK-LABEL: name: test1add_ebp_32
186 ; CHECK: liveins: $eax, $ebp
187 ; CHECK: $ebp = ADD32rr $ebp, $eax, implicit-def $eflags
189 $ebp = LEA32r killed $ebp, 1, killed $eax, 0, $noreg
196 exposesReturnsTwice: false
198 regBankSelected: false
200 tracksRegLiveness: true
206 isFrameAddressTaken: false
207 isReturnAddressTaken: false
216 hasOpaqueSPAdjustment: false
218 hasMustTailInVarArgFunc: false
221 liveins: $eax, $ebp, $esi
223 ; CHECK-LABEL: name: testleaadd_32
224 ; CHECK: liveins: $eax, $ebp, $esi
225 ; CHECK: $ebx = LEA32r killed $eax, 1, killed $ebp, 0, $noreg
226 ; CHECK: $ebx = ADD32ri8 $ebx, -5, implicit-def $eflags
228 $ebx = LEA32r killed $eax, 1, killed $ebp, -5, $noreg
233 name: testleaadd_ebp_32
235 exposesReturnsTwice: false
237 regBankSelected: false
239 tracksRegLiveness: true
245 isFrameAddressTaken: false
246 isReturnAddressTaken: false
255 hasOpaqueSPAdjustment: false
257 hasMustTailInVarArgFunc: false
262 ; CHECK-LABEL: name: testleaadd_ebp_32
263 ; CHECK: liveins: $eax, $ebp
264 ; CHECK: $ebx = LEA32r killed $eax, 1, killed $ebp, 0, $noreg
265 ; CHECK: $ebx = ADD32ri8 $ebx, -5, implicit-def $eflags
267 $ebx = LEA32r killed $ebp, 1, killed $eax, -5, $noreg
272 name: test1lea_ebp_32
274 exposesReturnsTwice: false
276 regBankSelected: false
278 tracksRegLiveness: true
284 isFrameAddressTaken: false
285 isReturnAddressTaken: false
294 hasOpaqueSPAdjustment: false
296 hasMustTailInVarArgFunc: false
301 ; CHECK-LABEL: name: test1lea_ebp_32
302 ; CHECK: liveins: $eax, $ebp
303 ; CHECK: $ebx = LEA32r killed $eax, 1, killed $ebp, 0, $noreg
305 $ebx = LEA32r killed $ebp, 1, killed $eax, 0, $noreg
312 exposesReturnsTwice: false
314 regBankSelected: false
316 tracksRegLiveness: true
321 isFrameAddressTaken: false
322 isReturnAddressTaken: false
331 hasOpaqueSPAdjustment: false
333 hasMustTailInVarArgFunc: false
338 ; CHECK-LABEL: name: test2addi32_32
339 ; CHECK: liveins: $eax, $ebp
340 ; CHECK: $eax = ADD32rr $eax, $ebp, implicit-def $eflags
341 ; CHECK: $eax = ADD32ri $eax, 129, implicit-def $eflags
343 $eax = LEA32r killed $eax, 1, killed $ebp, 129, $noreg
348 name: test1mov1add_ebp_32
350 exposesReturnsTwice: false
352 regBankSelected: false
354 tracksRegLiveness: true
360 isFrameAddressTaken: false
361 isReturnAddressTaken: false
370 hasOpaqueSPAdjustment: false
372 hasMustTailInVarArgFunc: false
375 liveins: $eax, $ebp, $ebx
377 ; CHECK-LABEL: name: test1mov1add_ebp_32
378 ; CHECK: liveins: $eax, $ebp, $ebx
379 ; CHECK: $ebx = MOV32rr $ebp
380 ; CHECK: $ebx = ADD32rr $ebx, $ebp, implicit-def $eflags
381 ; CHECK: $ebx = LEA32r killed $ebp, 1, $ebp, 0, $noreg
383 $ebx = LEA32r killed $ebp, 1, $ebp, 0, $noreg
388 name: testleaadd_ebp_index_32
390 exposesReturnsTwice: false
392 regBankSelected: false
394 tracksRegLiveness: true
399 isFrameAddressTaken: false
400 isReturnAddressTaken: false
409 hasOpaqueSPAdjustment: false
411 hasMustTailInVarArgFunc: false
414 liveins: $eax, $ebp, $ebx
416 ; CHECK-LABEL: name: testleaadd_ebp_index_32
417 ; CHECK: liveins: $eax, $ebp, $ebx
418 ; CHECK: $ebx = LEA32r $noreg, 1, $ebp, 5, $noreg
419 ; CHECK: $ebx = ADD32rr $ebx, $ebp, implicit-def $eflags
421 $ebx = LEA32r $ebp, 1, $ebp, 5, $noreg
426 name: testleaadd_ebp_index2_32
428 exposesReturnsTwice: false
430 regBankSelected: false
432 tracksRegLiveness: true
437 isFrameAddressTaken: false
438 isReturnAddressTaken: false
447 hasOpaqueSPAdjustment: false
449 hasMustTailInVarArgFunc: false
452 liveins: $eax, $ebp, $ebx
454 ; CHECK-LABEL: name: testleaadd_ebp_index2_32
455 ; CHECK: liveins: $eax, $ebp, $ebx
456 ; CHECK: $ebx = LEA32r $noreg, 4, $ebp, 5, $noreg
457 ; CHECK: $ebx = ADD32rr $ebx, $ebp, implicit-def $eflags
459 $ebx = LEA32r $ebp, 4, $ebp, 5, $noreg
464 name: test_skip_opt_32
466 exposesReturnsTwice: false
468 regBankSelected: false
470 tracksRegLiveness: true
475 isFrameAddressTaken: false
476 isReturnAddressTaken: false
485 hasOpaqueSPAdjustment: false
487 hasMustTailInVarArgFunc: false
490 liveins: $eax, $ebp, $ebx
492 ; CHECK-LABEL: name: test_skip_opt_32
493 ; CHECK: liveins: $eax, $ebp, $ebx
494 ; CHECK: $ebp = LEA32r killed $ebp, 4, killed $ebp, 0, $noreg
496 $ebp = LEA32r killed $ebp, 4, killed $ebp, 0, $noreg
501 name: test_skip_eflags_32
503 exposesReturnsTwice: false
505 regBankSelected: false
507 tracksRegLiveness: true
512 isFrameAddressTaken: false
513 isReturnAddressTaken: false
522 hasOpaqueSPAdjustment: false
524 hasMustTailInVarArgFunc: false
526 ; CHECK-LABEL: name: test_skip_eflags_32
527 ; CHECK: bb.0 (%ir-block.0):
528 ; CHECK: successors: %bb.1(0x80000000)
529 ; CHECK: liveins: $eax, $ebp, $ebx
530 ; CHECK: CMP32rr $eax, killed $ebx, implicit-def $eflags
531 ; CHECK: $ebx = LEA32r killed $eax, 4, killed $eax, 5, $noreg
532 ; CHECK: JCC_1 %bb.1, 4, implicit $eflags
535 ; CHECK: liveins: $eax, $ebp, $ebx
536 ; CHECK: $ebp = LEA32r killed $ebx, 4, killed $ebx, 0, $noreg
537 ; CHECK: $ebp = ADD32ri8 $ebp, 5, implicit-def $eflags
540 liveins: $eax, $ebp, $ebx
542 CMP32rr $eax, killed $ebx, implicit-def $eflags
543 $ebx = LEA32r killed $eax, 4, killed $eax, 5, $noreg
544 JCC_1 %bb.1, 4, implicit $eflags
547 liveins: $eax, $ebp, $ebx
548 $ebp = LEA32r killed $ebx, 4, killed $ebx, 5, $noreg