blob: de358d98d49ccef7b6d94ab3863ebc6f6a11b1c3 [file] [log] [blame]
Christian Pirkerc6308f52014-06-24 15:45:59 +00001; RUN: llc %s -mtriple=thumbv7-linux-gnueabi -o - | \
2; RUN: FileCheck -check-prefix=ELFASM %s
3; RUN: llc %s -mtriple=thumbebv7-linux-gnueabi -o - | \
4; RUN: FileCheck -check-prefix=ELFASM %s
5; RUN: llc %s -mtriple=thumbv7-linux-gnueabi -filetype=obj -o - | \
6; RUN: llvm-readobj -s -sd | FileCheck -check-prefix=ELFOBJ -check-prefix=ELFOBJ-LE %s
7; RUN: llc %s -mtriple=thumbebv7-linux-gnueabi -filetype=obj -o - | \
8; RUN: llvm-readobj -s -sd | FileCheck -check-prefix=ELFOBJ -check-prefix=ELFOBJ-BE %s
9
10;; Make sure that bl __aeabi_read_tp is materialized and fixed up correctly
11;; in the obj case.
12
13@i = external thread_local global i32
14@a = external global i8
15@b = external global [10 x i8]
16
17define arm_aapcs_vfpcc i32 @main() nounwind {
18entry:
David Blaikiea79ac142015-02-27 21:17:42 +000019 %0 = load i32, i32* @i, align 4
Christian Pirkerc6308f52014-06-24 15:45:59 +000020 switch i32 %0, label %bb2 [
21 i32 12, label %bb
22 i32 13, label %bb1
23 ]
24
25bb: ; preds = %entry
26 %1 = tail call arm_aapcs_vfpcc i32 @foo(i8* @a) nounwind
27 ret i32 %1
28; ELFASM: bl __aeabi_read_tp
29
30
31; ELFOBJ: Sections [
32; ELFOBJ: Section {
33; ELFOBJ: Name: .text
34; ELFOBJ-LE: SectionData (
Peter Collingbourne78f1ecc2015-04-23 20:31:26 +000035;;; BL __aeabi_read_tp is ---+
36;;; V
37; ELFOBJ-LE-NEXT: 0000: 80B50E48 78440168 FFF7FEFF 40580D28
Christian Pirkerc6308f52014-06-24 15:45:59 +000038; ELFOBJ-BE: SectionData (
Peter Collingbourne78f1ecc2015-04-23 20:31:26 +000039;;; BL __aeabi_read_tp is ---+
40;;; V
41; ELFOBJ-BE-NEXT: 0000: B580480E 44786801 F7FFFFFE 5840280D
Christian Pirkerc6308f52014-06-24 15:45:59 +000042
43
44bb1: ; preds = %entry
45 %2 = tail call arm_aapcs_vfpcc i32 @bar(i32* bitcast ([10 x i8]* @b to i32*)) nounwind
46 ret i32 %2
47
48bb2: ; preds = %entry
49 ret i32 -1
50}
51
52declare arm_aapcs_vfpcc i32 @foo(i8*)
53
54declare arm_aapcs_vfpcc i32 @bar(i32*)