1; RUN: llc < %s -mtriple=i686-linux -show-mc-encoding | FileCheck %s
2; RUN: llc < %s -mtriple=x86_64-linux -show-mc-encoding | FileCheck %s
3
4declare void @foo()
5declare void @bar()
6
7define void @f(i32 %x, i32 %y) optsize {
8entry:
9	%p = icmp eq i32 %x, %y
10  br i1 %p, label %bb1, label %bb2
11bb1:
12  tail call void @foo()
13  ret void
14bb2:
15  tail call void @bar()
16  ret void
17
18; CHECK-LABEL: f:
19; CHECK: cmp
20; CHECK: jne bar
21; Check that the asm doesn't just look good, but uses the correct encoding.
22; CHECK: encoding: [0x75,A]
23; CHECK: jmp foo
24}
25
26
27declare x86_thiscallcc zeroext i1 @baz(i8*, i32)
28define x86_thiscallcc zeroext i1 @BlockPlacementTest(i8* %this, i32 %x) optsize {
29entry:
30  %and = and i32 %x, 42
31  %tobool = icmp eq i32 %and, 0
32  br i1 %tobool, label %land.end, label %land.rhs
33
34land.rhs:
35  %and6 = and i32 %x, 44
36  %tobool7 = icmp eq i32 %and6, 0
37  br i1 %tobool7, label %lor.rhs, label %land.end
38
39lor.rhs:
40  %call = tail call x86_thiscallcc zeroext i1 @baz(i8* %this, i32 %x) #2
41  br label %land.end
42
43land.end:
44  %0 = phi i1 [ false, %entry ], [ true, %land.rhs ], [ %call, %lor.rhs ]
45  ret i1 %0
46
47; Make sure machine block placement isn't confused by the conditional tail call,
48; but sees that it can fall through to the next block.
49; CHECK-LABEL: BlockPlacementTest
50; CHECK: je baz
51; CHECK-NOT: xor
52; CHECK: ret
53}
54