ARM: recommit r237590: allow jump tables to be placed as constant islands.
[oota-llvm.git] / test / CodeGen / ARM / jump-table-islands.ll
1 ; RUN: llc -mtriple=armv7-apple-ios8.0 -o - %s | FileCheck %s
2
3 %BigInt = type i5500
4
5 define %BigInt @test_moved_jumptable(i1 %tst, i32 %sw, %BigInt %l) {
6 ; CHECK-LABEL: test_moved_jumptable:
7
8 ; CHECK:   adr {{r[0-9]+}}, [[JUMP_TABLE:LJTI[0-9]+_[0-9]+]]
9 ; CHECK:   b [[SKIP_TABLE:LBB[0-9]+_[0-9]+]]
10
11 ; CHECK: [[JUMP_TABLE]]:
12 ; CHECK:   .data_region jt32
13 ; CHECK:   .long LBB{{[0-9]+_[0-9]+}}-[[JUMP_TABLE]]
14
15 ; CHECK: [[SKIP_TABLE]]:
16 ; CHECK:   add pc, {{r[0-9]+}}, {{r[0-9]+}}
17   br i1 %tst, label %simple, label %complex
18
19 simple:
20   br label %end
21
22 complex:
23   switch i32 %sw, label %simple [ i32 0, label %other
24                                   i32 1, label %third
25                                   i32 5, label %end
26                                   i32 6, label %other ]
27
28 third:
29   ret %BigInt 0
30
31 other:
32   call void @bar()
33   unreachable
34
35 end:
36   %val = phi %BigInt [ %l, %complex ], [ -1, %simple ]
37   ret %BigInt %val
38 }
39
40 declare void @bar()