1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s
4 declare dso_local void @bar()
6 define dso_local void @test1(ptr nocapture %X) nounwind minsize {
8 ; CHECK: # %bb.0: # %entry
9 ; CHECK-NEXT: cmpb $47, (%rdi)
10 ; CHECK-NEXT: je bar # TAILCALL
11 ; CHECK-NEXT: # %bb.1: # %if.end
14 %tmp1 = load i32, ptr %X, align 4
15 %and = and i32 %tmp1, 255
16 %cmp = icmp eq i32 %and, 47
17 br i1 %cmp, label %if.then, label %if.end
20 tail call void @bar() nounwind
27 define dso_local void @test2(i32 %X) nounwind minsize {
29 ; CHECK: # %bb.0: # %entry
30 ; CHECK-NEXT: cmpb $47, %dil
31 ; CHECK-NEXT: je bar # TAILCALL
32 ; CHECK-NEXT: # %bb.1: # %if.end
35 %and = and i32 %X, 255
36 %cmp = icmp eq i32 %and, 47
37 br i1 %cmp, label %if.then, label %if.end
40 tail call void @bar() nounwind
47 define dso_local void @test3(i32 %X) nounwind minsize {
49 ; CHECK: # %bb.0: # %entry
50 ; CHECK-NEXT: cmpb $-1, %dil
51 ; CHECK-NEXT: je bar # TAILCALL
52 ; CHECK-NEXT: # %bb.1: # %if.end
55 %and = and i32 %X, 255
56 %cmp = icmp eq i32 %and, 255
57 br i1 %cmp, label %if.then, label %if.end
60 tail call void @bar() nounwind
68 define i1 @test4(i64 %a, i32 %b) {
70 ; CHECK: # %bb.0: # %entry
71 ; CHECK-NEXT: movb $1, %al
72 ; CHECK-NEXT: testl %esi, %esi
73 ; CHECK-NEXT: je .LBB3_1
74 ; CHECK-NEXT: # %bb.2: # %lor.end
75 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
77 ; CHECK-NEXT: .LBB3_1: # %lor.rhs
78 ; CHECK-NEXT: xorl %eax, %eax
79 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
82 %tobool = icmp ne i32 %b, 0
83 br i1 %tobool, label %lor.end, label %lor.rhs
85 lor.rhs: ; preds = %entry
87 %tobool1 = icmp ne i64 %and, 0
90 lor.end: ; preds = %lor.rhs, %entry
91 %p = phi i1 [ true, %entry ], [ %tobool1, %lor.rhs ]
95 @x = dso_local global { i8, i8, i8, i8, i8, i8, i8, i8 } { i8 1, i8 0, i8 0, i8 0, i8 1, i8 0, i8 0, i8 1 }, align 4
98 define dso_local void @test5(i32 %X) nounwind minsize {
100 ; CHECK: # %bb.0: # %entry
101 ; CHECK-NEXT: movzbl x+6(%rip), %eax
102 ; CHECK-NEXT: shll $16, %eax
103 ; CHECK-NEXT: movzwl x+4(%rip), %ecx
104 ; CHECK-NEXT: orl %eax, %ecx
105 ; CHECK-NEXT: cmpl $1, %ecx
106 ; CHECK-NEXT: jne bar # TAILCALL
107 ; CHECK-NEXT: # %bb.1: # %if.end
110 %bf.load = load i56, ptr @x, align 4
111 %bf.lshr = lshr i56 %bf.load, 32
112 %bf.cast = trunc i56 %bf.lshr to i32
113 %cmp = icmp ne i32 %bf.cast, 1
114 br i1 %cmp, label %if.then, label %if.end
117 tail call void @bar() nounwind
124 define dso_local void @test2_1(i32 %X) nounwind minsize {
125 ; CHECK-LABEL: test2_1:
126 ; CHECK: # %bb.0: # %entry
127 ; CHECK-NEXT: movzbl %dil, %eax
128 ; CHECK-NEXT: cmpl $256, %eax # imm = 0x100
129 ; CHECK-NEXT: je bar # TAILCALL
130 ; CHECK-NEXT: # %bb.1: # %if.end
133 %and = and i32 %X, 255
134 %cmp = icmp eq i32 %and, 256
135 br i1 %cmp, label %if.then, label %if.end
138 tail call void @bar() nounwind
145 define dso_local void @test_sext_i8_icmp_1(i8 %x) nounwind minsize {
146 ; CHECK-LABEL: test_sext_i8_icmp_1:
147 ; CHECK: # %bb.0: # %entry
148 ; CHECK-NEXT: cmpb $1, %dil
149 ; CHECK-NEXT: je bar # TAILCALL
150 ; CHECK-NEXT: # %bb.1: # %if.end
153 %sext = sext i8 %x to i32
154 %cmp = icmp eq i32 %sext, 1
155 br i1 %cmp, label %if.then, label %if.end
158 tail call void @bar() nounwind
165 define dso_local void @test_sext_i8_icmp_47(i8 %x) nounwind minsize {
166 ; CHECK-LABEL: test_sext_i8_icmp_47:
167 ; CHECK: # %bb.0: # %entry
168 ; CHECK-NEXT: cmpb $47, %dil
169 ; CHECK-NEXT: je bar # TAILCALL
170 ; CHECK-NEXT: # %bb.1: # %if.end
173 %sext = sext i8 %x to i32
174 %cmp = icmp eq i32 %sext, 47
175 br i1 %cmp, label %if.then, label %if.end
178 tail call void @bar() nounwind
185 define dso_local void @test_sext_i8_icmp_127(i8 %x) nounwind minsize {
186 ; CHECK-LABEL: test_sext_i8_icmp_127:
187 ; CHECK: # %bb.0: # %entry
188 ; CHECK-NEXT: cmpb $127, %dil
189 ; CHECK-NEXT: je bar # TAILCALL
190 ; CHECK-NEXT: # %bb.1: # %if.end
193 %sext = sext i8 %x to i32
194 %cmp = icmp eq i32 %sext, 127
195 br i1 %cmp, label %if.then, label %if.end
198 tail call void @bar() nounwind
205 define dso_local void @test_sext_i8_icmp_neg1(i8 %x) nounwind minsize {
206 ; CHECK-LABEL: test_sext_i8_icmp_neg1:
207 ; CHECK: # %bb.0: # %entry
208 ; CHECK-NEXT: cmpb $-1, %dil
209 ; CHECK-NEXT: je bar # TAILCALL
210 ; CHECK-NEXT: # %bb.1: # %if.end
213 %sext = sext i8 %x to i32
214 %cmp = icmp eq i32 %sext, -1
215 br i1 %cmp, label %if.then, label %if.end
218 tail call void @bar() nounwind
225 define dso_local void @test_sext_i8_icmp_neg2(i8 %x) nounwind minsize {
226 ; CHECK-LABEL: test_sext_i8_icmp_neg2:
227 ; CHECK: # %bb.0: # %entry
228 ; CHECK-NEXT: cmpb $-2, %dil
229 ; CHECK-NEXT: je bar # TAILCALL
230 ; CHECK-NEXT: # %bb.1: # %if.end
233 %sext = sext i8 %x to i32
234 %cmp = icmp eq i32 %sext, -2
235 br i1 %cmp, label %if.then, label %if.end
238 tail call void @bar() nounwind
245 define dso_local void @test_sext_i8_icmp_neg127(i8 %x) nounwind minsize {
246 ; CHECK-LABEL: test_sext_i8_icmp_neg127:
247 ; CHECK: # %bb.0: # %entry
248 ; CHECK-NEXT: cmpb $-127, %dil
249 ; CHECK-NEXT: je bar # TAILCALL
250 ; CHECK-NEXT: # %bb.1: # %if.end
253 %sext = sext i8 %x to i32
254 %cmp = icmp eq i32 %sext, -127
255 br i1 %cmp, label %if.then, label %if.end
258 tail call void @bar() nounwind
265 define dso_local void @test_sext_i8_icmp_neg128(i8 %x) nounwind minsize {
266 ; CHECK-LABEL: test_sext_i8_icmp_neg128:
267 ; CHECK: # %bb.0: # %entry
268 ; CHECK-NEXT: negb %dil
269 ; CHECK-NEXT: jo bar # TAILCALL
270 ; CHECK-NEXT: # %bb.1: # %if.end
273 %sext = sext i8 %x to i32
274 %cmp = icmp eq i32 %sext, -128
275 br i1 %cmp, label %if.then, label %if.end
278 tail call void @bar() nounwind
285 define dso_local void @test_sext_i8_icmp_255(i8 %x) nounwind minsize {
286 ; CHECK-LABEL: test_sext_i8_icmp_255:
287 ; CHECK: # %bb.0: # %entry
288 ; CHECK-NEXT: movb $1, %al
289 ; CHECK-NEXT: testb %al, %al
290 ; CHECK-NEXT: je bar # TAILCALL
291 ; CHECK-NEXT: # %bb.1: # %if.end
294 %sext = sext i8 %x to i32
295 %cmp = icmp eq i32 %sext, 255
296 br i1 %cmp, label %if.then, label %if.end
299 tail call void @bar() nounwind