repo.or.cz
/
llvm-project.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git]
/
bolt
/
test
/
X86
/
Inputs
/
double_jump.cpp
blob
94b3bcc8f926b8e8da6ee690e4332755abb5db41
1
// A contrived example to test the double jump removal peephole.
2
3
extern
"C"
unsigned long
bar
(
unsigned long
count
) {
4
return
count
+
1
;
5
}
6
7
unsigned long
foo
(
unsigned long
count
) {
8
asm
(
9
" cmpq $1,%0
\n
"
10
" je .L7
\n
"
11
" incq %0
\n
"
12
" jmp .L1
\n
"
13
".L1: jmp .L2
\n
"
14
".L2: incq %0
\n
"
15
" cmpq $2,%0
\n
"
16
" jne .L3
\n
"
17
" jmp .L4
\n
"
18
".L3: jmp .L5
\n
"
19
".L5: incq %0
\n
"
20
".L4: movq %0,%%rdi
\n
"
21
" pop %%rbp
\n
"
22
" jmp .L6
\n
"
23
".L7: pop %%rbp
\n
"
24
" incq %0
\n
"
25
" jmp .L6
\n
"
26
".L6: jmp bar
\n
"
27
:
28
:
"m"
(
count
)
29
);
30
return
count
;
31
}
32
33
int
main
(
int
argc
,
const char
*
argv
[]) {
34
return
foo
(
38
);
35
}