symbol_relocation_tls.ll
6.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
; FIXME: Even under non-pic mode, llvm for ve needs to generate pic code since
; nld doesn't work with non-pic code. Thefore, we test only pic codes
; for both cases here.
; llc -filetype=obj -mtriple=ve -o - %s | llvm-objdump - -d -r \
; | FileCheck %s -check-prefix=LOCAL
; RUN: llc -filetype=obj -mtriple=ve -o - %s | llvm-objdump - -d -r \
; RUN: | FileCheck %s -check-prefix=GENDYN
; RUN: llc -filetype=obj -mtriple=ve -relocation-model=pic -o - %s \
; RUN: | llvm-objdump - -d -r | FileCheck %s -check-prefix=GENDYNPIC
@x = external thread_local global i32, align 4
@y = internal thread_local global i32 0, align 4
; Function Attrs: norecurse nounwind readnone
define nonnull i32* @get_global() {
; GENDYN: lea %s0, (-24)
; GENDYN-NEXT: R_VE_TLS_GD_LO32 x
; GENDYN-NEXT: and %s0, %s0, (32)0
; GENDYN-NEXT: sic %s10
; GENDYN-NEXT: lea.sl %s0, (%s10, %s0)
; GENDYN-NEXT: R_VE_TLS_GD_HI32 x
; GENDYN-NEXT: lea %s12, (8)
; GENDYN-NEXT: R_VE_PLT_LO32 __tls_get_addr
; GENDYN-NEXT: and %s12, %s12, (32)0
; GENDYN-NEXT: lea.sl %s12, (%s10, %s12)
; GENDYN-NEXT: R_VE_PLT_HI32 __tls_get_addr
; GENDYN-NEXT: bsic %s10, (, %s12)
; GENDYN-NEXT: or %s11, 0, %s9
;
; GENDYNPIC: lea %s15, (-24)
; GENDYNPIC-NEXT: R_VE_PC_LO32 _GLOBAL_OFFSET_TABLE_
; GENDYNPIC-NEXT: and %s15, %s15, (32)0
; GENDYNPIC-NEXT: sic %s16
; GENDYNPIC-NEXT: lea.sl %s15, (%s16, %s15)
; GENDYNPIC-NEXT: R_VE_PC_HI32 _GLOBAL_OFFSET_TABLE_
; GENDYNPIC-NEXT: lea %s0, (-24)
; GENDYNPIC-NEXT: R_VE_TLS_GD_LO32 x
; GENDYNPIC-NEXT: and %s0, %s0, (32)0
; GENDYNPIC-NEXT: sic %s10
; GENDYNPIC-NEXT: lea.sl %s0, (%s10, %s0)
; GENDYNPIC-NEXT: R_VE_TLS_GD_HI32 x
; GENDYNPIC-NEXT: lea %s12, (8)
; GENDYNPIC-NEXT: R_VE_PLT_LO32 __tls_get_addr
; GENDYNPIC-NEXT: and %s12, %s12, (32)0
; GENDYNPIC-NEXT: lea.sl %s12, (%s10, %s12)
; GENDYNPIC-NEXT: R_VE_PLT_HI32 __tls_get_addr
; GENDYNPIC-NEXT: bsic %s10, (, %s12)
; GENDYNPIC-NEXT: or %s11, 0, %s9
entry:
ret i32* @x
}
; Function Attrs: norecurse nounwind readnone
define nonnull i32* @get_local() {
; GENDYN: lea %s0, (-24)
; GENDYN-NEXT: R_VE_TLS_GD_LO32 y
; GENDYN-NEXT: and %s0, %s0, (32)0
; GENDYN-NEXT: sic %s10
; GENDYN-NEXT: lea.sl %s0, (%s10, %s0)
; GENDYN-NEXT: R_VE_TLS_GD_HI32 y
; GENDYN-NEXT: lea %s12, (8)
; GENDYN-NEXT: R_VE_PLT_LO32 __tls_get_addr
; GENDYN-NEXT: and %s12, %s12, (32)0
; GENDYN-NEXT: lea.sl %s12, (%s10, %s12)
; GENDYN-NEXT: R_VE_PLT_HI32 __tls_get_addr
; GENDYN-NEXT: bsic %s10, (, %s12)
; GENDYN-NEXT: or %s11, 0, %s9
;
; GENDYNPIC: lea %s15, (-24)
; GENDYNPIC-NEXT: R_VE_PC_LO32 _GLOBAL_OFFSET_TABLE_
; GENDYNPIC-NEXT: and %s15, %s15, (32)0
; GENDYNPIC-NEXT: sic %s16
; GENDYNPIC-NEXT: lea.sl %s15, (%s16, %s15)
; GENDYNPIC-NEXT: R_VE_PC_HI32 _GLOBAL_OFFSET_TABLE_
; GENDYNPIC-NEXT: lea %s0, (-24)
; GENDYNPIC-NEXT: R_VE_TLS_GD_LO32 y
; GENDYNPIC-NEXT: and %s0, %s0, (32)0
; GENDYNPIC-NEXT: sic %s10
; GENDYNPIC-NEXT: lea.sl %s0, (%s10, %s0)
; GENDYNPIC-NEXT: R_VE_TLS_GD_HI32 y
; GENDYNPIC-NEXT: lea %s12, (8)
; GENDYNPIC-NEXT: R_VE_PLT_LO32 __tls_get_addr
; GENDYNPIC-NEXT: and %s12, %s12, (32)0
; GENDYNPIC-NEXT: lea.sl %s12, (%s10, %s12)
; GENDYNPIC-NEXT: R_VE_PLT_HI32 __tls_get_addr
; GENDYNPIC-NEXT: bsic %s10, (, %s12)
; GENDYNPIC-NEXT: or %s11, 0, %s9
entry:
ret i32* @y
}
; Function Attrs: norecurse nounwind
define void @set_global(i32 %v) {
; GENDYN: lea %s0, (-24)
; GENDYN-NEXT: R_VE_TLS_GD_LO32 x
; GENDYN-NEXT: and %s0, %s0, (32)0
; GENDYN-NEXT: sic %s10
; GENDYN-NEXT: lea.sl %s0, (%s10, %s0)
; GENDYN-NEXT: R_VE_TLS_GD_HI32 x
; GENDYN-NEXT: lea %s12, (8)
; GENDYN-NEXT: R_VE_PLT_LO32 __tls_get_addr
; GENDYN-NEXT: and %s12, %s12, (32)0
; GENDYN-NEXT: lea.sl %s12, (%s10, %s12)
; GENDYN-NEXT: R_VE_PLT_HI32 __tls_get_addr
; GENDYN-NEXT: bsic %s10, (, %s12)
; GENDYN-NEXT: stl %s18, (, %s0)
; GENDYN-NEXT: ld %s18, 48(, %s9)
; GENDYN-NEXT: or %s11, 0, %s9
;
; GENDYNPIC: lea %s15, (-24)
; GENDYNPIC-NEXT: R_VE_PC_LO32 _GLOBAL_OFFSET_TABLE_
; GENDYNPIC-NEXT: and %s15, %s15, (32)0
; GENDYNPIC-NEXT: sic %s16
; GENDYNPIC-NEXT: lea.sl %s15, (%s16, %s15)
; GENDYNPIC-NEXT: R_VE_PC_HI32 _GLOBAL_OFFSET_TABLE_
; GENDYNPIC-NEXT: lea %s0, (-24)
; GENDYNPIC-NEXT: R_VE_TLS_GD_LO32 x
; GENDYNPIC-NEXT: and %s0, %s0, (32)0
; GENDYNPIC-NEXT: sic %s10
; GENDYNPIC-NEXT: lea.sl %s0, (%s10, %s0)
; GENDYNPIC-NEXT: R_VE_TLS_GD_HI32 x
; GENDYNPIC-NEXT: lea %s12, (8)
; GENDYNPIC-NEXT: R_VE_PLT_LO32 __tls_get_addr
; GENDYNPIC-NEXT: and %s12, %s12, (32)0
; GENDYNPIC-NEXT: lea.sl %s12, (%s10, %s12)
; GENDYNPIC-NEXT: R_VE_PLT_HI32 __tls_get_addr
; GENDYNPIC-NEXT: bsic %s10, (, %s12)
; GENDYNPIC-NEXT: stl %s18, (, %s0)
; GENDYNPIC-NEXT: ld %s18, 48(, %s9)
; GENDYNPIC-NEXT: or %s11, 0, %s9
entry:
store i32 %v, i32* @x, align 4
ret void
}
; Function Attrs: norecurse nounwind
define void @set_local(i32 %v) {
; GENDYN: lea %s0, (-24)
; GENDYN-NEXT: R_VE_TLS_GD_LO32 y
; GENDYN-NEXT: and %s0, %s0, (32)0
; GENDYN-NEXT: sic %s10
; GENDYN-NEXT: lea.sl %s0, (%s10, %s0)
; GENDYN-NEXT: R_VE_TLS_GD_HI32 y
; GENDYN-NEXT: lea %s12, (8)
; GENDYN-NEXT: R_VE_PLT_LO32 __tls_get_addr
; GENDYN-NEXT: and %s12, %s12, (32)0
; GENDYN-NEXT: lea.sl %s12, (%s10, %s12)
; GENDYN-NEXT: R_VE_PLT_HI32 __tls_get_addr
; GENDYN-NEXT: bsic %s10, (, %s12)
; GENDYN-NEXT: stl %s18, (, %s0)
; GENDYN-NEXT: ld %s18, 48(, %s9)
; GENDYN-NEXT: or %s11, 0, %s9
;
; GENDYNPIC: lea %s15, (-24)
; GENDYNPIC-NEXT: R_VE_PC_LO32 _GLOBAL_OFFSET_TABLE_
; GENDYNPIC-NEXT: and %s15, %s15, (32)0
; GENDYNPIC-NEXT: sic %s16
; GENDYNPIC-NEXT: lea.sl %s15, (%s16, %s15)
; GENDYNPIC-NEXT: R_VE_PC_HI32 _GLOBAL_OFFSET_TABLE_
; GENDYNPIC-NEXT: lea %s0, (-24)
; GENDYNPIC-NEXT: R_VE_TLS_GD_LO32 y
; GENDYNPIC-NEXT: and %s0, %s0, (32)0
; GENDYNPIC-NEXT: sic %s10
; GENDYNPIC-NEXT: lea.sl %s0, (%s10, %s0)
; GENDYNPIC-NEXT: R_VE_TLS_GD_HI32 y
; GENDYNPIC-NEXT: lea %s12, (8)
; GENDYNPIC-NEXT: R_VE_PLT_LO32 __tls_get_addr
; GENDYNPIC-NEXT: and %s12, %s12, (32)0
; GENDYNPIC-NEXT: lea.sl %s12, (%s10, %s12)
; GENDYNPIC-NEXT: R_VE_PLT_HI32 __tls_get_addr
; GENDYNPIC-NEXT: bsic %s10, (, %s12)
; GENDYNPIC-NEXT: stl %s18, (, %s0)
; GENDYNPIC-NEXT: ld %s18, 48(, %s9)
; GENDYNPIC-NEXT: or %s11, 0, %s9
entry:
store i32 %v, i32* @y, align 4
ret void
}