1; RUN: llc  %s -mtriple=armv7-linux-gnueabi -o - | \
2; RUN:    FileCheck  -check-prefix=ELFASM %s
3; RUN: llc  %s -mtriple=armv7-linux-gnueabi -filetype=obj -o - | \
4; RUN:    llvm-readobj -s -sd | FileCheck  -check-prefix=ELFOBJ %s
5
6;; Make sure that bl __aeabi_read_tp is materialized and fixed up correctly
7;; in the obj case.
8
9@i = external thread_local global i32
10@a = external global i8
11@b = external global [10 x i8]
12
13define arm_aapcs_vfpcc i32 @main() nounwind {
14entry:
15  %0 = load i32, i32* @i, align 4
16  switch i32 %0, label %bb2 [
17    i32 12, label %bb
18    i32 13, label %bb1
19  ]
20
21bb:                                               ; preds = %entry
22  %1 = tail call arm_aapcs_vfpcc  i32 @foo(i8* @a) nounwind
23  ret i32 %1
24; ELFASM:       	bl	__aeabi_read_tp
25
26
27; ELFOBJ:      Sections [
28; ELFOBJ:        Section {
29; ELFOBJ:          Name: .text
30; ELFOBJ:          SectionData (
31;;;                  BL __aeabi_read_tp is ---------+
32;;;                                                 V
33; ELFOBJ-NEXT:     0000: 00482DE9 3C009FE5 00109FE7 FEFFFFEB
34
35
36bb1:                                              ; preds = %entry
37  %2 = tail call arm_aapcs_vfpcc  i32 @bar(i32* bitcast ([10 x i8]* @b to i32*)) nounwind
38  ret i32 %2
39
40bb2:                                              ; preds = %entry
41  ret i32 -1
42}
43
44declare arm_aapcs_vfpcc i32 @foo(i8*)
45
46declare arm_aapcs_vfpcc i32 @bar(i32*)
47