Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / X86 / Inputs / double_jump.cpp
blob94b3bcc8f926b8e8da6ee690e4332755abb5db41
1 // A contrived example to test the double jump removal peephole.
3 extern "C" unsigned long bar(unsigned long count) {
4 return count + 1;
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"
28 : "m"(count)
30 return count;
33 int main(int argc, const char* argv[]) {
34 return foo(38);