Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / bolt / test / X86 / Inputs / jump-table-pic.s
blobfcc94cbb370a01cdf36fd1d8f4d1db30507755d7
1 # Test case with a simple PIC-style jump table where the register containing
2 # the jump table address is defined outside of the basic block containing the
3 # jump on register.
5 # One of the destinations of the jump table points past the end of the function
6 # similar to the code generated for __builtin_unreachable().
8 .text
9 .globl main
10 .type main, @function
11 main:
12 .cfi_startproc
13 pushq %rbx
14 .cfi_def_cfa_offset 16
15 .cfi_offset 3, -16
16 leaq .LJUMPTABLE(%rip), %rcx
17 .L13:
18 cmpl $3, %edi
19 ja .L2
21 movslq (%rcx,%rdi,4), %rax
22 addq %rcx, %rax
23 jmp *%rax
25 .L12:
26 movq %rdi, %rax
27 popq %rbx
28 .cfi_remember_state
29 .cfi_def_cfa_offset 8
30 ret
32 .L5:
33 .cfi_restore_state
34 addq $9, %rdi
35 jmp .L12
36 .L6:
37 addq $8, %rdi
38 jmp .L12
39 .L2:
40 addq $2, %rdi
41 jmp .L12
42 .LUNREACHABLE:
43 .cfi_endproc
44 .size main, .-main
46 .section .rodata
47 .align 4
48 .LJUMPTABLE:
49 .long .L2-.LJUMPTABLE
50 .long .L6-.LJUMPTABLE
51 .long .L5-.LJUMPTABLE
52 .long .LUNREACHABLE-.LJUMPTABLE