[PowerPC] Generate little-endian object files
[oota-llvm.git] / test / MC / PowerPC / ppc64-fixups.s
1
2 # RUN: llvm-mc -triple powerpc64-unknown-unknown --show-encoding %s | FileCheck -check-prefix=CHECK-BE %s
3 # RUN: llvm-mc -triple powerpc64le-unknown-unknown --show-encoding %s | FileCheck -check-prefix=CHECK-LE %s
4
5 # RUN: llvm-mc -triple powerpc64-unknown-unknown -filetype=obj %s | \
6 # RUN: llvm-readobj -r | FileCheck %s -check-prefix=CHECK-BE-REL
7 # RUN: llvm-mc -triple powerpc64le-unknown-unknown -filetype=obj %s | \
8 # RUN: llvm-readobj -r | FileCheck %s -check-prefix=CHECK-LE-REL
9
10 # CHECK-BE: b target                        # encoding: [0b010010AA,A,A,0bAAAAAA00]
11 # CHECK-LE: b target                        # encoding: [0bAAAAAA00,A,A,0b010010AA]
12 # CHECK-BE-NEXT:                            #   fixup A - offset: 0, value: target, kind: fixup_ppc_br24
13 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target, kind: fixup_ppc_br24
14 # CHECK-BE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_REL24 target 0x0
15 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_REL24 target 0x0
16             b target
17
18 # CHECK-BE: ba target                       # encoding: [0b010010AA,A,A,0bAAAAAA10]
19 # CHECK-LE: ba target                       # encoding: [0bAAAAAA10,A,A,0b010010AA]
20 # CHECK-BE-NEXT:                            #   fixup A - offset: 0, value: target, kind: fixup_ppc_br24abs
21 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target, kind: fixup_ppc_br24abs
22 # CHECK-BE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR24 target 0x0
23 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR24 target 0x0
24             ba target
25
26 # CHECK-BE: beq 0, target                   # encoding: [0x41,0x82,A,0bAAAAAA00]
27 # CHECK-LE: beq 0, target                   # encoding: [0bAAAAAA00,A,0x82,0x41]
28 # CHECK-BE-NEXT:                            #   fixup A - offset: 0, value: target, kind: fixup_ppc_brcond14
29 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target, kind: fixup_ppc_brcond14
30 # CHECK-BE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_REL14 target 0x0
31 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_REL14 target 0x0
32             beq target
33
34 # CHECK-BE: beqa 0, target                  # encoding: [0x41,0x82,A,0bAAAAAA10]
35 # CHECK-LE: beqa 0, target                  # encoding: [0bAAAAAA10,A,0x82,0x41]
36 # CHECK-BE-NEXT:                            #   fixup A - offset: 0, value: target, kind: fixup_ppc_brcond14abs
37 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target, kind: fixup_ppc_brcond14abs
38 # CHECK-BE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR14 target 0x0
39 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR14 target 0x0
40             beqa target
41
42
43 # CHECK-BE: li 3, target@l                  # encoding: [0x38,0x60,A,A]
44 # CHECK-LE: li 3, target@l                  # encoding: [A,A,0x60,0x38]
45 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@l, kind: fixup_ppc_half16
46 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@l, kind: fixup_ppc_half16
47 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_LO target 0x0
48 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_LO target 0x0
49             li 3, target@l
50
51 # CHECK-BE: addis 3, 3, target@ha           # encoding: [0x3c,0x63,A,A]
52 # CHECK-LE: addis 3, 3, target@ha           # encoding: [A,A,0x63,0x3c]
53 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@ha, kind: fixup_ppc_half16
54 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@ha, kind: fixup_ppc_half16
55 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_HA target 0x0
56 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_HA target 0x0
57             addis 3, 3, target@ha
58
59 # CHECK-BE: lis 3, target@ha                # encoding: [0x3c,0x60,A,A]
60 # CHECK-LE: lis 3, target@ha                # encoding: [A,A,0x60,0x3c]
61 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@ha, kind: fixup_ppc_half16
62 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@ha, kind: fixup_ppc_half16
63 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_HA target 0x0
64 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_HA target 0x0
65             lis 3, target@ha
66
67 # CHECK-BE: addi 4, 3, target@l             # encoding: [0x38,0x83,A,A]
68 # CHECK-LE: addi 4, 3, target@l             # encoding: [A,A,0x83,0x38]
69 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@l, kind: fixup_ppc_half16
70 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@l, kind: fixup_ppc_half16
71 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_LO target 0x0
72 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_LO target 0x0
73             addi 4, 3, target@l
74
75 # CHECK-BE: li 3, target@ha                 # encoding: [0x38,0x60,A,A]
76 # CHECK-LE: li 3, target@ha                 # encoding: [A,A,0x60,0x38]
77 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@ha, kind: fixup_ppc_half16
78 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@ha, kind: fixup_ppc_half16
79 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_HA target 0x0
80 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_HA target 0x0
81             li 3, target@ha
82
83 # CHECK-BE: lis 3, target@l                 # encoding: [0x3c,0x60,A,A]
84 # CHECK-LE: lis 3, target@l                 # encoding: [A,A,0x60,0x3c]
85 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@l, kind: fixup_ppc_half16
86 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@l, kind: fixup_ppc_half16
87 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_LO target 0x0
88 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_LO target 0x0
89             lis 3, target@l
90
91 # CHECK-BE: li 3, target@h                  # encoding: [0x38,0x60,A,A]
92 # CHECK-LE: li 3, target@h                  # encoding: [A,A,0x60,0x38]
93 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@h, kind: fixup_ppc_half16
94 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@h, kind: fixup_ppc_half16
95 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_HI target 0x0
96 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_HI target 0x0
97             li 3, target@h
98
99 # CHECK-BE: lis 3, target@h                  # encoding: [0x3c,0x60,A,A]
100 # CHECK-LE: lis 3, target@h                  # encoding: [A,A,0x60,0x3c]
101 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@h, kind: fixup_ppc_half16
102 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@h, kind: fixup_ppc_half16
103 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_HI target 0x0
104 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_HI target 0x0
105             lis 3, target@h
106
107 # CHECK-BE: li 3, target@higher             # encoding: [0x38,0x60,A,A]
108 # CHECK-LE: li 3, target@higher             # encoding: [A,A,0x60,0x38]
109 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@higher, kind: fixup_ppc_half16
110 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@higher, kind: fixup_ppc_half16
111 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_HIGHER target 0x0
112 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_HIGHER target 0x0
113             li 3, target@higher
114
115 # CHECK-BE: lis 3, target@highest           # encoding: [0x3c,0x60,A,A]
116 # CHECK-LE: lis 3, target@highest           # encoding: [A,A,0x60,0x3c]
117 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@highest, kind: fixup_ppc_half16
118 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@highest, kind: fixup_ppc_half16
119 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_HIGHEST target 0x0
120 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_HIGHEST target 0x0
121             lis 3, target@highest
122
123 # CHECK-BE: li 3, target@highera            # encoding: [0x38,0x60,A,A]
124 # CHECK-LE: li 3, target@highera            # encoding: [A,A,0x60,0x38]
125 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@highera, kind: fixup_ppc_half16
126 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@highera, kind: fixup_ppc_half16
127 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_HIGHERA target 0x0
128 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_HIGHERA target 0x0
129             li 3, target@highera
130
131 # CHECK-BE: lis 3, target@highesta          # encoding: [0x3c,0x60,A,A]
132 # CHECK-LE: lis 3, target@highesta          # encoding: [A,A,0x60,0x3c]
133 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@highesta, kind: fixup_ppc_half16
134 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@highesta, kind: fixup_ppc_half16
135 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_HIGHESTA target 0x0
136 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_HIGHESTA target 0x0
137             lis 3, target@highesta
138
139 # CHECK-BE: lwz 1, target@l(3)              # encoding: [0x80,0x23,A,A]
140 # CHECK-LE: lwz 1, target@l(3)              # encoding: [A,A,0x23,0x80]
141 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@l, kind: fixup_ppc_half16
142 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@l, kind: fixup_ppc_half16
143 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_LO target 0x0
144 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_LO target 0x0
145             lwz 1, target@l(3)
146
147 # CHECK-BE: lwz 1, target(3)                # encoding: [0x80,0x23,A,A]
148 # CHECK-LE: lwz 1, target(3)                # encoding: [A,A,0x23,0x80]
149 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target, kind: fixup_ppc_half16
150 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target, kind: fixup_ppc_half16
151 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16 target 0x0
152 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16 target 0x0
153             lwz 1, target(3)
154
155 # CHECK-BE: ld 1, target@l(3)               # encoding: [0xe8,0x23,A,0bAAAAAA00]
156 # CHECK-LE: ld 1, target@l(3)               # encoding: [0bAAAAAA00,A,0x23,0xe8]
157 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@l, kind: fixup_ppc_half16ds
158 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@l, kind: fixup_ppc_half16ds
159 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_LO_DS target 0x0
160 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_LO_DS target 0x0
161             ld 1, target@l(3)
162
163 # CHECK-BE: ld 1, target(3)                 # encoding: [0xe8,0x23,A,0bAAAAAA00]
164 # CHECK-LE: ld 1, target(3)                 # encoding: [0bAAAAAA00,A,0x23,0xe8]
165 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target, kind: fixup_ppc_half16ds
166 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target, kind: fixup_ppc_half16ds
167 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_DS target 0x0
168 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_DS target 0x0
169             ld 1, target(3)
170
171 base:
172 # CHECK-BE: lwz 1, target-base(3)           # encoding: [0x80,0x23,A,A]
173 # CHECK-LE: lwz 1, target-base(3)           # encoding: [A,A,0x23,0x80]
174 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target-base, kind: fixup_ppc_half16
175 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target-base, kind: fixup_ppc_half16
176 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_REL16 target 0x2
177 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_REL16 target 0x0
178             lwz 1, target-base(3)
179
180 # CHECK-BE: li 3, target-base@h             # encoding: [0x38,0x60,A,A]
181 # CHECK-LE: li 3, target-base@h             # encoding: [A,A,0x60,0x38]
182 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target-base@h, kind: fixup_ppc_half16
183 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target-base@h, kind: fixup_ppc_half16
184 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_REL16_HI target 0x6
185 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_REL16_HI target 0x4
186             li 3, target-base@h
187
188 # CHECK-BE: li 3, target-base@l             # encoding: [0x38,0x60,A,A]
189 # CHECK-LE: li 3, target-base@l             # encoding: [A,A,0x60,0x38]
190 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target-base@l, kind: fixup_ppc_half16
191 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target-base@l, kind: fixup_ppc_half16
192 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_REL16_LO target 0xA
193 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_REL16_LO target 0x8
194             li 3, target-base@l
195
196 # CHECK-BE: li 3, target-base@ha            # encoding: [0x38,0x60,A,A]
197 # CHECK-LE: li 3, target-base@ha            # encoding: [A,A,0x60,0x38]
198 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target-base@ha, kind: fixup_ppc_half16
199 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target-base@ha, kind: fixup_ppc_half16
200 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_REL16_HA target 0xE
201 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_REL16_HA target 0xC
202             li 3, target-base@ha
203
204 # CHECK-BE: ori 3, 3, target@l              # encoding: [0x60,0x63,A,A]
205 # CHECK-LE: ori 3, 3, target@l              # encoding: [A,A,0x63,0x60]
206 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@l, kind: fixup_ppc_half16
207 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@l, kind: fixup_ppc_half16
208 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_LO target 0x0
209 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_LO target 0x0
210             ori 3, 3, target@l
211
212 # CHECK-BE: oris 3, 3, target@h             # encoding: [0x64,0x63,A,A]
213 # CHECK-LE: oris 3, 3, target@h             # encoding: [A,A,0x63,0x64]
214 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@h, kind: fixup_ppc_half16
215 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@h, kind: fixup_ppc_half16
216 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_ADDR16_HI target 0x0
217 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_ADDR16_HI target 0x0
218             oris 3, 3, target@h
219
220 # CHECK-BE: ld 1, target@toc(2)             # encoding: [0xe8,0x22,A,0bAAAAAA00]
221 # CHECK-LE: ld 1, target@toc(2)             # encoding: [0bAAAAAA00,A,0x22,0xe8]
222 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@toc, kind: fixup_ppc_half16ds
223 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@toc, kind: fixup_ppc_half16ds
224 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TOC16_DS target 0x0
225 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TOC16_DS target 0x0
226             ld 1, target@toc(2)
227
228 # CHECK-BE: addis 3, 2, target@toc@ha       # encoding: [0x3c,0x62,A,A]
229 # CHECK-LE: addis 3, 2, target@toc@ha       # encoding: [A,A,0x62,0x3c]
230 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@toc@ha, kind: fixup_ppc_half16
231 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@toc@ha, kind: fixup_ppc_half16
232 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TOC16_HA target 0x0
233 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TOC16_HA target 0x0
234             addis 3, 2, target@toc@ha
235
236 # CHECK-BE: addi 4, 3, target@toc@l         # encoding: [0x38,0x83,A,A]
237 # CHECK-LE: addi 4, 3, target@toc@l         # encoding: [A,A,0x83,0x38]
238 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@toc@l, kind: fixup_ppc_half16
239 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@toc@l, kind: fixup_ppc_half16
240 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TOC16_LO target 0x0
241 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TOC16_LO target 0x0
242             addi 4, 3, target@toc@l
243
244 # CHECK-BE: addis 3, 2, target@toc@h        # encoding: [0x3c,0x62,A,A]
245 # CHECK-LE: addis 3, 2, target@toc@h        # encoding: [A,A,0x62,0x3c]
246 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@toc@h, kind: fixup_ppc_half16
247 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@toc@h, kind: fixup_ppc_half16
248 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TOC16_HI target 0x0
249 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TOC16_HI target 0x0
250             addis 3, 2, target@toc@h
251
252 # CHECK-BE: lwz 1, target@toc@l(3)          # encoding: [0x80,0x23,A,A]
253 # CHECK-LE: lwz 1, target@toc@l(3)          # encoding: [A,A,0x23,0x80]
254 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@toc@l, kind: fixup_ppc_half16
255 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@toc@l, kind: fixup_ppc_half16
256 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TOC16_LO target 0x0
257 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TOC16_LO target 0x0
258             lwz 1, target@toc@l(3)
259
260 # CHECK-BE: ld 1, target@toc@l(3)           # encoding: [0xe8,0x23,A,0bAAAAAA00]
261 # CHECK-LE: ld 1, target@toc@l(3)           # encoding: [0bAAAAAA00,A,0x23,0xe8]
262 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@toc@l, kind: fixup_ppc_half16ds
263 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@toc@l, kind: fixup_ppc_half16ds
264 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TOC16_LO_DS target 0x0
265 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TOC16_LO_DS target 0x0
266             ld 1, target@toc@l(3)
267
268 # CHECK-BE: addi 4, 3, target@GOT           # encoding: [0x38,0x83,A,A]
269 # CHECK-LE: addi 4, 3, target@GOT           # encoding: [A,A,0x83,0x38]
270 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@GOT, kind: fixup_ppc_half16
271 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@GOT, kind: fixup_ppc_half16
272 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16 target 0x0
273 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16 target 0x0
274             addi 4, 3, target@got
275
276 # CHECK-BE: ld 1, target@GOT(2)             # encoding: [0xe8,0x22,A,0bAAAAAA00]
277 # CHECK-LE: ld 1, target@GOT(2)             # encoding: [0bAAAAAA00,A,0x22,0xe8]
278 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@GOT, kind: fixup_ppc_half16ds
279 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@GOT, kind: fixup_ppc_half16ds
280 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16_DS target 0x0
281 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16_DS target 0x0
282             ld 1, target@got(2)
283
284 # CHECK-BE: addis 3, 2, target@got@ha       # encoding: [0x3c,0x62,A,A]
285 # CHECK-LE: addis 3, 2, target@got@ha       # encoding: [A,A,0x62,0x3c]
286 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@ha, kind: fixup_ppc_half16
287 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@ha, kind: fixup_ppc_half16
288 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16_HA target 0x0
289 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16_HA target 0x0
290             addis 3, 2, target@got@ha
291
292 # CHECK-BE: addi 4, 3, target@got@l         # encoding: [0x38,0x83,A,A]
293 # CHECK-LE: addi 4, 3, target@got@l         # encoding: [A,A,0x83,0x38]
294 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@l, kind: fixup_ppc_half16
295 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@l, kind: fixup_ppc_half16
296 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16_LO target 0x0
297 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16_LO target 0x0
298             addi 4, 3, target@got@l
299
300 # CHECK-BE: addis 3, 2, target@got@h        # encoding: [0x3c,0x62,A,A]
301 # CHECK-LE: addis 3, 2, target@got@h        # encoding: [A,A,0x62,0x3c]
302 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@h, kind: fixup_ppc_half16
303 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@h, kind: fixup_ppc_half16
304 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16_HI target 0x0
305 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16_HI target 0x0
306             addis 3, 2, target@got@h
307
308 # CHECK-BE: lwz 1, target@got@l(3)          # encoding: [0x80,0x23,A,A]
309 # CHECK-LE: lwz 1, target@got@l(3)          # encoding: [A,A,0x23,0x80]
310 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@l, kind: fixup_ppc_half16
311 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@l, kind: fixup_ppc_half16
312 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16_LO target 0x0
313 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16_LO target 0x0
314             lwz 1, target@got@l(3)
315
316 # CHECK-BE: ld 1, target@got@l(3)           # encoding: [0xe8,0x23,A,0bAAAAAA00]
317 # CHECK-LE: ld 1, target@got@l(3)           # encoding: [0bAAAAAA00,A,0x23,0xe8]
318 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@l, kind: fixup_ppc_half16ds
319 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@l, kind: fixup_ppc_half16ds
320 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT16_LO_DS target 0x0
321 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT16_LO_DS target 0x0
322             ld 1, target@got@l(3)
323
324
325 # CHECK-BE: addis 3, 2, target@tprel@ha     # encoding: [0x3c,0x62,A,A]
326 # CHECK-LE: addis 3, 2, target@tprel@ha     # encoding: [A,A,0x62,0x3c]
327 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@tprel@ha, kind: fixup_ppc_half16
328 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tprel@ha, kind: fixup_ppc_half16
329 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TPREL16_HA target 0x0
330 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TPREL16_HA target 0x0
331             addis 3, 2, target@tprel@ha
332
333 # CHECK-BE: addi 3, 3, target@tprel@l       # encoding: [0x38,0x63,A,A]
334 # CHECK-LE: addi 3, 3, target@tprel@l       # encoding: [A,A,0x63,0x38]
335 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@tprel@l, kind: fixup_ppc_half16
336 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tprel@l, kind: fixup_ppc_half16
337 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TPREL16_LO target 0x0
338 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TPREL16_LO target 0x0
339             addi 3, 3, target@tprel@l
340
341 # CHECK-BE: addi 3, 3, target@tprel         # encoding: [0x38,0x63,A,A]
342 # CHECK-LE: addi 3, 3, target@tprel         # encoding: [A,A,0x63,0x38]
343 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@tprel, kind: fixup_ppc_half16
344 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tprel, kind: fixup_ppc_half16
345 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TPREL16 target 0x0
346 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TPREL16 target 0x0
347             addi 3, 3, target@tprel
348
349 # CHECK-BE: addi 3, 3, target@tprel@h       # encoding: [0x38,0x63,A,A]
350 # CHECK-LE: addi 3, 3, target@tprel@h       # encoding: [A,A,0x63,0x38]
351 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@tprel@h, kind: fixup_ppc_half16
352 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tprel@h, kind: fixup_ppc_half16
353 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TPREL16_HI target 0x0
354 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TPREL16_HI target 0x0
355             addi 3, 3, target@tprel@h
356
357 # CHECK-BE: addi 3, 3, target@tprel@higher  # encoding: [0x38,0x63,A,A]
358 # CHECK-LE: addi 3, 3, target@tprel@higher  # encoding: [A,A,0x63,0x38]
359 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@tprel@higher, kind: fixup_ppc_half16
360 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tprel@higher, kind: fixup_ppc_half16
361 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TPREL16_HIGHER target 0x0
362 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TPREL16_HIGHER target 0x0
363             addi 3, 3, target@tprel@higher
364
365 # CHECK-BE: addis 3, 2, target@tprel@highest # encoding: [0x3c,0x62,A,A]
366 # CHECK-LE: addis 3, 2, target@tprel@highest # encoding: [A,A,0x62,0x3c]
367 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@tprel@highest, kind: fixup_ppc_half16
368 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tprel@highest, kind: fixup_ppc_half16
369 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TPREL16_HIGHEST target 0x0
370 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TPREL16_HIGHEST target 0x0
371             addis 3, 2, target@tprel@highest
372
373 # CHECK-BE: addi 3, 3, target@tprel@highera  # encoding: [0x38,0x63,A,A]
374 # CHECK-LE: addi 3, 3, target@tprel@highera  # encoding: [A,A,0x63,0x38]
375 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@tprel@highera, kind: fixup_ppc_half16
376 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tprel@highera, kind: fixup_ppc_half16
377 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TPREL16_HIGHERA target 0x0
378 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TPREL16_HIGHERA target 0x0
379             addi 3, 3, target@tprel@highera
380
381 # CHECK-BE: addis 3, 2, target@tprel@highesta # encoding: [0x3c,0x62,A,A]
382 # CHECK-LE: addis 3, 2, target@tprel@highesta # encoding: [A,A,0x62,0x3c]
383 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@tprel@highesta, kind: fixup_ppc_half16
384 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tprel@highesta, kind: fixup_ppc_half16
385 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TPREL16_HIGHESTA target 0x0
386 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TPREL16_HIGHESTA target 0x0
387             addis 3, 2, target@tprel@highesta
388
389 # CHECK-BE: ld 1, target@tprel@l(3)         # encoding: [0xe8,0x23,A,0bAAAAAA00]
390 # CHECK-LE: ld 1, target@tprel@l(3)         # encoding: [0bAAAAAA00,A,0x23,0xe8]
391 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@tprel@l, kind: fixup_ppc_half16ds
392 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tprel@l, kind: fixup_ppc_half16ds
393 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TPREL16_LO_DS target 0x0
394 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TPREL16_LO_DS target 0x0
395             ld 1, target@tprel@l(3)
396
397 # CHECK-BE: ld 1, target@tprel(3)           # encoding: [0xe8,0x23,A,0bAAAAAA00]
398 # CHECK-LE: ld 1, target@tprel(3)           # encoding: [0bAAAAAA00,A,0x23,0xe8]
399 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@tprel, kind: fixup_ppc_half16ds
400 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tprel, kind: fixup_ppc_half16ds
401 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_TPREL16_DS target 0x0
402 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TPREL16_DS target 0x0
403             ld 1, target@tprel(3)
404
405 # CHECK-BE: addis 3, 2, target@dtprel@ha    # encoding: [0x3c,0x62,A,A]
406 # CHECK-LE: addis 3, 2, target@dtprel@ha    # encoding: [A,A,0x62,0x3c]
407 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@dtprel@ha, kind: fixup_ppc_half16
408 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@dtprel@ha, kind: fixup_ppc_half16
409 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_DTPREL16_HA target 0x0
410 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_DTPREL16_HA target 0x0
411             addis 3, 2, target@dtprel@ha
412
413 # CHECK-BE: addi 3, 3, target@dtprel@l      # encoding: [0x38,0x63,A,A]
414 # CHECK-LE: addi 3, 3, target@dtprel@l      # encoding: [A,A,0x63,0x38]
415 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@dtprel@l, kind: fixup_ppc_half16
416 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@dtprel@l, kind: fixup_ppc_half16
417 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_DTPREL16_LO target 0x0
418 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_DTPREL16_LO target 0x0
419             addi 3, 3, target@dtprel@l
420
421 # CHECK-BE: addi 3, 3, target@dtprel         # encoding: [0x38,0x63,A,A]
422 # CHECK-LE: addi 3, 3, target@dtprel         # encoding: [A,A,0x63,0x38]
423 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@dtprel, kind: fixup_ppc_half16
424 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@dtprel, kind: fixup_ppc_half16
425 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_DTPREL16 target 0x0
426 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_DTPREL16 target 0x0
427             addi 3, 3, target@dtprel
428
429 # CHECK-BE: addi 3, 3, target@dtprel@h       # encoding: [0x38,0x63,A,A]
430 # CHECK-LE: addi 3, 3, target@dtprel@h       # encoding: [A,A,0x63,0x38]
431 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@dtprel@h, kind: fixup_ppc_half16
432 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@dtprel@h, kind: fixup_ppc_half16
433 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_DTPREL16_HI target 0x0
434 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_DTPREL16_HI target 0x0
435             addi 3, 3, target@dtprel@h
436
437 # CHECK-BE: addi 3, 3, target@dtprel@higher  # encoding: [0x38,0x63,A,A]
438 # CHECK-LE: addi 3, 3, target@dtprel@higher  # encoding: [A,A,0x63,0x38]
439 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@dtprel@higher, kind: fixup_ppc_half16
440 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@dtprel@higher, kind: fixup_ppc_half16
441 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_DTPREL16_HIGHER target 0x0
442 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_DTPREL16_HIGHER target 0x0
443             addi 3, 3, target@dtprel@higher
444
445 # CHECK-BE: addis 3, 2, target@dtprel@highest # encoding: [0x3c,0x62,A,A]
446 # CHECK-LE: addis 3, 2, target@dtprel@highest # encoding: [A,A,0x62,0x3c]
447 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@dtprel@highest, kind: fixup_ppc_half16
448 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@dtprel@highest, kind: fixup_ppc_half16
449 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_DTPREL16_HIGHEST target 0x0
450 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_DTPREL16_HIGHEST target 0x0
451             addis 3, 2, target@dtprel@highest
452
453 # CHECK-BE: addi 3, 3, target@dtprel@highera  # encoding: [0x38,0x63,A,A]
454 # CHECK-LE: addi 3, 3, target@dtprel@highera  # encoding: [A,A,0x63,0x38]
455 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@dtprel@highera, kind: fixup_ppc_half16
456 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@dtprel@highera, kind: fixup_ppc_half16
457 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_DTPREL16_HIGHERA target 0x0
458 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_DTPREL16_HIGHERA target 0x0
459             addi 3, 3, target@dtprel@highera
460
461 # CHECK-BE: addis 3, 2, target@dtprel@highesta # encoding: [0x3c,0x62,A,A]
462 # CHECK-LE: addis 3, 2, target@dtprel@highesta # encoding: [A,A,0x62,0x3c]
463 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@dtprel@highesta, kind: fixup_ppc_half16
464 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@dtprel@highesta, kind: fixup_ppc_half16
465 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_DTPREL16_HIGHESTA target 0x0
466 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_DTPREL16_HIGHESTA target 0x0
467             addis 3, 2, target@dtprel@highesta
468
469 # CHECK-BE: ld 1, target@dtprel@l(3)        # encoding: [0xe8,0x23,A,0bAAAAAA00]
470 # CHECK-LE: ld 1, target@dtprel@l(3)        # encoding: [0bAAAAAA00,A,0x23,0xe8]
471 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@dtprel@l, kind: fixup_ppc_half16ds
472 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@dtprel@l, kind: fixup_ppc_half16ds
473 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_DTPREL16_LO_DS target 0x0
474 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_DTPREL16_LO_DS target 0x0
475             ld 1, target@dtprel@l(3)
476
477 # CHECK-BE: ld 1, target@dtprel(3)          # encoding: [0xe8,0x23,A,0bAAAAAA00]
478 # CHECK-LE: ld 1, target@dtprel(3)          # encoding: [0bAAAAAA00,A,0x23,0xe8]
479 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@dtprel, kind: fixup_ppc_half16ds
480 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@dtprel, kind: fixup_ppc_half16ds
481 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_DTPREL16_DS target 0x0
482 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_DTPREL16_DS target 0x0
483             ld 1, target@dtprel(3)
484
485
486 # CHECK-BE: addis 3, 2, target@got@tprel@ha # encoding: [0x3c,0x62,A,A]
487 # CHECK-LE: addis 3, 2, target@got@tprel@ha # encoding: [A,A,0x62,0x3c]
488 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tprel@ha, kind: fixup_ppc_half16
489 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tprel@ha, kind: fixup_ppc_half16
490 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TPREL16_HA target 0x0
491 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TPREL16_HA target 0x0
492             addis 3, 2, target@got@tprel@ha
493
494 # CHECK-BE: ld 1, target@got@tprel@l(3)     # encoding: [0xe8,0x23,A,0bAAAAAA00]
495 # CHECK-LE: ld 1, target@got@tprel@l(3)     # encoding: [0bAAAAAA00,A,0x23,0xe8]
496 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tprel@l, kind: fixup_ppc_half16ds
497 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tprel@l, kind: fixup_ppc_half16ds
498 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TPREL16_LO_DS target 0x0
499 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TPREL16_LO_DS target 0x0
500             ld 1, target@got@tprel@l(3)
501
502 # CHECK-BE: addis 3, 2, target@got@tprel@h  # encoding: [0x3c,0x62,A,A]
503 # CHECK-LE: addis 3, 2, target@got@tprel@h  # encoding: [A,A,0x62,0x3c]
504 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tprel@h, kind: fixup_ppc_half16
505 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tprel@h, kind: fixup_ppc_half16
506 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TPREL16_HI target 0x0
507 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TPREL16_HI target 0x0
508             addis 3, 2, target@got@tprel@h
509
510 # CHECK-BE: addis 3, 2, target@got@tprel@l  # encoding: [0x3c,0x62,A,A]
511 # CHECK-LE: addis 3, 2, target@got@tprel@l  # encoding: [A,A,0x62,0x3c]
512 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tprel@l, kind: fixup_ppc_half16
513 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tprel@l, kind: fixup_ppc_half16
514 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TPREL16_LO_DS target 0x0
515 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TPREL16_LO_DS target 0x0
516             addis 3, 2, target@got@tprel@l
517
518 # CHECK-BE: addis 3, 2, target@got@tprel    # encoding: [0x3c,0x62,A,A]
519 # CHECK-LE: addis 3, 2, target@got@tprel    # encoding: [A,A,0x62,0x3c]
520 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tprel, kind: fixup_ppc_half16
521 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tprel, kind: fixup_ppc_half16
522 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TPREL16_DS target 0x0
523 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TPREL16_DS target 0x0
524             addis 3, 2, target@got@tprel
525
526 # CHECK-BE: ld 1, target@got@tprel(3)       # encoding: [0xe8,0x23,A,0bAAAAAA00]
527 # CHECK-LE: ld 1, target@got@tprel(3)       # encoding: [0bAAAAAA00,A,0x23,0xe8]
528 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tprel, kind: fixup_ppc_half16ds
529 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tprel, kind: fixup_ppc_half16ds
530 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TPREL16_DS target 0x0
531 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TPREL16_DS target 0x0
532             ld 1, target@got@tprel(3)
533
534 # CHECK-BE: addis 3, 2, target@got@dtprel@ha # encoding: [0x3c,0x62,A,A]
535 # CHECK-LE: addis 3, 2, target@got@dtprel@ha # encoding: [A,A,0x62,0x3c]
536 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@dtprel@ha, kind: fixup_ppc_half16
537 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@dtprel@ha, kind: fixup_ppc_half16
538 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_DTPREL16_HA target 0x0
539 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_DTPREL16_HA target 0x0
540             addis 3, 2, target@got@dtprel@ha
541
542 # CHECK-BE: ld 1, target@got@dtprel@l(3)    # encoding: [0xe8,0x23,A,0bAAAAAA00]
543 # CHECK-LE: ld 1, target@got@dtprel@l(3)    # encoding: [0bAAAAAA00,A,0x23,0xe8]
544 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@dtprel@l, kind: fixup_ppc_half16ds
545 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@dtprel@l, kind: fixup_ppc_half16ds
546 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_DTPREL16_LO_DS target 0x0
547 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_DTPREL16_LO_DS target 0x0
548             ld 1, target@got@dtprel@l(3)
549
550 # CHECK-BE: addis 3, 2, target@got@dtprel@h # encoding: [0x3c,0x62,A,A]
551 # CHECK-LE: addis 3, 2, target@got@dtprel@h # encoding: [A,A,0x62,0x3c]
552 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@dtprel@h, kind: fixup_ppc_half16
553 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@dtprel@h, kind: fixup_ppc_half16
554 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_DTPREL16_HI target 0x0
555 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_DTPREL16_HI target 0x0
556             addis 3, 2, target@got@dtprel@h
557
558 # CHECK-BE: addis 3, 2, target@got@dtprel@l # encoding: [0x3c,0x62,A,A]
559 # CHECK-LE: addis 3, 2, target@got@dtprel@l # encoding: [A,A,0x62,0x3c]
560 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@dtprel@l, kind: fixup_ppc_half16
561 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@dtprel@l, kind: fixup_ppc_half16
562 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_DTPREL16_LO_DS target 0x0
563 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_DTPREL16_LO_DS target 0x0
564             addis 3, 2, target@got@dtprel@l
565
566 # CHECK-BE: addis 3, 2, target@got@dtprel   # encoding: [0x3c,0x62,A,A]
567 # CHECK-LE: addis 3, 2, target@got@dtprel   # encoding: [A,A,0x62,0x3c]
568 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@dtprel, kind: fixup_ppc_half16
569 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@dtprel, kind: fixup_ppc_half16
570 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_DTPREL16_DS target 0x0
571 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_DTPREL16_DS target 0x0
572             addis 3, 2, target@got@dtprel
573
574 # CHECK-BE: ld 1, target@got@dtprel(3)      # encoding: [0xe8,0x23,A,0bAAAAAA00]
575 # CHECK-LE: ld 1, target@got@dtprel(3)      # encoding: [0bAAAAAA00,A,0x23,0xe8]
576 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@dtprel, kind: fixup_ppc_half16ds
577 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@dtprel, kind: fixup_ppc_half16ds
578 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_DTPREL16_DS target 0x0
579 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_DTPREL16_DS target 0x0
580             ld 1, target@got@dtprel(3)
581
582 # CHECK-BE: addis 3, 2, target@got@tlsgd@ha # encoding: [0x3c,0x62,A,A]
583 # CHECK-LE: addis 3, 2, target@got@tlsgd@ha # encoding: [A,A,0x62,0x3c]
584 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tlsgd@ha, kind: fixup_ppc_half16
585 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tlsgd@ha, kind: fixup_ppc_half16
586 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TLSGD16_HA target 0x0
587 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TLSGD16_HA target 0x0
588             addis 3, 2, target@got@tlsgd@ha
589
590 # CHECK-BE: addi 3, 3, target@got@tlsgd@l   # encoding: [0x38,0x63,A,A]
591 # CHECK-LE: addi 3, 3, target@got@tlsgd@l   # encoding: [A,A,0x63,0x38]
592 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tlsgd@l, kind: fixup_ppc_half16
593 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tlsgd@l, kind: fixup_ppc_half16
594 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TLSGD16_LO target 0x0
595 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TLSGD16_LO target 0x0
596             addi 3, 3, target@got@tlsgd@l
597
598 # CHECK-BE: addi 3, 3, target@got@tlsgd@h   # encoding: [0x38,0x63,A,A]
599 # CHECK-LE: addi 3, 3, target@got@tlsgd@h   # encoding: [A,A,0x63,0x38]
600 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tlsgd@h, kind: fixup_ppc_half16
601 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tlsgd@h, kind: fixup_ppc_half16
602 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TLSGD16_HI target 0x0
603 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TLSGD16_HI target 0x0
604             addi 3, 3, target@got@tlsgd@h
605
606 # CHECK-BE: addi 3, 3, target@got@tlsgd     # encoding: [0x38,0x63,A,A]
607 # CHECK-LE: addi 3, 3, target@got@tlsgd     # encoding: [A,A,0x63,0x38]
608 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tlsgd, kind: fixup_ppc_half16
609 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tlsgd, kind: fixup_ppc_half16
610 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TLSGD16 target 0x0
611 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TLSGD16 target 0x0
612             addi 3, 3, target@got@tlsgd
613
614
615 # CHECK-BE: addis 3, 2, target@got@tlsld@ha # encoding: [0x3c,0x62,A,A]
616 # CHECK-LE: addis 3, 2, target@got@tlsld@ha # encoding: [A,A,0x62,0x3c]
617 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tlsld@ha, kind: fixup_ppc_half16
618 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tlsld@ha, kind: fixup_ppc_half16
619 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TLSLD16_HA target 0x0
620 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TLSLD16_HA target 0x0
621             addis 3, 2, target@got@tlsld@ha
622
623 # CHECK-BE: addi 3, 3, target@got@tlsld@l   # encoding: [0x38,0x63,A,A]
624 # CHECK-LE: addi 3, 3, target@got@tlsld@l   # encoding: [A,A,0x63,0x38]
625 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tlsld@l, kind: fixup_ppc_half16
626 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tlsld@l, kind: fixup_ppc_half16
627 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TLSLD16_LO target 0x0
628 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TLSLD16_LO target 0x0
629             addi 3, 3, target@got@tlsld@l
630
631 # CHECK-BE: addi 3, 3, target@got@tlsld@h   # encoding: [0x38,0x63,A,A]
632 # CHECK-LE: addi 3, 3, target@got@tlsld@h   # encoding: [A,A,0x63,0x38]
633 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tlsld@h, kind: fixup_ppc_half16
634 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tlsld@h, kind: fixup_ppc_half16
635 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TLSLD16_HI target 0x0
636 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TLSLD16_HI target 0x0
637             addi 3, 3, target@got@tlsld@h
638
639 # CHECK-BE: addi 3, 3, target@got@tlsld     # encoding: [0x38,0x63,A,A]
640 # CHECK-LE: addi 3, 3, target@got@tlsld     # encoding: [A,A,0x63,0x38]
641 # CHECK-BE-NEXT:                            #   fixup A - offset: 2, value: target@got@tlsld, kind: fixup_ppc_half16
642 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@got@tlsld, kind: fixup_ppc_half16
643 # CHECK-BE-REL:                             0x{{[0-9A-F]*[26AE]}} R_PPC64_GOT_TLSLD16 target 0x0
644 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_GOT_TLSLD16 target 0x0
645             addi 3, 3, target@got@tlsld
646
647 # CHECK-BE: bl __tls_get_addr(target@tlsgd) # encoding: [0b010010BB,B,B,0bBBBBBB01]
648 # CHECK-LE: bl __tls_get_addr(target@tlsgd) # encoding: [0bBBBBBB01,B,B,0b010010BB]
649 # CHECK-BE-NEXT:                            #   fixup A - offset: 0, value: target@tlsgd, kind: fixup_ppc_nofixup
650 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tlsgd, kind: fixup_ppc_nofixup
651 # CHECK-BE-NEXT:                            #   fixup B - offset: 0, value: __tls_get_addr, kind: fixup_ppc_br24
652 # CHECK-LE-NEXT:                            #   fixup B - offset: 0, value: __tls_get_addr, kind: fixup_ppc_br24
653 # CHECK-BE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TLSGD target 0x0
654 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TLSGD target 0x0
655 # CHECK-BE-REL-NEXT:                        0x{{[0-9A-F]*[048C]}} R_PPC64_REL24 __tls_get_addr 0x0
656 # CHECK-LE-REL-NEXT:                        0x{{[0-9A-F]*[048C]}} R_PPC64_REL24 __tls_get_addr 0x0
657             bl __tls_get_addr(target@tlsgd)
658
659 # CHECK-BE: bl __tls_get_addr(target@tlsld) # encoding: [0b010010BB,B,B,0bBBBBBB01]
660 # CHECK-LE: bl __tls_get_addr(target@tlsld) # encoding: [0bBBBBBB01,B,B,0b010010BB]
661 # CHECK-BE-NEXT:                            #   fixup A - offset: 0, value: target@tlsld, kind: fixup_ppc_nofixup
662 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tlsld, kind: fixup_ppc_nofixup
663 # CHECK-BE-NEXT:                            #   fixup B - offset: 0, value: __tls_get_addr, kind: fixup_ppc_br24
664 # CHECK-LE-NEXT:                            #   fixup B - offset: 0, value: __tls_get_addr, kind: fixup_ppc_br24
665 # CHECK-BE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TLSLD target 0x0
666 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TLSLD target 0x0
667 # CHECK-BE-REL-NEXT:                        0x{{[0-9A-F]*[048C]}} R_PPC64_REL24 __tls_get_addr 0x0
668 # CHECK-LE-REL-NEXT:                        0x{{[0-9A-F]*[048C]}} R_PPC64_REL24 __tls_get_addr 0x0
669             bl __tls_get_addr(target@tlsld)
670
671 # CHECK-BE: add 3, 4, target@tls            # encoding: [0x7c,0x64,0x6a,0x14]
672 # CHECK-LE: add 3, 4, target@tls            # encoding: [0x14,0x6a,0x64,0x7c]
673 # CHECK-BE-NEXT:                            #   fixup A - offset: 0, value: target@tls, kind: fixup_ppc_nofixup
674 # CHECK-LE-NEXT:                            #   fixup A - offset: 0, value: target@tls, kind: fixup_ppc_nofixup
675 # CHECK-BE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TLS target 0x0
676 # CHECK-LE-REL:                             0x{{[0-9A-F]*[048C]}} R_PPC64_TLS target 0x0
677             add 3, 4, target@tls
678
679 # Verify that fixups on constants are resolved at assemble time
680
681 # CHECK-BE: ori 1, 2, 65535              # encoding: [0x60,0x41,0xff,0xff]
682 # CHECK-LE: ori 1, 2, 65535              # encoding: [0xff,0xff,0x41,0x60]
683             ori 1, 2, 131071@l
684 # CHECK-BE: ori 1, 2, 1                  # encoding: [0x60,0x41,0x00,0x01]
685 # CHECK-LE: ori 1, 2, 1                  # encoding: [0x01,0x00,0x41,0x60]
686             ori 1, 2, 131071@h
687 # CHECK-BE: ori 1, 2, 2                  # encoding: [0x60,0x41,0x00,0x02]
688 # CHECK-LE: ori 1, 2, 2                  # encoding: [0x02,0x00,0x41,0x60]
689             ori 1, 2, 131071@ha
690
691 # Data relocs
692 # llvm-mc does not show any "encoding" string for data, so we just check the relocs
693
694 # CHECK-BE-REL: .rela.data
695 # CHECK-LE-REL: .rela.data
696         .data
697
698 # CHECK-BE-REL: 0x{{[0-9A-F]*[08]}} R_PPC64_TOC - 0x0
699 # CHECK-LE-REL: 0x{{[0-9A-F]*[08]}} R_PPC64_TOC - 0x0
700         .quad .TOC.@tocbase
701
702 # CHECK-BE-REL: 0x{{[0-9A-F]*[08]}} R_PPC64_DTPMOD64 target 0x0
703 # CHECK-LE-REL: 0x{{[0-9A-F]*[08]}} R_PPC64_DTPMOD64 target 0x0
704         .quad target@dtpmod
705
706 # CHECK-BE-REL: 0x{{[0-9A-F]*[08]}} R_PPC64_TPREL64 target 0x0
707 # CHECK-LE-REL: 0x{{[0-9A-F]*[08]}} R_PPC64_TPREL64 target 0x0
708         .quad target@tprel
709
710 # CHECK-BE-REL: 0x{{[0-9A-F]*[08]}} R_PPC64_DTPREL64 target 0x0
711 # CHECK-LE-REL: 0x{{[0-9A-F]*[08]}} R_PPC64_DTPREL64 target 0x0
712         .quad target@dtprel
713