1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-pc-linux-gnu | FileCheck %s -check-prefix=DEFAULT
3 ; RUN: llc < %s -mtriple=i686-pc-linux-gnu -x86-experimental-pref-innermost-loop-alignment=5 | FileCheck %s -check-prefix=ALIGN32
4 ; RUN: llc < %s -mtriple=i686-pc-linux-gnu -align-loops=32 -x86-experimental-pref-innermost-loop-alignment=6 | FileCheck %s -check-prefix=ALIGN64
8 define void @test(i32 %n, i32 %m) {
10 ; DEFAULT: # %bb.0: # %entry
11 ; DEFAULT-NEXT: pushl %ebp
12 ; DEFAULT-NEXT: .cfi_def_cfa_offset 8
13 ; DEFAULT-NEXT: pushl %ebx
14 ; DEFAULT-NEXT: .cfi_def_cfa_offset 12
15 ; DEFAULT-NEXT: pushl %edi
16 ; DEFAULT-NEXT: .cfi_def_cfa_offset 16
17 ; DEFAULT-NEXT: pushl %esi
18 ; DEFAULT-NEXT: .cfi_def_cfa_offset 20
19 ; DEFAULT-NEXT: subl $12, %esp
20 ; DEFAULT-NEXT: .cfi_def_cfa_offset 32
21 ; DEFAULT-NEXT: .cfi_offset %esi, -20
22 ; DEFAULT-NEXT: .cfi_offset %edi, -16
23 ; DEFAULT-NEXT: .cfi_offset %ebx, -12
24 ; DEFAULT-NEXT: .cfi_offset %ebp, -8
25 ; DEFAULT-NEXT: xorl %esi, %esi
26 ; DEFAULT-NEXT: movl {{[0-9]+}}(%esp), %edi
27 ; DEFAULT-NEXT: movl {{[0-9]+}}(%esp), %ebx
28 ; DEFAULT-NEXT: .p2align 4, 0x90
29 ; DEFAULT-NEXT: .LBB0_1: # %outer
30 ; DEFAULT-NEXT: # =>This Loop Header: Depth=1
31 ; DEFAULT-NEXT: # Child Loop BB0_2 Depth 2
32 ; DEFAULT-NEXT: movl %edi, %ebp
33 ; DEFAULT-NEXT: .p2align 4, 0x90
34 ; DEFAULT-NEXT: .LBB0_2: # %inner
35 ; DEFAULT-NEXT: # Parent Loop BB0_1 Depth=1
36 ; DEFAULT-NEXT: # => This Inner Loop Header: Depth=2
37 ; DEFAULT-NEXT: calll foo@PLT
38 ; DEFAULT-NEXT: decl %ebp
39 ; DEFAULT-NEXT: jne .LBB0_2
40 ; DEFAULT-NEXT: # %bb.3: # %outer_bb
41 ; DEFAULT-NEXT: # in Loop: Header=BB0_1 Depth=1
42 ; DEFAULT-NEXT: incl %esi
43 ; DEFAULT-NEXT: cmpl %ebx, %esi
44 ; DEFAULT-NEXT: jne .LBB0_1
45 ; DEFAULT-NEXT: # %bb.4: # %exit
46 ; DEFAULT-NEXT: addl $12, %esp
47 ; DEFAULT-NEXT: .cfi_def_cfa_offset 20
48 ; DEFAULT-NEXT: popl %esi
49 ; DEFAULT-NEXT: .cfi_def_cfa_offset 16
50 ; DEFAULT-NEXT: popl %edi
51 ; DEFAULT-NEXT: .cfi_def_cfa_offset 12
52 ; DEFAULT-NEXT: popl %ebx
53 ; DEFAULT-NEXT: .cfi_def_cfa_offset 8
54 ; DEFAULT-NEXT: popl %ebp
55 ; DEFAULT-NEXT: .cfi_def_cfa_offset 4
58 ; ALIGN32-LABEL: test:
59 ; ALIGN32: # %bb.0: # %entry
60 ; ALIGN32-NEXT: pushl %ebp
61 ; ALIGN32-NEXT: .cfi_def_cfa_offset 8
62 ; ALIGN32-NEXT: pushl %ebx
63 ; ALIGN32-NEXT: .cfi_def_cfa_offset 12
64 ; ALIGN32-NEXT: pushl %edi
65 ; ALIGN32-NEXT: .cfi_def_cfa_offset 16
66 ; ALIGN32-NEXT: pushl %esi
67 ; ALIGN32-NEXT: .cfi_def_cfa_offset 20
68 ; ALIGN32-NEXT: subl $12, %esp
69 ; ALIGN32-NEXT: .cfi_def_cfa_offset 32
70 ; ALIGN32-NEXT: .cfi_offset %esi, -20
71 ; ALIGN32-NEXT: .cfi_offset %edi, -16
72 ; ALIGN32-NEXT: .cfi_offset %ebx, -12
73 ; ALIGN32-NEXT: .cfi_offset %ebp, -8
74 ; ALIGN32-NEXT: xorl %esi, %esi
75 ; ALIGN32-NEXT: movl {{[0-9]+}}(%esp), %edi
76 ; ALIGN32-NEXT: movl {{[0-9]+}}(%esp), %ebx
77 ; ALIGN32-NEXT: .p2align 4, 0x90
78 ; ALIGN32-NEXT: .LBB0_1: # %outer
79 ; ALIGN32-NEXT: # =>This Loop Header: Depth=1
80 ; ALIGN32-NEXT: # Child Loop BB0_2 Depth 2
81 ; ALIGN32-NEXT: movl %edi, %ebp
82 ; ALIGN32-NEXT: .p2align 5, 0x90
83 ; ALIGN32-NEXT: .LBB0_2: # %inner
84 ; ALIGN32-NEXT: # Parent Loop BB0_1 Depth=1
85 ; ALIGN32-NEXT: # => This Inner Loop Header: Depth=2
86 ; ALIGN32-NEXT: calll foo@PLT
87 ; ALIGN32-NEXT: decl %ebp
88 ; ALIGN32-NEXT: jne .LBB0_2
89 ; ALIGN32-NEXT: # %bb.3: # %outer_bb
90 ; ALIGN32-NEXT: # in Loop: Header=BB0_1 Depth=1
91 ; ALIGN32-NEXT: incl %esi
92 ; ALIGN32-NEXT: cmpl %ebx, %esi
93 ; ALIGN32-NEXT: jne .LBB0_1
94 ; ALIGN32-NEXT: # %bb.4: # %exit
95 ; ALIGN32-NEXT: addl $12, %esp
96 ; ALIGN32-NEXT: .cfi_def_cfa_offset 20
97 ; ALIGN32-NEXT: popl %esi
98 ; ALIGN32-NEXT: .cfi_def_cfa_offset 16
99 ; ALIGN32-NEXT: popl %edi
100 ; ALIGN32-NEXT: .cfi_def_cfa_offset 12
101 ; ALIGN32-NEXT: popl %ebx
102 ; ALIGN32-NEXT: .cfi_def_cfa_offset 8
103 ; ALIGN32-NEXT: popl %ebp
104 ; ALIGN32-NEXT: .cfi_def_cfa_offset 4
107 ; ALIGN64-LABEL: test:
108 ; ALIGN64: # %bb.0: # %entry
109 ; ALIGN64-NEXT: pushl %ebp
110 ; ALIGN64-NEXT: .cfi_def_cfa_offset 8
111 ; ALIGN64-NEXT: pushl %ebx
112 ; ALIGN64-NEXT: .cfi_def_cfa_offset 12
113 ; ALIGN64-NEXT: pushl %edi
114 ; ALIGN64-NEXT: .cfi_def_cfa_offset 16
115 ; ALIGN64-NEXT: pushl %esi
116 ; ALIGN64-NEXT: .cfi_def_cfa_offset 20
117 ; ALIGN64-NEXT: subl $12, %esp
118 ; ALIGN64-NEXT: .cfi_def_cfa_offset 32
119 ; ALIGN64-NEXT: .cfi_offset %esi, -20
120 ; ALIGN64-NEXT: .cfi_offset %edi, -16
121 ; ALIGN64-NEXT: .cfi_offset %ebx, -12
122 ; ALIGN64-NEXT: .cfi_offset %ebp, -8
123 ; ALIGN64-NEXT: xorl %esi, %esi
124 ; ALIGN64-NEXT: movl {{[0-9]+}}(%esp), %edi
125 ; ALIGN64-NEXT: movl {{[0-9]+}}(%esp), %ebx
126 ; ALIGN64-NEXT: .p2align 5, 0x90
127 ; ALIGN64-NEXT: .LBB0_1: # %outer
128 ; ALIGN64-NEXT: # =>This Loop Header: Depth=1
129 ; ALIGN64-NEXT: # Child Loop BB0_2 Depth 2
130 ; ALIGN64-NEXT: movl %edi, %ebp
131 ; ALIGN64-NEXT: .p2align 6, 0x90
132 ; ALIGN64-NEXT: .LBB0_2: # %inner
133 ; ALIGN64-NEXT: # Parent Loop BB0_1 Depth=1
134 ; ALIGN64-NEXT: # => This Inner Loop Header: Depth=2
135 ; ALIGN64-NEXT: calll foo@PLT
136 ; ALIGN64-NEXT: decl %ebp
137 ; ALIGN64-NEXT: jne .LBB0_2
138 ; ALIGN64-NEXT: # %bb.3: # %outer_bb
139 ; ALIGN64-NEXT: # in Loop: Header=BB0_1 Depth=1
140 ; ALIGN64-NEXT: incl %esi
141 ; ALIGN64-NEXT: cmpl %ebx, %esi
142 ; ALIGN64-NEXT: jne .LBB0_1
143 ; ALIGN64-NEXT: # %bb.4: # %exit
144 ; ALIGN64-NEXT: addl $12, %esp
145 ; ALIGN64-NEXT: .cfi_def_cfa_offset 20
146 ; ALIGN64-NEXT: popl %esi
147 ; ALIGN64-NEXT: .cfi_def_cfa_offset 16
148 ; ALIGN64-NEXT: popl %edi
149 ; ALIGN64-NEXT: .cfi_def_cfa_offset 12
150 ; ALIGN64-NEXT: popl %ebx
151 ; ALIGN64-NEXT: .cfi_def_cfa_offset 8
152 ; ALIGN64-NEXT: popl %ebp
153 ; ALIGN64-NEXT: .cfi_def_cfa_offset 4
162 %outer.iv = phi i32 [0, %entry], [%outer.iv.next, %outer_bb]
166 %inner.iv = phi i32 [0, %outer], [%inner.iv.next, %inner]
168 %inner.iv.next = add i32 %inner.iv, 1
169 %inner.cond = icmp ne i32 %inner.iv.next, %m
170 br i1 %inner.cond, label %inner, label %outer_bb
173 %outer.iv.next = add i32 %outer.iv, 1
174 %outer.cond = icmp ne i32 %outer.iv.next, %n
175 br i1 %outer.cond, label %outer, label %exit