source: icGREP/icgrep-devel/llvm-3.8.0.src/test/CodeGen/ARM/jump-table-islands-split.ll @ 5027

Last change on this file since 5027 was 5027, checked in by cameron, 3 years ago

Upgrade to llvm 3.8

File size: 1.5 KB
Line 
1; RUN: llc -mtriple=thumbv7s-apple-ios8.0 -o - %s | FileCheck %s
2
3declare void @foo(double)
4declare i32 @llvm.arm.space(i32, i32)
5
6; The constpool entry used to call @foo should be directly between where we want
7; the tbb and its table. Fortunately, the flow is simple enough that we can
8; eliminate the entry calculation (ADD) and use the ADR as the base.
9;
10; I'm hoping this won't be fragile, but if it does break the most likely fix is
11; adjusting the @llvm.arm.space call slightly. If this happens too many times
12; the test should probably be removed.
13define i32 @test_jumptable_not_adjacent(i1 %tst, i32 %sw, i32 %l) {
14; CHECK-LABEL: test_jumptable_not_adjacent:
15; CHECK:     vldr {{d[0-9]+}}, [[DBL_CONST:LCPI[0-9]+_[0-9]+]]
16; [...]
17; CHECK:     adr.w r[[BASE:[0-9]+]], [[JUMP_TABLE:LJTI[0-9]+_[0-9]+]]
18; CHECK-NOT: r[[BASE]]
19
20; CHECK: [[TBB_KEY:LCPI[0-9]+_[0-9]+]]:
21; CHECK-NEXT:     tbb [r[[BASE]], {{r[0-9]+}}]
22
23; CHECK: [[DBL_CONST]]:
24; CHECK:     .long
25; CHECK:     .long
26; CHECK: [[JUMP_TABLE]]:
27; CHECK:     .byte (LBB{{[0-9]+}}_{{[0-9]+}}-([[TBB_KEY]]+4)
28
29  br label %complex
30
31complex:
32  call void @foo(double 12345.0)
33  call i32 @llvm.arm.space(i32 970, i32 undef)
34  switch i32 %sw, label %second [ i32 0, label %other
35                                  i32 1, label %third
36                                  i32 2, label %end
37                                  i32 3, label %other ]
38
39second:
40  ret i32 43
41third:
42  ret i32 0
43
44other:
45  call void @bar()
46  unreachable
47
48end:
49  ret i32 42
50}
51
52declare void @bar()
Note: See TracBrowser for help on using the repository browser.