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