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 .LBB0_3
10 ; JUMP2-NEXT: # %bb.1: # %entry
11 ; JUMP2-NEXT: cmpl $0, {{[0-9]+}}(%esp)
12 ; JUMP2-NEXT: je .LBB0_3
13 ; JUMP2-NEXT: # %bb.2: # %UnifiedReturnBlock
15 ; JUMP2-NEXT: .LBB0_3: # %cond_true
16 ; JUMP2-NEXT: jmp bar # TAILCALL
19 ; JUMP1: # %bb.0: # %entry
20 ; JUMP1-NEXT: cmpl $0, {{[0-9]+}}(%esp)
21 ; JUMP1-NEXT: setne %al
22 ; JUMP1-NEXT: cmpl $4, {{[0-9]+}}(%esp)
23 ; JUMP1-NEXT: setg %cl
24 ; JUMP1-NEXT: testb %al, %cl
25 ; JUMP1-NEXT: jne .LBB0_1
26 ; JUMP1-NEXT: # %bb.2: # %cond_true
27 ; JUMP1-NEXT: jmp bar # TAILCALL
28 ; JUMP1-NEXT: .LBB0_1: # %UnifiedReturnBlock
31 %tmp1 = icmp eq i32 %X, 0
32 %tmp3 = icmp slt i32 %Y, 5
33 %tmp4 = or i1 %tmp3, %tmp1
34 br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock
37 %tmp5 = tail call i32 (...) @bar( )
44 ; If the branch is unpredictable, don't add another branch
45 ; regardless of whether they are expensive or not.
47 define void @unpredictable(i32 %X, i32 %Y, i32 %Z) nounwind {
48 ; JUMP2-LABEL: unpredictable:
49 ; JUMP2: # %bb.0: # %entry
50 ; JUMP2-NEXT: cmpl $0, {{[0-9]+}}(%esp)
51 ; JUMP2-NEXT: setne %al
52 ; JUMP2-NEXT: cmpl $4, {{[0-9]+}}(%esp)
53 ; JUMP2-NEXT: setg %cl
54 ; JUMP2-NEXT: testb %al, %cl
55 ; JUMP2-NEXT: jne .LBB1_1
56 ; JUMP2-NEXT: # %bb.2: # %cond_true
57 ; JUMP2-NEXT: jmp bar # TAILCALL
58 ; JUMP2-NEXT: .LBB1_1: # %UnifiedReturnBlock
61 ; JUMP1-LABEL: unpredictable:
62 ; JUMP1: # %bb.0: # %entry
63 ; JUMP1-NEXT: cmpl $0, {{[0-9]+}}(%esp)
64 ; JUMP1-NEXT: setne %al
65 ; JUMP1-NEXT: cmpl $4, {{[0-9]+}}(%esp)
66 ; JUMP1-NEXT: setg %cl
67 ; JUMP1-NEXT: testb %al, %cl
68 ; JUMP1-NEXT: jne .LBB1_1
69 ; JUMP1-NEXT: # %bb.2: # %cond_true
70 ; JUMP1-NEXT: jmp bar # TAILCALL
71 ; JUMP1-NEXT: .LBB1_1: # %UnifiedReturnBlock
74 %tmp1 = icmp eq i32 %X, 0
75 %tmp3 = icmp slt i32 %Y, 5
76 %tmp4 = or i1 %tmp3, %tmp1
77 br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock, !unpredictable !0
80 %tmp5 = tail call i32 (...) @bar( )