[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / ppc64-tls-ie.s
blob8855e8c01239907784dae97ce4f3329865cc3901
1 # REQUIRES: ppc
3 # RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
4 # RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=INPUT-REL %s
5 ## IE
6 # RUN: ld.lld -shared %t.o -o %t.so
7 # RUN: llvm-readobj -d -r %t.so | FileCheck --check-prefix=IE-REL %s
8 # RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=IE %s
9 ## IE -> LE
10 # RUN: ld.lld %t.o -o %t
11 # RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s
12 # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
14 # RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o
15 # RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=INPUT-REL %s
16 ## IE
17 # RUN: ld.lld -shared %t.o -o %t.so
18 # RUN: llvm-readobj -d -r %t.so | FileCheck --check-prefix=IE-REL %s
19 # RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=IE %s
20 ## IE -> LE
21 # RUN: ld.lld %t.o -o %t
22 # RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s
23 # RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
25 # IE-REL: FLAGS STATIC_TLS
26 # IE-REL: .rela.dyn {
27 # IE-REL-NEXT: 0x205A8 R_PPC64_TPREL64 c 0x0
28 # IE-REL-NEXT: 0x205B0 R_PPC64_TPREL64 s 0x0
29 # IE-REL-NEXT: 0x205B8 R_PPC64_TPREL64 i 0x0
30 # IE-REL-NEXT: 0x205C0 R_PPC64_TPREL64 l 0x0
31 # IE-REL-NEXT: 0x205C8 R_PPC64_TPREL64 f 0x0
32 # IE-REL-NEXT: 0x205D0 R_PPC64_TPREL64 d 0x0
33 # IE-REL-NEXT: }
35 # INPUT-REL: R_PPC64_GOT_TPREL16_HA c 0x0
36 # INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS c 0x0
37 # INPUT-REL: R_PPC64_TLS c 0x0
38 ## &.got[1] - .TOC. = -32760
39 # IE-LABEL: <test1>:
40 # IE-NEXT: addis 3, 2, 0
41 # IE-NEXT: ld 3, -32760(3)
42 # IE-NEXT: lbzx 3, 3, 13
43 # LE-LABEL: <test1>:
44 # LE-NEXT: nop
45 # LE-NEXT: addis 3, 13, 0
46 # LE-NEXT: lbz 3, -28672(3)
47 test1:
48 addis 3, 2, c@got@tprel@ha
49 ld 3, c@got@tprel@l(3)
50 lbzx 3, 3, c@tls
52 # INPUT-REL: R_PPC64_GOT_TPREL16_HA s 0x0
53 # INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS s 0x0
54 # INPUT-REL: R_PPC64_TLS s 0x0
55 ## &.got[2] - .TOC. = -32752
56 # IE-LABEL: <test2>:
57 # IE-NEXT: addis 3, 2, 0
58 # IE-NEXT: ld 3, -32752(3)
59 # IE-NEXT: lhzx 3, 3, 13
60 # LE-LABEL: <test2>:
61 # LE-NEXT: nop
62 # LE-NEXT: addis 3, 13, 0
63 # LE-NEXT: lhz 3, -28670(3)
64 test2:
65 addis 3, 2, s@got@tprel@ha
66 ld 3, s@got@tprel@l(3)
67 lhzx 3, 3, s@tls
69 # INPUT-REL: R_PPC64_GOT_TPREL16_HA i 0x0
70 # INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS i 0x0
71 # INPUT-REL: R_PPC64_TLS i 0x0
72 ## &.got[3] - .TOC. = -32744
73 # IE-LABEL: <test3>:
74 # IE-NEXT: addis 3, 2, 0
75 # IE-NEXT: ld 3, -32744(3)
76 # IE-NEXT: lwzx 3, 3, 13
77 # LE-LABEL: <test3>:
78 # LE-NEXT: nop
79 # LE-NEXT: addis 3, 13, 0
80 # LE-NEXT: lwz 3, -28668(3)
81 test3:
82 addis 3, 2, i@got@tprel@ha
83 ld 3, i@got@tprel@l(3)
84 lwzx 3, 3, i@tls
86 # INPUT-REL: R_PPC64_GOT_TPREL16_HA l 0x0
87 # INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS l 0x0
88 # INPUT-REL: R_PPC64_TLS l 0x0
89 ## &.got[4] - .TOC. = -32736
90 # IE-LABEL: <test4>:
91 # IE-NEXT: addis 3, 2, 0
92 # IE-NEXT: ld 3, -32736(3)
93 # IE-NEXT: ldx 3, 3, 13
94 # LE-LABEL: <test4>:
95 # LE-NEXT: nop
96 # LE-NEXT: addis 3, 13, 0
97 # LE-NEXT: ld 3, -28664(3)
98 test4:
99 addis 3, 2, l@got@tprel@ha
100 ld 3, l@got@tprel@l(3)
101 ldx 3, 3, l@tls
103 # LE-LABEL: <test5>:
104 # LE-NEXT: nop
105 # LE-NEXT: addis 4, 13, 0
106 # LE-NEXT: stb 3, -28672(4)
107 test5:
108 addis 4, 2, c@got@tprel@ha
109 ld 4, c@got@tprel@l(4)
110 stbx 3, 4, c@tls
113 # LE-LABEL: <test6>:
114 # LE-NEXT: nop
115 # LE-NEXT: addis 4, 13, 0
116 # LE-NEXT: sth 3, -28670(4)
117 test6:
118 addis 4, 2, s@got@tprel@ha
119 ld 4, s@got@tprel@l(4)
120 sthx 3, 4, s@tls
123 # LE-LABEL: <test7>:
124 # LE-NEXT: nop
125 # LE-NEXT: addis 4, 13, 0
126 # LE-NEXT: stw 3, -28668(4)
127 test7:
128 addis 4, 2, i@got@tprel@ha
129 ld 4, i@got@tprel@l(4)
130 stwx 3, 4, i@tls
132 # LE-LABEL: <test8>:
133 # LE-NEXT: nop
134 # LE-NEXT: addis 4, 13, 0
135 # LE-NEXT: std 3, -28664(4)
136 test8:
137 addis 4, 2, l@got@tprel@ha
138 ld 4, l@got@tprel@l(4)
139 stdx 3, 4, l@tls
141 # LE-LABEL: <test9>:
142 # LE-NEXT: nop
143 # LE-NEXT: addis 3, 13, 0
144 # LE-NEXT: addi 3, 3, -28668
145 test9:
146 addis 3, 2, i@got@tprel@ha
147 ld 3, i@got@tprel@l(3)
148 add 3, 3, i@tls
150 # LE-LABEL: <test_ds>:
151 # LE-NEXT: addis 4, 13, 0
152 # LE-NEXT: std 3, -28664(4)
153 test_ds:
154 ld 4, l@got@tprel(2)
155 stdx 3, 4, l@tls
157 # LE-LABEL: <test_lhax>:
158 # LE-NEXT: nop
159 # LE-NEXT: addis 3, 13, 0
160 # LE-NEXT: lha 3, -28670(3)
161 test_lhax:
162 addis 3, 2, s@got@tprel@ha
163 ld 3, s@got@tprel@l(3)
164 lhax 3, 3, s@tls
166 # LE-LABEL: <test_lwax>:
167 # LE-NEXT: nop
168 # LE-NEXT: addis 3, 13, 0
169 # LE-NEXT: lwa 3, -28668(3)
170 test_lwax:
171 addis 3, 2, i@got@tprel@ha
172 ld 3, i@got@tprel@l(3)
173 lwax 3, 3, i@tls
175 # LE-LABEL: <test_lfsx>:
176 # LE-NEXT: nop
177 # LE-NEXT: addis 3, 13, 0
178 # LE-NEXT: lfs 3, -28656(3)
179 test_lfsx:
180 addis 3, 2, f@got@tprel@ha
181 ld 3, f@got@tprel@l(3)
182 lfsx 3, 3, f@tls
184 # LE-LABEL: <test_lfdx>:
185 # LE-NEXT: nop
186 # LE-NEXT: addis 3, 13, 0
187 # LE-NEXT: lfd 3, -28648(3)
188 test_lfdx:
189 addis 3, 2, d@got@tprel@ha
190 ld 3, d@got@tprel@l(3)
191 lfdx 3, 3, d@tls
193 # LE-LABEL: <test_stfsx>:
194 # LE-NEXT: nop
195 # LE-NEXT: addis 4, 13, 0
196 # LE-NEXT: stfs 3, -28656(4)
197 test_stfsx:
198 addis 4, 2, f@got@tprel@ha
199 ld 4, f@got@tprel@l(4)
200 stfsx 3, 4, f@tls
202 # LE-LABEL: <test_stfdx>:
203 # LE-NEXT: nop
204 # LE-NEXT: addis 4, 13, 0
205 # LE-NEXT: stfd 3, -28648(4)
206 test_stfdx:
207 addis 4, 2, d@got@tprel@ha
208 ld 4, d@got@tprel@l(4)
209 stfdx 3, 4, d@tls
211 # NOREL: There are no relocations in this file.
213 .section .tdata,"awT",@progbits
214 .globl c, s, i, l, f, d
216 .byte 97
218 .p2align 1
220 .short 55
222 .p2align 2
224 .long 55
226 .p2align 3
228 .quad 55
230 .long 55
232 .p2align 3
234 .quad 55