branch-hint.ll
2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
; RUN: llc < %s -O1 -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -ppc-use-branch-hint=false | FileCheck %s
; RUN: llc < %s -O1 -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -ppc-use-branch-hint=true | FileCheck %s -check-prefix=CHECK-HINT
define void @branch_hint_1(i32 %src) {
entry:
%cmp = icmp eq i32 %src, 0
br i1 %cmp, label %if.then, label %if.end
if.then:
tail call void @foo() #0
unreachable
if.end:
call void @goo()
ret void
; CHECK-LABEL: branch_hint_1:
; CHECK: beq
; CHECK-HINT-LABEL: branch_hint_1:
; CHECK-HINT: beq-
}
define void @branch_hint_2(i32 %src) {
entry:
%cmp = icmp eq i32 %src, 0
br i1 %cmp, label %if.then, label %if.end
if.then:
call void @goo()
ret void
if.end:
tail call void @foo() #0
unreachable
; CHECK-LABEL: @branch_hint_2
; CHECK: bne
; CHECK-HINT-LABEL: @branch_hint_2
; CHECK-HINT: bne-
}
declare void @foo()
attributes #0 = { noreturn }
define void @branch_hint_3(i32 %src) {
entry:
%cmp = icmp eq i32 %src, 0
br i1 %cmp, label %if.then, label %if.end, !prof !0
if.then:
call void @foo()
ret void
if.end:
call void @goo()
ret void
; CHECK-LABEL: @branch_hint_3
; CHECK: bne
; CHECK-HINT-LABEL: @branch_hint_3
; CHECK-HINT: bne
}
!0 = !{!"branch_weights", i32 64, i32 4}
define void @branch_hint_4(i32 %src) {
entry:
%cmp = icmp eq i32 %src, 0
br i1 %cmp, label %if.then, label %if.end, !prof !1
if.then:
call void @foo()
ret void
if.end:
call void @goo()
ret void
; CHECK-HINT-LABEL: branch_hint_4
; CHECK-HINT: bne
}
!1 = !{!"branch_weights", i32 64, i32 8}
define void @branch_hint_5(i32 %src) {
entry:
%cmp = icmp eq i32 %src, 0
br i1 %cmp, label %if.then, label %if.end
if.then:
ret void
if.end:
call void @goo()
ret void
; CHECK-HINT-LABEL: branch_hint_5:
; CHECK-HINT: beq
}
declare void @goo()
define void @branch_hint_6(i32 %src1, i32 %src2, i32 %src3) {
entry:
%cmp = icmp eq i32 %src1, 0
br i1 %cmp, label %if.end.6, label %if.end, !prof !3
if.end:
%cmp1 = icmp eq i32 %src2, 0
br i1 %cmp1, label %if.end.3, label %if.then.2
if.then.2:
tail call void @foo() #0
unreachable
if.end.3:
%cmp4 = icmp eq i32 %src3, 1
br i1 %cmp4, label %if.then.5, label %if.end.6
if.then.5:
tail call void @foo() #0
unreachable
if.end.6:
ret void
; CHECK-HINT-LABEL: branch_hint_6:
; CHECK-HINT: bne
; CHECK-HINT: bne-
; CHECK-HINT: bne+
}
!3 = !{!"branch_weights", i32 64, i32 4}