1; RUN: llc -mtriple=thumb-none-macho -mcpu=arm7tdmi %s -o - | FileCheck %s
2; RUN: llc -mtriple=thumb-none-macho -mcpu=arm7tdmi %s -filetype=obj -o /dev/null
3
4declare void @callee()
5
6define void @test_call() {
7  ; BX can only take a register before v5t came along, so we must materialise
8  ; the address properly.
9; CHECK-LABEL: test_call:
10; CHECK: ldr r[[CALLEE_STUB:[0-9]+]], [[LITPOOL:LCPI[0-9]+_[0-9]+]]
11; CHECK: [[PC_LABEL:LPC[0-9]+_[0-9]+]]:
12; CHECK-NEXT: add r[[CALLEE_STUB]], pc
13; CHECK: ldr [[CALLEE:r[0-9]+]], [r[[CALLEE_STUB]]]
14; CHECK-NOT: mov lr, pc
15; CHECK: bl [[INDIRECT_PAD:Ltmp[0-9]+]]
16
17; CHECK: [[LITPOOL]]:
18; CHECK-NEXT: .long L_callee$non_lazy_ptr-([[PC_LABEL]]+4)
19
20; CHECK: [[INDIRECT_PAD]]:
21; CHECK: bx [[CALLEE]]
22
23  call void @callee()
24  ret void
25}
26