1 ; RUN: llc -mtriple thumbv7--windows-itanium %s -o - | FileCheck %s
3 @i = thread_local global i32 0
4 @j = external thread_local global i32
5 @k = internal thread_local global i32 0
6 @l = hidden thread_local global i32 0
7 @m = external hidden thread_local global i32
8 @n = thread_local global i16 0
9 @o = thread_local global i8 0
12 %1 = load i32, i32* @i
16 ; CHECK: mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
18 ; CHECK: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
19 ; CHECK: movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
20 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
21 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
23 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
25 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
27 ; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
30 ; CHECK-NEXT: .long i(SECREL32)
33 %1 = load i32, i32* @j
37 ; CHECK: mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
39 ; CHECK: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
40 ; CHECK: movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
41 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
42 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
44 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
46 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
48 ; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
51 ; CHECK-NEXT: .long j(SECREL32)
54 %1 = load i32, i32* @k
58 ; CHECK: mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
60 ; CHECK: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
61 ; CHECK: movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
62 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
63 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
65 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
67 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
69 ; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
72 ; CHECK-NEXT: .long k(SECREL32)
75 %1 = load i32, i32* @l
79 ; CHECK: mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
81 ; CHECK: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
82 ; CHECK: movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
83 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
84 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
86 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
88 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
90 ; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
93 ; CHECK-NEXT: .long l(SECREL32)
96 %1 = load i32, i32* @m
100 ; CHECK: mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
102 ; CHECK: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
103 ; CHECK: movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
104 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
105 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
107 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
109 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
111 ; CHECK-NEXT: ldr r0, {{\[}}[[TLS]], [[SLOT]]]
114 ; CHECK: .long m(SECREL32)
117 %1 = load i16, i16* @n
121 ; CHECK: mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
123 ; CHECK: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
124 ; CHECK: movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
125 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
126 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
128 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
130 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
132 ; CHECK-NEXT: ldrh r0, {{\[}}[[TLS]], [[SLOT]]]
135 ; CHECK: .long n(SECREL32)
142 ; CHECK: mrc p15, #0, [[TEB:r[0-9]]], c13, c0, #2
144 ; CHECK: ldr [[TLS_POINTER:r[0-9]]], {{\[}}[[TEB]], #44]
145 ; CHECK: movw [[TLS_INDEX:r[0-9]]], :lower16:_tls_index
146 ; CHECK-NEXT: movt [[TLS_INDEX]], :upper16:_tls_index
147 ; CHECK-NEXT: ldr [[INDEX:r[0-9]]], {{\[}}[[TLS_INDEX]]]
149 ; CHECK-NEXT: ldr{{.w}} [[TLS:r[0-9]]], {{\[}}[[TLS_POINTER]], [[INDEX]], lsl #2]
151 ; CHECK-NEXT: ldr [[SLOT:r[0-9]]], [[CPI:\.LCPI[0-9]+_[0-9]+]]
153 ; CHECK-NEXT: ldrb r0, {{\[}}[[TLS]], [[SLOT]]]
156 ; CHECK-NEXT: .long o(SECREL32)