53 lines · plain
1# Test case with a simple PIC-style jump table where the register containing2# the jump table address is defined outside of the basic block containing the3# jump on register.4#5# One of the destinations of the jump table points past the end of the function6# similar to the code generated for __builtin_unreachable().7 8 .text9 .globl main10 .type main, @function11main:12 .cfi_startproc13 pushq %rbx14 .cfi_def_cfa_offset 1615 .cfi_offset 3, -1616 leaq .LJUMPTABLE(%rip), %rcx17.L13:18 cmpl $3, %edi19 ja .L220 21 movslq (%rcx,%rdi,4), %rax22 addq %rcx, %rax23 jmp *%rax24 25.L12:26 movq %rdi, %rax27 popq %rbx28 .cfi_remember_state29 .cfi_def_cfa_offset 830 ret31 32.L5:33 .cfi_restore_state34 addq $9, %rdi35 jmp .L1236.L6:37 addq $8, %rdi38 jmp .L1239.L2:40 addq $2, %rdi41 jmp .L1242.LUNREACHABLE:43 .cfi_endproc44 .size main, .-main45 46 .section .rodata47 .align 448.LJUMPTABLE:49 .long .L2-.LJUMPTABLE50 .long .L6-.LJUMPTABLE51 .long .L5-.LJUMPTABLE52 .long .LUNREACHABLE-.LJUMPTABLE53