1 ; RUN: llc -march=hexagon -ifcvt-limit=0 < %s | FileCheck %s
3 ; Check if the branch probabilities are reflected in the instructions:
4 ; The basic block placement pass should place the more probable successor
5 ; block as the fall-through block. The unconditional jump in the predecessor
6 ; should then get the right hint (not_taken or ":nt")
9 @j = external global i32
11 define i32 @foo(i32 %a) nounwind {
12 ; CHECK: if{{ *}}(!p{{[0-3]}}.new) jump:nt
14 %tobool = icmp eq i32 %a, 0
15 br i1 %tobool, label %if.else, label %if.then, !prof !0
17 if.then: ; preds = %entry
18 %add = add nsw i32 %a, 10
19 %call = tail call i32 bitcast (i32 (...)* @foobar to i32 (i32)*)(i32 %add) nounwind
22 if.else: ; preds = %entry
23 %call2 = tail call i32 bitcast (i32 (...)* @foobar to i32 (i32)*)(i32 4) nounwind
26 return: ; preds = %if.else, %if.then
27 %retval.0 = phi i32 [ %call, %if.then ], [ %call2, %if.else ]
31 declare i32 @foobar(...)
33 define i32 @bar(i32 %a) nounwind {
34 ; CHECK: if{{ *}}(p{{[0-3]}}.new) jump:nt
36 %tobool = icmp eq i32 %a, 0
37 br i1 %tobool, label %if.else, label %if.then, !prof !1
39 if.then: ; preds = %entry
40 %add = add nsw i32 %a, 10
41 %call = tail call i32 bitcast (i32 (...)* @foobar to i32 (i32)*)(i32 %add) nounwind
44 if.else: ; preds = %entry
45 %call2 = tail call i32 bitcast (i32 (...)* @foobar to i32 (i32)*)(i32 4) nounwind
48 return: ; preds = %if.else, %if.then
49 %retval.0 = phi i32 [ %call, %if.then ], [ %call2, %if.else ]
53 define i32 @foo_bar(i32 %a, i16 signext %b) nounwind {
54 ; CHECK: if{{ *}}(!cmp.eq(r{{[0-9]*}}.new, #0)) jump:nt
56 %0 = load i32, i32* @j, align 4
57 %tobool = icmp eq i32 %0, 0
58 br i1 %tobool, label %if.else, label %if.then, !prof !0
60 if.then: ; preds = %entry
61 %add = add nsw i32 %a, 10
62 %call = tail call i32 bitcast (i32 (...)* @foobar to i32 (i32)*)(i32 %add) nounwind
65 if.else: ; preds = %entry
66 %add1 = add nsw i32 %a, 4
67 %call2 = tail call i32 bitcast (i32 (...)* @foobar to i32 (i32)*)(i32 %add1) nounwind
70 return: ; preds = %if.else, %if.then
71 %retval.0 = phi i32 [ %call, %if.then ], [ %call2, %if.else ]
75 !0 = !{!"branch_weights", i32 64, i32 4}
76 !1 = !{!"branch_weights", i32 4, i32 64}