diff options
Diffstat (limited to 'llvm/test/CodeGen/ARM')
-rw-r--r-- | llvm/test/CodeGen/ARM/jump-table-islands-split.ll | 52 | ||||
-rw-r--r-- | llvm/test/CodeGen/ARM/jump-table-islands.ll | 40 | ||||
-rw-r--r-- | llvm/test/CodeGen/ARM/jumptable-label.ll | 4 |
3 files changed, 94 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/ARM/jump-table-islands-split.ll b/llvm/test/CodeGen/ARM/jump-table-islands-split.ll new file mode 100644 index 00000000000..deba21b4dbb --- /dev/null +++ b/llvm/test/CodeGen/ARM/jump-table-islands-split.ll @@ -0,0 +1,52 @@ +; RUN: llc -mtriple=thumbv7s-apple-ios8.0 -o - %s | FileCheck %s + +declare void @foo(double) +declare i32 @llvm.arm.space(i32, i32) + +; The constpool entry used to call @foo should be directly between where we want +; the tbb and its table. Fortunately, the flow is simple enough that we can +; eliminate the entry calculation (ADD) and use the ADR as the base. +; +; I'm hoping this won't be fragile, but if it does break the most likely fix is +; adjusting the @llvm.arm.space call slightly. If this happens too many times +; the test should probably be removed. +define i32 @test_jumptable_not_adjacent(i1 %tst, i32 %sw, i32 %l) { +; CHECK-LABEL: test_jumptable_not_adjacent: +; CHECK: vldr {{d[0-9]+}}, [[DBL_CONST:LCPI[0-9]+_[0-9]+]] +; [...] +; CHECK: adr.w r[[BASE:[0-9]+]], [[JUMP_TABLE:LJTI[0-9]+_[0-9]+]] +; CHECK-NOT: r[[BASE]] + +; CHECK: [[TBB_KEY:LCPI[0-9]+_[0-9]+]]: +; CHECK-NEXT: tbb [r[[BASE]], {{r[0-9]+}}] + +; CHECK: [[DBL_CONST]]: +; CHECK: .long +; CHECK: .long +; CHECK: [[JUMP_TABLE]]: +; CHECK: .byte (LBB{{[0-9]+}}_{{[0-9]+}}-([[TBB_KEY]]+4) + + br label %complex + +complex: + call void @foo(double 12345.0) + call i32 @llvm.arm.space(i32 970, i32 undef) + switch i32 %sw, label %second [ i32 0, label %other + i32 1, label %third + i32 2, label %end + i32 3, label %other ] + +second: + ret i32 43 +third: + ret i32 0 + +other: + call void @bar() + unreachable + +end: + ret i32 42 +} + +declare void @bar() diff --git a/llvm/test/CodeGen/ARM/jump-table-islands.ll b/llvm/test/CodeGen/ARM/jump-table-islands.ll new file mode 100644 index 00000000000..6b4f174c092 --- /dev/null +++ b/llvm/test/CodeGen/ARM/jump-table-islands.ll @@ -0,0 +1,40 @@ +; RUN: llc -mtriple=armv7-apple-ios8.0 -o - %s | FileCheck %s + +%BigInt = type i5500 + +define %BigInt @test_moved_jumptable(i1 %tst, i32 %sw, %BigInt %l) { +; CHECK-LABEL: test_moved_jumptable: + +; CHECK: adr {{r[0-9]+}}, [[JUMP_TABLE:LJTI[0-9]+_[0-9]+]] +; CHECK: b [[SKIP_TABLE:LBB[0-9]+_[0-9]+]] + +; CHECK: [[JUMP_TABLE]]: +; CHECK: .data_region jt32 +; CHECK: .long LBB{{[0-9]+_[0-9]+}}-[[JUMP_TABLE]] + +; CHECK: [[SKIP_TABLE]]: +; CHECK: add pc, {{r[0-9]+}}, {{r[0-9]+}} + br i1 %tst, label %simple, label %complex + +simple: + br label %end + +complex: + switch i32 %sw, label %simple [ i32 0, label %other + i32 1, label %third + i32 5, label %end + i32 6, label %other ] + +third: + ret %BigInt 0 + +other: + call void @bar() + unreachable + +end: + %val = phi %BigInt [ %l, %complex ], [ -1, %simple ] + ret %BigInt %val +} + +declare void @bar() diff --git a/llvm/test/CodeGen/ARM/jumptable-label.ll b/llvm/test/CodeGen/ARM/jumptable-label.ll index 49d698672f8..2ba90dc9736 100644 --- a/llvm/test/CodeGen/ARM/jumptable-label.ll +++ b/llvm/test/CodeGen/ARM/jumptable-label.ll @@ -2,8 +2,8 @@ ; test that we print the label of a bb that is only used in a jump table. -; CHECK: .long LBB0_2 -; CHECK: LBB0_2: +; CHECK: .long [[JUMPTABLE_DEST:LBB[0-9]+_[0-9]+]] +; CHECK: [[JUMPTABLE_DEST]]: define i32 @calculate() { entry: |