1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc %s -mtriple=thumbv7-linux-gnueabi -o - | \
3 ; RUN: FileCheck -check-prefix=ELFASM %s
4 ; RUN: llc %s -mtriple=thumbebv7-linux-gnueabi -o - | \
5 ; RUN: FileCheck -check-prefix=ELFASM %s
6 ; RUN: llc %s -mtriple=thumbv7-linux-gnueabi -filetype=obj -o - | \
7 ; RUN: llvm-readobj -S --sd - | FileCheck -check-prefix=ELFOBJ -check-prefix=ELFOBJ-LE %s
8 ; RUN: llc %s -mtriple=thumbebv7-linux-gnueabi -filetype=obj -o - | \
9 ; RUN: llvm-readobj -S --sd - | FileCheck -check-prefix=ELFOBJ -check-prefix=ELFOBJ-BE %s
11 ;; Make sure that bl __aeabi_read_tp is materialized and fixed up correctly
14 @i = external thread_local global i32
15 @a = external global i8
16 @b = external global [10 x i8]
18 define arm_aapcs_vfpcc i32 @main() nounwind {
20 ; ELFASM: @ %bb.0: @ %entry
21 ; ELFASM-NEXT: .save {r7, lr}
22 ; ELFASM-NEXT: push {r7, lr}
23 ; ELFASM-NEXT: ldr r0, .LCPI0_0
24 ; ELFASM-NEXT: .LPC0_0:
25 ; ELFASM-NEXT: add r0, pc
26 ; ELFASM-NEXT: ldr r1, [r0]
27 ; ELFASM-NEXT: bl __aeabi_read_tp
28 ; ELFASM-NEXT: ldr r0, [r0, r1]
29 ; ELFASM-NEXT: cmp r0, #12
30 ; ELFASM-NEXT: beq .LBB0_3
31 ; ELFASM-NEXT: @ %bb.1: @ %entry
32 ; ELFASM-NEXT: cmp r0, #13
34 ; ELFASM-NEXT: movne.w r0, #-1
35 ; ELFASM-NEXT: popne {r7, pc}
36 ; ELFASM-NEXT: .LBB0_2: @ %bb1
37 ; ELFASM-NEXT: movw r0, :lower16:b
38 ; ELFASM-NEXT: movt r0, :upper16:b
39 ; ELFASM-NEXT: pop.w {r7, lr}
41 ; ELFASM-NEXT: .LBB0_3: @ %bb
42 ; ELFASM-NEXT: movw r0, :lower16:a
43 ; ELFASM-NEXT: movt r0, :upper16:a
44 ; ELFASM-NEXT: pop.w {r7, lr}
46 ; ELFASM-NEXT: .p2align 2
47 ; ELFASM-NEXT: @ %bb.4:
48 ; ELFASM-NEXT: .LCPI0_0:
49 ; ELFASM-NEXT: .Ltmp0:
50 ; ELFASM-NEXT: .long i(GOTTPOFF)-((.LPC0_0+4)-.Ltmp0)
52 %0 = load i32, ptr @i, align 4
53 switch i32 %0, label %bb2 [
59 %1 = tail call arm_aapcs_vfpcc i32 @foo(ptr @a) nounwind
66 ; ELFOBJ-LE: SectionData (
67 ;;; BL __aeabi_read_tp is ---+
69 ; ELFOBJ-LE-NEXT: 0000: 80B50E48 78440168 FFF7FEFF 40580C28
70 ; ELFOBJ-BE: SectionData (
71 ;;; BL __aeabi_read_tp is ---+
73 ; ELFOBJ-BE-NEXT: 0000: B580480E 44786801 F7FFFFFE 5840280C
77 %2 = tail call arm_aapcs_vfpcc i32 @bar(ptr @b) nounwind
84 declare arm_aapcs_vfpcc i32 @foo(ptr)
86 declare arm_aapcs_vfpcc i32 @bar(ptr)