Tom Roeder | 44cb65f | 2014-06-05 19:29:43 +0000 | [diff] [blame] | 1 | ; RUN: llc <%s -jump-table-type=single | FileCheck %s |
| 2 | target triple = "x86_64-unknown-linux-gnu" |
| 3 | define i32 @f() unnamed_addr jumptable { |
| 4 | entry: |
| 5 | ret i32 0 |
| 6 | } |
| 7 | |
Rafael Espindola | 464fe02 | 2014-07-30 22:51:54 +0000 | [diff] [blame] | 8 | @i = internal alias i32 ()* @f |
Tom Roeder | 44cb65f | 2014-06-05 19:29:43 +0000 | [diff] [blame] | 9 | @j = alias i32 ()* @f |
| 10 | |
| 11 | define i32 @main(i32 %argc, i8** %argv) { |
| 12 | %temp = alloca i32 ()*, align 8 |
| 13 | store i32 ()* @i, i32()** %temp, align 8 |
| 14 | ; CHECK: movq $__llvm_jump_instr_table_0_1 |
| 15 | %1 = load i32 ()** %temp, align 8 |
| 16 | ; CHECK: movl $__llvm_jump_instr_table_0_1 |
| 17 | %2 = call i32 ()* %1() |
| 18 | %3 = call i32 ()* @i() |
| 19 | ; CHECK: callq i |
| 20 | %4 = call i32 ()* @j() |
| 21 | ; CHECK: callq j |
| 22 | ret i32 %3 |
| 23 | } |
| 24 | |
| 25 | ; There should only be one table, even though there are two GlobalAliases, |
| 26 | ; because they both alias the same value. |
| 27 | |
| 28 | ; CHECK: .globl __llvm_jump_instr_table_0_1 |
| 29 | ; CHECK: .align 8, 0x90 |
| 30 | ; CHECK: .type __llvm_jump_instr_table_0_1,@function |
| 31 | ; CHECK: __llvm_jump_instr_table_0_1: |
| 32 | ; CHECK: jmp f@PLT |
| 33 | |