• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3--- |
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"
7  target triple = "i386"
8  ;generated using: llc -stop-after x86-pad-short-functions fixup-lea.ll > leaFinxup32.mir
9
10  ;test2add_32: 3 operands LEA32r that can be replaced with 2 add instructions
11  ; where ADD32ri8 is chosen
12  define i32 @test2add_32() {
13    ret i32 0
14  }
15
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() {
19    ret i32 0
20  }
21
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() {
25    ret i32 0
26  }
27
28  ;testleaadd_32: 3 operands LEA32r that can be replaced with 1 lea 1 add instructions
29  define i32 @testleaadd_32() {
30    ret i32 0
31  }
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() {
36    ret i32 0
37  }
38
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() {
42    ret i32 0
43  }
44
45  ;test2addi32_32: 3 operands LEA32r that can be replaced with 2 add instructions where ADD32ri32
46  ; is chosen
47  define i32 @test2addi32_32() {
48    ret i32 0
49  }
50
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() {
54    ret i32 0
55  }
56
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() {
60    ret i32 0
61  }
62
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() {
66    ret i32 0
67  }
68
69  ;test_skip_opt_32: 3 operands LEA32r that can not be replaced with 2 instructions
70  define i32 @test_skip_opt_32() {
71    ret i32 0
72  }
73
74  ;test_skip_eflags_32: LEA32r that cannot be replaced since its not safe to clobber eflags
75  define i32 @test_skip_eflags_32() {
76    ret i32 0
77  }
78
79...
80---
81name:            test2add_32
82alignment:       16
83exposesReturnsTwice: false
84legalized:       false
85regBankSelected: false
86selected:        false
87tracksRegLiveness: true
88liveins:
89  - { reg: '$eax' }
90  - { reg: '$ebp' }
91frameInfo:
92  isFrameAddressTaken: false
93  isReturnAddressTaken: false
94  hasStackMap:     false
95  hasPatchPoint:   false
96  stackSize:       0
97  offsetAdjustment: 0
98  maxAlignment:    0
99  adjustsStack:    false
100  hasCalls:        false
101  maxCallFrameSize: 0
102  hasOpaqueSPAdjustment: false
103  hasVAStart:      false
104  hasMustTailInVarArgFunc: false
105body:             |
106  bb.0 (%ir-block.0):
107    liveins: $eax, $ebp
108
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
113    ; CHECK: RETQ $eax
114    $eax = LEA32r killed $eax, 1, killed $ebp, -5, $noreg
115    RETQ $eax
116
117...
118---
119name:            test2add_ebp_32
120alignment:       16
121exposesReturnsTwice: false
122legalized:       false
123regBankSelected: false
124selected:        false
125tracksRegLiveness: true
126liveins:
127  - { reg: '$eax' }
128  - { reg: '$ebp' }
129frameInfo:
130  isFrameAddressTaken: false
131  isReturnAddressTaken: false
132  hasStackMap:     false
133  hasPatchPoint:   false
134  stackSize:       0
135  offsetAdjustment: 0
136  maxAlignment:    0
137  adjustsStack:    false
138  hasCalls:        false
139  maxCallFrameSize: 0
140  hasOpaqueSPAdjustment: false
141  hasVAStart:      false
142  hasMustTailInVarArgFunc: false
143body:             |
144  bb.0 (%ir-block.0):
145    liveins: $eax, $ebp
146
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
151    ; CHECK: RETQ $ebp
152    $ebp = LEA32r killed $ebp, 1, killed $eax, -5, $noreg
153    RETQ $ebp
154
155...
156---
157name:            test1add_ebp_32
158alignment:       16
159exposesReturnsTwice: false
160legalized:       false
161regBankSelected: false
162selected:        false
163tracksRegLiveness: true
164liveins:
165  - { reg: '$eax' }
166  - { reg: '$ebp' }
167frameInfo:
168  isFrameAddressTaken: false
169  isReturnAddressTaken: false
170  hasStackMap:     false
171  hasPatchPoint:   false
172  stackSize:       0
173  offsetAdjustment: 0
174  maxAlignment:    0
175  adjustsStack:    false
176  hasCalls:        false
177  maxCallFrameSize: 0
178  hasOpaqueSPAdjustment: false
179  hasVAStart:      false
180  hasMustTailInVarArgFunc: false
181body:             |
182  bb.0 (%ir-block.0):
183    liveins: $eax, $ebp
184
185    ; CHECK-LABEL: name: test1add_ebp_32
186    ; CHECK: liveins: $eax, $ebp
187    ; CHECK: $ebp = ADD32rr $ebp, $eax, implicit-def $eflags
188    ; CHECK: RETQ $ebp
189    $ebp = LEA32r killed $ebp, 1, killed $eax, 0, $noreg
190    RETQ $ebp
191
192...
193---
194name:            testleaadd_32
195alignment:       16
196exposesReturnsTwice: false
197legalized:       false
198regBankSelected: false
199selected:        false
200tracksRegLiveness: true
201liveins:
202  - { reg: '$eax' }
203  - { reg: '$ebp' }
204  - { reg: '$ebx' }
205frameInfo:
206  isFrameAddressTaken: false
207  isReturnAddressTaken: false
208  hasStackMap:     false
209  hasPatchPoint:   false
210  stackSize:       0
211  offsetAdjustment: 0
212  maxAlignment:    0
213  adjustsStack:    false
214  hasCalls:        false
215  maxCallFrameSize: 0
216  hasOpaqueSPAdjustment: false
217  hasVAStart:      false
218  hasMustTailInVarArgFunc: false
219body:             |
220  bb.0 (%ir-block.0):
221    liveins: $eax, $ebp, $esi
222
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
227    ; CHECK: RETQ $ebx
228    $ebx = LEA32r killed $eax, 1, killed $ebp, -5, $noreg
229    RETQ $ebx
230
231...
232---
233name:            testleaadd_ebp_32
234alignment:       16
235exposesReturnsTwice: false
236legalized:       false
237regBankSelected: false
238selected:        false
239tracksRegLiveness: true
240liveins:
241  - { reg: '$eax' }
242  - { reg: '$ebp' }
243  - { reg: '$ebx' }
244frameInfo:
245  isFrameAddressTaken: false
246  isReturnAddressTaken: false
247  hasStackMap:     false
248  hasPatchPoint:   false
249  stackSize:       0
250  offsetAdjustment: 0
251  maxAlignment:    0
252  adjustsStack:    false
253  hasCalls:        false
254  maxCallFrameSize: 0
255  hasOpaqueSPAdjustment: false
256  hasVAStart:      false
257  hasMustTailInVarArgFunc: false
258body:             |
259  bb.0 (%ir-block.0):
260    liveins: $eax, $ebp
261
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
266    ; CHECK: RETQ $ebx
267    $ebx = LEA32r killed $ebp, 1, killed $eax, -5, $noreg
268    RETQ $ebx
269
270...
271---
272name:            test1lea_ebp_32
273alignment:       16
274exposesReturnsTwice: false
275legalized:       false
276regBankSelected: false
277selected:        false
278tracksRegLiveness: true
279liveins:
280  - { reg: '$eax' }
281  - { reg: '$ebp' }
282  - { reg: '$ebx' }
283frameInfo:
284  isFrameAddressTaken: false
285  isReturnAddressTaken: false
286  hasStackMap:     false
287  hasPatchPoint:   false
288  stackSize:       0
289  offsetAdjustment: 0
290  maxAlignment:    0
291  adjustsStack:    false
292  hasCalls:        false
293  maxCallFrameSize: 0
294  hasOpaqueSPAdjustment: false
295  hasVAStart:      false
296  hasMustTailInVarArgFunc: false
297body:             |
298  bb.0 (%ir-block.0):
299    liveins: $eax, $ebp
300
301    ; CHECK-LABEL: name: test1lea_ebp_32
302    ; CHECK: liveins: $eax, $ebp
303    ; CHECK: $ebx = LEA32r killed $eax, 1, killed $ebp, 0, $noreg
304    ; CHECK: RETQ $ebx
305    $ebx = LEA32r killed $ebp, 1, killed $eax, 0, $noreg
306    RETQ $ebx
307
308...
309---
310name:            test2addi32_32
311alignment:       16
312exposesReturnsTwice: false
313legalized:       false
314regBankSelected: false
315selected:        false
316tracksRegLiveness: true
317liveins:
318  - { reg: '$eax' }
319  - { reg: '$ebp' }
320frameInfo:
321  isFrameAddressTaken: false
322  isReturnAddressTaken: false
323  hasStackMap:     false
324  hasPatchPoint:   false
325  stackSize:       0
326  offsetAdjustment: 0
327  maxAlignment:    0
328  adjustsStack:    false
329  hasCalls:        false
330  maxCallFrameSize: 0
331  hasOpaqueSPAdjustment: false
332  hasVAStart:      false
333  hasMustTailInVarArgFunc: false
334body:             |
335  bb.0 (%ir-block.0):
336    liveins: $eax, $ebp
337
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
342    ; CHECK: RETQ $eax
343    $eax = LEA32r killed $eax, 1, killed $ebp, 129, $noreg
344    RETQ $eax
345
346...
347---
348name:            test1mov1add_ebp_32
349alignment:       16
350exposesReturnsTwice: false
351legalized:       false
352regBankSelected: false
353selected:        false
354tracksRegLiveness: true
355liveins:
356  - { reg: '$eax' }
357  - { reg: '$ebx' }
358  - { reg: '$ebp' }
359frameInfo:
360  isFrameAddressTaken: false
361  isReturnAddressTaken: false
362  hasStackMap:     false
363  hasPatchPoint:   false
364  stackSize:       0
365  offsetAdjustment: 0
366  maxAlignment:    0
367  adjustsStack:    false
368  hasCalls:        false
369  maxCallFrameSize: 0
370  hasOpaqueSPAdjustment: false
371  hasVAStart:      false
372  hasMustTailInVarArgFunc: false
373body:             |
374  bb.0 (%ir-block.0):
375    liveins: $eax, $ebp, $ebx
376
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: RETQ $ebx
382    $ebx = LEA32r killed $ebp, 1, $ebp, 0, $noreg
383    RETQ $ebx
384
385...
386---
387name:            testleaadd_ebp_index_32
388alignment:       16
389exposesReturnsTwice: false
390legalized:       false
391regBankSelected: false
392selected:        false
393tracksRegLiveness: true
394liveins:
395  - { reg: '$ebx' }
396  - { reg: '$ebp' }
397frameInfo:
398  isFrameAddressTaken: false
399  isReturnAddressTaken: false
400  hasStackMap:     false
401  hasPatchPoint:   false
402  stackSize:       0
403  offsetAdjustment: 0
404  maxAlignment:    0
405  adjustsStack:    false
406  hasCalls:        false
407  maxCallFrameSize: 0
408  hasOpaqueSPAdjustment: false
409  hasVAStart:      false
410  hasMustTailInVarArgFunc: false
411body:             |
412  bb.0 (%ir-block.0):
413    liveins: $eax, $ebp, $ebx
414
415    ; CHECK-LABEL: name: testleaadd_ebp_index_32
416    ; CHECK: liveins: $eax, $ebp, $ebx
417    ; CHECK: $ebx = LEA32r $noreg, 1, $ebp, 5, $noreg
418    ; CHECK: $ebx = ADD32rr $ebx, $ebp, implicit-def $eflags
419    ; CHECK: RETQ $ebx
420    $ebx = LEA32r $ebp, 1, $ebp, 5, $noreg
421    RETQ $ebx
422
423...
424---
425name:            testleaadd_ebp_index2_32
426alignment:       16
427exposesReturnsTwice: false
428legalized:       false
429regBankSelected: false
430selected:        false
431tracksRegLiveness: true
432liveins:
433  - { reg: '$ebx' }
434  - { reg: '$ebp' }
435frameInfo:
436  isFrameAddressTaken: false
437  isReturnAddressTaken: false
438  hasStackMap:     false
439  hasPatchPoint:   false
440  stackSize:       0
441  offsetAdjustment: 0
442  maxAlignment:    0
443  adjustsStack:    false
444  hasCalls:        false
445  maxCallFrameSize: 0
446  hasOpaqueSPAdjustment: false
447  hasVAStart:      false
448  hasMustTailInVarArgFunc: false
449body:             |
450  bb.0 (%ir-block.0):
451    liveins: $eax, $ebp, $ebx
452
453    ; CHECK-LABEL: name: testleaadd_ebp_index2_32
454    ; CHECK: liveins: $eax, $ebp, $ebx
455    ; CHECK: $ebx = LEA32r $noreg, 4, $ebp, 5, $noreg
456    ; CHECK: $ebx = ADD32rr $ebx, $ebp, implicit-def $eflags
457    ; CHECK: RETQ $ebx
458    $ebx = LEA32r $ebp, 4, $ebp, 5, $noreg
459    RETQ $ebx
460
461...
462---
463name:            test_skip_opt_32
464alignment:       16
465exposesReturnsTwice: false
466legalized:       false
467regBankSelected: false
468selected:        false
469tracksRegLiveness: true
470liveins:
471  - { reg: '$ebx' }
472  - { reg: '$ebp' }
473frameInfo:
474  isFrameAddressTaken: false
475  isReturnAddressTaken: false
476  hasStackMap:     false
477  hasPatchPoint:   false
478  stackSize:       0
479  offsetAdjustment: 0
480  maxAlignment:    0
481  adjustsStack:    false
482  hasCalls:        false
483  maxCallFrameSize: 0
484  hasOpaqueSPAdjustment: false
485  hasVAStart:      false
486  hasMustTailInVarArgFunc: false
487body:             |
488  bb.0 (%ir-block.0):
489    liveins: $eax, $ebp, $ebx
490
491    ; CHECK-LABEL: name: test_skip_opt_32
492    ; CHECK: liveins: $eax, $ebp, $ebx
493    ; CHECK: $ebp = LEA32r killed $ebp, 4, killed $ebp, 0, $noreg
494    ; CHECK: RETQ $ebp
495    $ebp = LEA32r killed $ebp, 4, killed $ebp, 0, $noreg
496    RETQ $ebp
497
498...
499---
500name:            test_skip_eflags_32
501alignment:       16
502exposesReturnsTwice: false
503legalized:       false
504regBankSelected: false
505selected:        false
506tracksRegLiveness: true
507liveins:
508  - { reg: '$ebp' }
509  - { reg: '$eax' }
510frameInfo:
511  isFrameAddressTaken: false
512  isReturnAddressTaken: false
513  hasStackMap:     false
514  hasPatchPoint:   false
515  stackSize:       0
516  offsetAdjustment: 0
517  maxAlignment:    0
518  adjustsStack:    false
519  hasCalls:        false
520  maxCallFrameSize: 0
521  hasOpaqueSPAdjustment: false
522  hasVAStart:      false
523  hasMustTailInVarArgFunc: false
524body:             |
525  ; CHECK-LABEL: name: test_skip_eflags_32
526  ; CHECK: bb.0 (%ir-block.0):
527  ; CHECK:   successors: %bb.1(0x80000000)
528  ; CHECK:   liveins: $eax, $ebp, $ebx
529  ; CHECK:   CMP32rr $eax, killed $ebx, implicit-def $eflags
530  ; CHECK:   $ebx = LEA32r killed $eax, 4, killed $eax, 5, $noreg
531  ; CHECK:   JCC_1 %bb.1, 4, implicit $eflags
532  ; CHECK:   RETQ $ebx
533  ; CHECK: bb.1:
534  ; CHECK:   liveins: $eax, $ebp, $ebx
535  ; CHECK:   $ebp = LEA32r killed $ebx, 4, killed $ebx, 0, $noreg
536  ; CHECK:   $ebp = ADD32ri8 $ebp, 5, implicit-def $eflags
537  ; CHECK:   RETQ $ebp
538  bb.0 (%ir-block.0):
539    liveins: $eax, $ebp, $ebx
540
541    CMP32rr   $eax, killed $ebx, implicit-def $eflags
542    $ebx = LEA32r killed $eax, 4, killed $eax, 5, $noreg
543    JCC_1 %bb.1, 4, implicit $eflags
544    RETQ $ebx
545  bb.1:
546    liveins: $eax, $ebp, $ebx
547    $ebp = LEA32r killed $ebx, 4, killed $ebx, 5, $noreg
548    RETQ $ebp
549
550...
551
552
553
554