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:    elf-dump --dump-section-data | FileCheck  -check-prefix=ELFOBJ %s
5
6;; Make sure that bl __aeabi_read_tp is materiazlied 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* @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:   '.text'
28; ELFOBJ-NEXT:  'sh_type'
29; ELFOBJ-NEXT:  'sh_flags'
30; ELFOBJ-NEXT:  'sh_addr'
31; ELFOBJ-NEXT:  'sh_offset'
32; ELFOBJ-NEXT:  'sh_size'
33; ELFOBJ-NEXT:  'sh_link'
34; ELFOBJ-NEXT:  'sh_info'
35; ELFOBJ-NEXT:  'sh_addralign'
36; ELFOBJ-NEXT:  'sh_entsize'
37;;;               BL __aeabi_read_tp is ---+
38;;;                                        V
39; ELFOBJ-NEXT:  00482de9 3c009fe5 00109fe7 feffffeb
40
41
42bb1:                                              ; preds = %entry
43  %2 = tail call arm_aapcs_vfpcc  i32 @bar(i32* bitcast ([10 x i8]* @b to i32*)) nounwind
44  ret i32 %2
45
46bb2:                                              ; preds = %entry
47  ret i32 -1
48}
49
50declare arm_aapcs_vfpcc i32 @foo(i8*)
51
52declare arm_aapcs_vfpcc i32 @bar(i32*)
53