1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-- -mattr=-macrofusion,-branchfusion -post-RA-scheduler=0 | FileCheck %s --check-prefixes=NOFUSION,NOFUSION_NOPOSTRA
3 ; RUN: llc < %s -mtriple=x86_64-- -mattr=-macrofusion,+branchfusion -post-RA-scheduler=0 | FileCheck %s --check-prefixes=FUSION,BRANCHFUSIONONLY_NOPOSTRA
4 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+macrofusion,-branchfusion -post-RA-scheduler=0 | FileCheck %s --check-prefixes=FUSION,MACROFUSION_NOPOSTRA
5 ; RUN: llc < %s -mtriple=x86_64-- -mattr=-macrofusion,-branchfusion -post-RA-scheduler=1 | FileCheck %s --check-prefixes=NOFUSION,NOFUSION_POSTRA
6 ; RUN: llc < %s -mtriple=x86_64-- -mattr=-macrofusion,+branchfusion -post-RA-scheduler=1 | FileCheck %s --check-prefixes=FUSION,BRANCHFUSION_POSTRA
7 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+macrofusion,-branchfusion -post-RA-scheduler=1 | FileCheck %s --check-prefixes=FUSION,BRANCHFUSION_POSTRA
8 ; RUN: llc < %s -mtriple=x86_64-- -mattr=-macrofusion,-branchfusion -enable-misched=0 -misched-postra=1 -enable-post-misched | FileCheck %s --check-prefixes=NOFUSION,NOFUSION_MISCHEDPOSTRA
9 ; RUN: llc < %s -mtriple=x86_64-- -mattr=-macrofusion,+branchfusion -enable-misched=0 -misched-postra=1 -enable-post-misched | FileCheck %s --check-prefixes=FUSION,BRANCHFUSION_MISCHEDPOSTRA
10 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+macrofusion,-branchfusion -enable-misched=0 -misched-postra=1 -enable-post-misched | FileCheck %s --check-prefixes=FUSION,BRANCHFUSION_MISCHEDPOSTRA
14 ; testb should be scheduled right before je to enable macro-fusion.
16 define i32 @macrofuse_test_je(i32 %flags, ptr %p) nounwind {
17 ; NOFUSION-LABEL: macrofuse_test_je:
18 ; NOFUSION: # %bb.0: # %entry
19 ; NOFUSION-NEXT: xorl %eax, %eax
20 ; NOFUSION-NEXT: testl $512, %edi # imm = 0x200
21 ; NOFUSION-NEXT: movb $1, (%rsi)
22 ; NOFUSION-NEXT: je .LBB0_2
23 ; NOFUSION-NEXT: # %bb.1: # %if.then
24 ; NOFUSION-NEXT: movl $1, %eax
25 ; NOFUSION-NEXT: .LBB0_2: # %if.end
28 ; FUSION-LABEL: macrofuse_test_je:
29 ; FUSION: # %bb.0: # %entry
30 ; FUSION-NEXT: xorl %eax, %eax
31 ; FUSION-NEXT: movb $1, (%rsi)
32 ; FUSION-NEXT: testl $512, %edi # imm = 0x200
33 ; FUSION-NEXT: je .LBB0_2
34 ; FUSION-NEXT: # %bb.1: # %if.then
35 ; FUSION-NEXT: movl $1, %eax
36 ; FUSION-NEXT: .LBB0_2: # %if.end
39 %and = and i32 %flags, 512
40 %tobool = icmp eq i32 %and, 0
42 br i1 %tobool, label %if.end, label %if.then
48 %hasflag = phi i32 [ 1, %if.then ], [ 0, %entry ]
52 define i32 @macrofuse_cmp_je(i32 %flags, ptr %p) nounwind {
53 ; NOFUSION-LABEL: macrofuse_cmp_je:
54 ; NOFUSION: # %bb.0: # %entry
55 ; NOFUSION-NEXT: cmpl $512, %edi # imm = 0x200
56 ; NOFUSION-NEXT: movb $1, (%rsi)
57 ; NOFUSION-NEXT: je .LBB1_1
58 ; NOFUSION-NEXT: # %bb.2: # %if.then
59 ; NOFUSION-NEXT: movl $1, %eax
61 ; NOFUSION-NEXT: .LBB1_1:
62 ; NOFUSION-NEXT: xorl %eax, %eax
65 ; FUSION-LABEL: macrofuse_cmp_je:
66 ; FUSION: # %bb.0: # %entry
67 ; FUSION-NEXT: movb $1, (%rsi)
68 ; FUSION-NEXT: cmpl $512, %edi # imm = 0x200
69 ; FUSION-NEXT: je .LBB1_1
70 ; FUSION-NEXT: # %bb.2: # %if.then
71 ; FUSION-NEXT: movl $1, %eax
73 ; FUSION-NEXT: .LBB1_1:
74 ; FUSION-NEXT: xorl %eax, %eax
77 %sub = sub i32 %flags, 512
78 %tobool = icmp eq i32 %sub, 0
80 br i1 %tobool, label %if.end, label %if.then
86 %hasflag = phi i32 [ 1, %if.then ], [ 0, %entry ]
90 define i32 @macrofuse_alu_je(i32 %flags, ptr %p) nounwind {
91 ; NOFUSION_NOPOSTRA-LABEL: macrofuse_alu_je:
92 ; NOFUSION_NOPOSTRA: # %bb.0: # %entry
93 ; NOFUSION_NOPOSTRA-NEXT: movl %edi, %eax
94 ; NOFUSION_NOPOSTRA-NEXT: addl $-512, %eax # imm = 0xFE00
95 ; NOFUSION_NOPOSTRA-NEXT: movb $1, (%rsi)
96 ; NOFUSION_NOPOSTRA-NEXT: je .LBB2_2
97 ; NOFUSION_NOPOSTRA-NEXT: # %bb.1: # %if.then
98 ; NOFUSION_NOPOSTRA-NEXT: movl $1, %eax
99 ; NOFUSION_NOPOSTRA-NEXT: .LBB2_2: # %if.end
100 ; NOFUSION_NOPOSTRA-NEXT: retq
102 ; BRANCHFUSIONONLY_NOPOSTRA-LABEL: macrofuse_alu_je:
103 ; BRANCHFUSIONONLY_NOPOSTRA: # %bb.0: # %entry
104 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: movl %edi, %eax
105 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: addl $-512, %eax # imm = 0xFE00
106 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: movb $1, (%rsi)
107 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: je .LBB2_2
108 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: # %bb.1: # %if.then
109 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: movl $1, %eax
110 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: .LBB2_2: # %if.end
111 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: retq
113 ; MACROFUSION_NOPOSTRA-LABEL: macrofuse_alu_je:
114 ; MACROFUSION_NOPOSTRA: # %bb.0: # %entry
115 ; MACROFUSION_NOPOSTRA-NEXT: movl %edi, %eax
116 ; MACROFUSION_NOPOSTRA-NEXT: movb $1, (%rsi)
117 ; MACROFUSION_NOPOSTRA-NEXT: addl $-512, %eax # imm = 0xFE00
118 ; MACROFUSION_NOPOSTRA-NEXT: je .LBB2_2
119 ; MACROFUSION_NOPOSTRA-NEXT: # %bb.1: # %if.then
120 ; MACROFUSION_NOPOSTRA-NEXT: movl $1, %eax
121 ; MACROFUSION_NOPOSTRA-NEXT: .LBB2_2: # %if.end
122 ; MACROFUSION_NOPOSTRA-NEXT: retq
124 ; NOFUSION_POSTRA-LABEL: macrofuse_alu_je:
125 ; NOFUSION_POSTRA: # %bb.0: # %entry
126 ; NOFUSION_POSTRA-NEXT: movl %edi, %eax
127 ; NOFUSION_POSTRA-NEXT: movb $1, (%rsi)
128 ; NOFUSION_POSTRA-NEXT: addl $-512, %eax # imm = 0xFE00
129 ; NOFUSION_POSTRA-NEXT: je .LBB2_2
130 ; NOFUSION_POSTRA-NEXT: # %bb.1: # %if.then
131 ; NOFUSION_POSTRA-NEXT: movl $1, %eax
132 ; NOFUSION_POSTRA-NEXT: .LBB2_2: # %if.end
133 ; NOFUSION_POSTRA-NEXT: retq
135 ; BRANCHFUSION_POSTRA-LABEL: macrofuse_alu_je:
136 ; BRANCHFUSION_POSTRA: # %bb.0: # %entry
137 ; BRANCHFUSION_POSTRA-NEXT: movl %edi, %eax
138 ; BRANCHFUSION_POSTRA-NEXT: movb $1, (%rsi)
139 ; BRANCHFUSION_POSTRA-NEXT: addl $-512, %eax # imm = 0xFE00
140 ; BRANCHFUSION_POSTRA-NEXT: je .LBB2_2
141 ; BRANCHFUSION_POSTRA-NEXT: # %bb.1: # %if.then
142 ; BRANCHFUSION_POSTRA-NEXT: movl $1, %eax
143 ; BRANCHFUSION_POSTRA-NEXT: .LBB2_2: # %if.end
144 ; BRANCHFUSION_POSTRA-NEXT: retq
146 ; NOFUSION_MISCHEDPOSTRA-LABEL: macrofuse_alu_je:
147 ; NOFUSION_MISCHEDPOSTRA: # %bb.0: # %entry
148 ; NOFUSION_MISCHEDPOSTRA-NEXT: movl %edi, %eax
149 ; NOFUSION_MISCHEDPOSTRA-NEXT: movb $1, (%rsi)
150 ; NOFUSION_MISCHEDPOSTRA-NEXT: addl $-512, %eax # imm = 0xFE00
151 ; NOFUSION_MISCHEDPOSTRA-NEXT: je .LBB2_2
152 ; NOFUSION_MISCHEDPOSTRA-NEXT: # %bb.1: # %if.then
153 ; NOFUSION_MISCHEDPOSTRA-NEXT: movl $1, %eax
154 ; NOFUSION_MISCHEDPOSTRA-NEXT: .LBB2_2: # %if.end
155 ; NOFUSION_MISCHEDPOSTRA-NEXT: retq
157 ; BRANCHFUSION_MISCHEDPOSTRA-LABEL: macrofuse_alu_je:
158 ; BRANCHFUSION_MISCHEDPOSTRA: # %bb.0: # %entry
159 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: movl %edi, %eax
160 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: movb $1, (%rsi)
161 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: addl $-512, %eax # imm = 0xFE00
162 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: je .LBB2_2
163 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: # %bb.1: # %if.then
164 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: movl $1, %eax
165 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: .LBB2_2: # %if.end
166 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: retq
168 %sub = sub i32 %flags, 512
169 %tobool = icmp eq i32 %sub, 0
171 br i1 %tobool, label %if.end, label %if.then
177 %hasflag = phi i32 [ 1, %if.then ], [ %sub, %entry ]
181 define i32 @macrofuse_dec_je(i32 %flags, ptr %p) nounwind {
182 ; NOFUSION_NOPOSTRA-LABEL: macrofuse_dec_je:
183 ; NOFUSION_NOPOSTRA: # %bb.0: # %entry
184 ; NOFUSION_NOPOSTRA-NEXT: movl %edi, %eax
185 ; NOFUSION_NOPOSTRA-NEXT: decl %eax
186 ; NOFUSION_NOPOSTRA-NEXT: movb $1, (%rsi)
187 ; NOFUSION_NOPOSTRA-NEXT: je .LBB3_2
188 ; NOFUSION_NOPOSTRA-NEXT: # %bb.1: # %if.then
189 ; NOFUSION_NOPOSTRA-NEXT: movl $1, %eax
190 ; NOFUSION_NOPOSTRA-NEXT: .LBB3_2: # %if.end
191 ; NOFUSION_NOPOSTRA-NEXT: retq
193 ; BRANCHFUSIONONLY_NOPOSTRA-LABEL: macrofuse_dec_je:
194 ; BRANCHFUSIONONLY_NOPOSTRA: # %bb.0: # %entry
195 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: movl %edi, %eax
196 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: decl %eax
197 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: movb $1, (%rsi)
198 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: je .LBB3_2
199 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: # %bb.1: # %if.then
200 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: movl $1, %eax
201 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: .LBB3_2: # %if.end
202 ; BRANCHFUSIONONLY_NOPOSTRA-NEXT: retq
204 ; MACROFUSION_NOPOSTRA-LABEL: macrofuse_dec_je:
205 ; MACROFUSION_NOPOSTRA: # %bb.0: # %entry
206 ; MACROFUSION_NOPOSTRA-NEXT: movl %edi, %eax
207 ; MACROFUSION_NOPOSTRA-NEXT: movb $1, (%rsi)
208 ; MACROFUSION_NOPOSTRA-NEXT: decl %eax
209 ; MACROFUSION_NOPOSTRA-NEXT: je .LBB3_2
210 ; MACROFUSION_NOPOSTRA-NEXT: # %bb.1: # %if.then
211 ; MACROFUSION_NOPOSTRA-NEXT: movl $1, %eax
212 ; MACROFUSION_NOPOSTRA-NEXT: .LBB3_2: # %if.end
213 ; MACROFUSION_NOPOSTRA-NEXT: retq
215 ; NOFUSION_POSTRA-LABEL: macrofuse_dec_je:
216 ; NOFUSION_POSTRA: # %bb.0: # %entry
217 ; NOFUSION_POSTRA-NEXT: movl %edi, %eax
218 ; NOFUSION_POSTRA-NEXT: movb $1, (%rsi)
219 ; NOFUSION_POSTRA-NEXT: decl %eax
220 ; NOFUSION_POSTRA-NEXT: je .LBB3_2
221 ; NOFUSION_POSTRA-NEXT: # %bb.1: # %if.then
222 ; NOFUSION_POSTRA-NEXT: movl $1, %eax
223 ; NOFUSION_POSTRA-NEXT: .LBB3_2: # %if.end
224 ; NOFUSION_POSTRA-NEXT: retq
226 ; BRANCHFUSION_POSTRA-LABEL: macrofuse_dec_je:
227 ; BRANCHFUSION_POSTRA: # %bb.0: # %entry
228 ; BRANCHFUSION_POSTRA-NEXT: movl %edi, %eax
229 ; BRANCHFUSION_POSTRA-NEXT: movb $1, (%rsi)
230 ; BRANCHFUSION_POSTRA-NEXT: decl %eax
231 ; BRANCHFUSION_POSTRA-NEXT: je .LBB3_2
232 ; BRANCHFUSION_POSTRA-NEXT: # %bb.1: # %if.then
233 ; BRANCHFUSION_POSTRA-NEXT: movl $1, %eax
234 ; BRANCHFUSION_POSTRA-NEXT: .LBB3_2: # %if.end
235 ; BRANCHFUSION_POSTRA-NEXT: retq
237 ; NOFUSION_MISCHEDPOSTRA-LABEL: macrofuse_dec_je:
238 ; NOFUSION_MISCHEDPOSTRA: # %bb.0: # %entry
239 ; NOFUSION_MISCHEDPOSTRA-NEXT: movl %edi, %eax
240 ; NOFUSION_MISCHEDPOSTRA-NEXT: movb $1, (%rsi)
241 ; NOFUSION_MISCHEDPOSTRA-NEXT: decl %eax
242 ; NOFUSION_MISCHEDPOSTRA-NEXT: je .LBB3_2
243 ; NOFUSION_MISCHEDPOSTRA-NEXT: # %bb.1: # %if.then
244 ; NOFUSION_MISCHEDPOSTRA-NEXT: movl $1, %eax
245 ; NOFUSION_MISCHEDPOSTRA-NEXT: .LBB3_2: # %if.end
246 ; NOFUSION_MISCHEDPOSTRA-NEXT: retq
248 ; BRANCHFUSION_MISCHEDPOSTRA-LABEL: macrofuse_dec_je:
249 ; BRANCHFUSION_MISCHEDPOSTRA: # %bb.0: # %entry
250 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: movl %edi, %eax
251 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: movb $1, (%rsi)
252 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: decl %eax
253 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: je .LBB3_2
254 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: # %bb.1: # %if.then
255 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: movl $1, %eax
256 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: .LBB3_2: # %if.end
257 ; BRANCHFUSION_MISCHEDPOSTRA-NEXT: retq
259 %sub = sub i32 %flags, 1
260 %tobool = icmp eq i32 %sub, 0
262 br i1 %tobool, label %if.end, label %if.then
268 %hasflag = phi i32 [ 1, %if.then ], [ %sub, %entry ]