1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-unknown-unknown -jump-is-expensive=0 | FileCheck %s --check-prefix=JUMP2
3 ; RUN: llc < %s -mtriple=i386-unknown-unknown -jump-is-expensive=1 | FileCheck %s --check-prefix=JUMP1
5 define void @foo(i32 %X, i32 %Y, i32 %Z) nounwind {
7 ; JUMP2: # %bb.0: # %entry
8 ; JUMP2-NEXT: cmpl $0, {{[0-9]+}}(%esp)
9 ; JUMP2-NEXT: setne %al
10 ; JUMP2-NEXT: cmpl $5, {{[0-9]+}}(%esp)
11 ; JUMP2-NEXT: setge %cl
12 ; JUMP2-NEXT: testb %al, %cl
13 ; JUMP2-NEXT: je bar@PLT # TAILCALL
14 ; JUMP2-NEXT: # %bb.1: # %UnifiedReturnBlock
18 ; JUMP1: # %bb.0: # %entry
19 ; JUMP1-NEXT: cmpl $0, {{[0-9]+}}(%esp)
20 ; JUMP1-NEXT: setne %al
21 ; JUMP1-NEXT: cmpl $5, {{[0-9]+}}(%esp)
22 ; JUMP1-NEXT: setge %cl
23 ; JUMP1-NEXT: testb %al, %cl
24 ; JUMP1-NEXT: je bar@PLT # TAILCALL
25 ; JUMP1-NEXT: # %bb.1: # %UnifiedReturnBlock
28 %tmp1 = icmp eq i32 %X, 0
29 %tmp3 = icmp slt i32 %Y, 5
30 %tmp4 = or i1 %tmp3, %tmp1
31 br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock
34 %tmp5 = tail call i32 (...) @bar( )
41 ; If the branch is unpredictable, don't add another branch
42 ; regardless of whether they are expensive or not.
44 define void @unpredictable(i32 %X, i32 %Y, i32 %Z) nounwind {
45 ; JUMP2-LABEL: unpredictable:
46 ; JUMP2: # %bb.0: # %entry
47 ; JUMP2-NEXT: cmpl $0, {{[0-9]+}}(%esp)
48 ; JUMP2-NEXT: setne %al
49 ; JUMP2-NEXT: cmpl $5, {{[0-9]+}}(%esp)
50 ; JUMP2-NEXT: setge %cl
51 ; JUMP2-NEXT: testb %al, %cl
52 ; JUMP2-NEXT: je bar@PLT # TAILCALL
53 ; JUMP2-NEXT: # %bb.1: # %UnifiedReturnBlock
56 ; JUMP1-LABEL: unpredictable:
57 ; JUMP1: # %bb.0: # %entry
58 ; JUMP1-NEXT: cmpl $0, {{[0-9]+}}(%esp)
59 ; JUMP1-NEXT: setne %al
60 ; JUMP1-NEXT: cmpl $5, {{[0-9]+}}(%esp)
61 ; JUMP1-NEXT: setge %cl
62 ; JUMP1-NEXT: testb %al, %cl
63 ; JUMP1-NEXT: je bar@PLT # TAILCALL
64 ; JUMP1-NEXT: # %bb.1: # %UnifiedReturnBlock
67 %tmp1 = icmp eq i32 %X, 0
68 %tmp3 = icmp slt i32 %Y, 5
69 %tmp4 = or i1 %tmp3, %tmp1
70 br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock, !unpredictable !0
73 %tmp5 = tail call i32 (...) @bar( )