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 $5, {{[0-9]+}}(%esp)
9 ; JUMP2-NEXT: jl bar@PLT # TAILCALL
10 ; JUMP2-NEXT: # %bb.1: # %entry
11 ; JUMP2-NEXT: cmpl $0, {{[0-9]+}}(%esp)
12 ; JUMP2-NEXT: je bar@PLT # TAILCALL
13 ; JUMP2-NEXT: # %bb.2: # %UnifiedReturnBlock
17 ; JUMP1: # %bb.0: # %entry
18 ; JUMP1-NEXT: cmpl $0, {{[0-9]+}}(%esp)
19 ; JUMP1-NEXT: setne %al
20 ; JUMP1-NEXT: cmpl $5, {{[0-9]+}}(%esp)
21 ; JUMP1-NEXT: setge %cl
22 ; JUMP1-NEXT: testb %al, %cl
23 ; JUMP1-NEXT: je bar@PLT # TAILCALL
24 ; JUMP1-NEXT: # %bb.1: # %UnifiedReturnBlock
27 %tmp1 = icmp eq i32 %X, 0
28 %tmp3 = icmp slt i32 %Y, 5
29 %tmp4 = or i1 %tmp3, %tmp1
30 br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock
33 %tmp5 = tail call i32 (...) @bar( )
40 ; If the branch is unpredictable, don't add another branch
41 ; regardless of whether they are expensive or not.
43 define void @unpredictable(i32 %X, i32 %Y, i32 %Z) nounwind {
44 ; JUMP2-LABEL: unpredictable:
45 ; JUMP2: # %bb.0: # %entry
46 ; JUMP2-NEXT: cmpl $0, {{[0-9]+}}(%esp)
47 ; JUMP2-NEXT: setne %al
48 ; JUMP2-NEXT: cmpl $5, {{[0-9]+}}(%esp)
49 ; JUMP2-NEXT: setge %cl
50 ; JUMP2-NEXT: testb %al, %cl
51 ; JUMP2-NEXT: je bar@PLT # TAILCALL
52 ; JUMP2-NEXT: # %bb.1: # %UnifiedReturnBlock
55 ; JUMP1-LABEL: unpredictable:
56 ; JUMP1: # %bb.0: # %entry
57 ; JUMP1-NEXT: cmpl $0, {{[0-9]+}}(%esp)
58 ; JUMP1-NEXT: setne %al
59 ; JUMP1-NEXT: cmpl $5, {{[0-9]+}}(%esp)
60 ; JUMP1-NEXT: setge %cl
61 ; JUMP1-NEXT: testb %al, %cl
62 ; JUMP1-NEXT: je bar@PLT # TAILCALL
63 ; JUMP1-NEXT: # %bb.1: # %UnifiedReturnBlock
66 %tmp1 = icmp eq i32 %X, 0
67 %tmp3 = icmp slt i32 %Y, 5
68 %tmp4 = or i1 %tmp3, %tmp1
69 br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock, !unpredictable !0
72 %tmp5 = tail call i32 (...) @bar( )