1 /* 2 * A contrived example to test the double jump removal peephole. 3 */ 4 5 extern "C" unsigned long bar(unsigned long count) { 6 return count + 1; 7 } 8 9 unsigned long foo(unsigned long count) { 10 asm( 11 " cmpq $1,%0\n" 12 " je .L7\n" 13 " incq %0\n" 14 " jmp .L1\n" 15 ".L1: jmp .L2\n" 16 ".L2: incq %0\n" 17 " cmpq $2,%0\n" 18 " jne .L3\n" 19 " jmp .L4\n" 20 ".L3: jmp .L5\n" 21 ".L5: incq %0\n" 22 ".L4: movq %0,%%rdi\n" 23 " pop %%rbp\n" 24 " jmp .L6\n" 25 ".L7: pop %%rbp\n" 26 " incq %0\n" 27 " jmp .L6\n" 28 ".L6: jmp bar\n" 29 : 30 : "m"(count) 31 ); 32 return count; 33 } 34 35 int main(int argc, const char* argv[]) { 36 return foo(38); 37 } 38