[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / llvm / test / MC / WebAssembly / weak-alias.s
blob2b2b4ae2b7b28e591bace8ea96e82517a249bf84
1 # RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj < %s | obj2yaml | FileCheck --check-prefix=CHECK %s
2 # RUN: llvm-mc -triple=wasm32-unknown-unknown -mattr=+reference-types -filetype=obj < %s | obj2yaml | FileCheck --check-prefix=REF %s
4 # 'foo_alias()' is weak alias of function 'foo()'
5 # 'bar_alias' is weak alias of global variable 'bar'
6 # Generates two exports of the same function, one of them weak
8 .functype foo_alias () -> (i32)
10 foo:
11 .hidden foo
12 .globl foo
13 .functype foo () -> (i32)
14 i32.const 0
15 end_function
17 call_direct:
18 .hidden call_direct
19 .globl call_direct
20 .functype call_direct () -> (i32)
21 call foo
22 end_function
24 call_alias:
25 .hidden call_alias
26 .globl call_alias
27 .functype call_alias () -> (i32)
28 call foo_alias
29 end_function
31 call_direct_ptr:
32 .hidden call_direct_ptr
33 .globl call_direct_ptr
34 .functype call_direct_ptr () -> (i32)
35 i32.const 0
36 i32.load direct_address
37 call_indirect () -> (i32)
38 end_function
40 call_alias_ptr:
41 .hidden call_alias_ptr
42 .globl call_alias_ptr
43 .functype call_alias_ptr () -> (i32)
44 i32.const 0
45 i32.load alias_address
46 call_indirect () -> (i32)
47 end_function
49 .section .data.bar,"",@
50 bar:
51 .int32 7
52 .size bar, 4
53 .globl bar
54 .p2align 3
56 .section .data.direct_address,"",@
57 direct_address:
58 .int32 foo
59 .size direct_address, 4
60 .globl direct_address
61 .p2align 3
63 .section .data.alias_address,"",@
64 alias_address:
65 .int32 foo_alias
66 .size alias_address, 4
67 .globl alias_address
68 .p2align 3
70 # Define Aliases
71 .set foo_alias, foo
72 .weak foo_alias
73 .type foo_alias,@function
74 .hidden foo_alias
76 .set bar_alias, bar
77 .weak bar_alias
78 .hidden bar_alias
80 # CHECK: - Type: TYPE
81 # CHECK-NEXT: Signatures:
82 # CHECK-NEXT: - Index: 0
83 # CHECK-NEXT: ParamTypes: []
84 # CHECK-NEXT: ReturnTypes:
85 # CHECK-NEXT: - I32
86 # CHECK-NEXT: - Type: IMPORT
87 # CHECK-NEXT: Imports:
88 # CHECK-NEXT: - Module: env
89 # CHECK-NEXT: Field: __linear_memory
90 # CHECK-NEXT: Kind: MEMORY
91 # CHECK-NEXT: Memory:
92 # CHECK-NEXT: Minimum: 0x1
93 # CHECK-NEXT: - Module: env
94 # CHECK-NEXT: Field: __indirect_function_table
95 # CHECK-NEXT: Kind: TABLE
96 # CHECK-NEXT: Table:
97 # CHECK-NEXT: Index: 0
98 # CHECK-NEXT: ElemType: FUNCREF
99 # CHECK-NEXT: Limits:
100 # CHECK-NEXT: Minimum: 0x1
101 # CHECK-NEXT: - Type: FUNCTION
102 # CHECK-NEXT: FunctionTypes: [ 0, 0, 0, 0, 0 ]
103 # CHECK-NEXT: - Type: ELEM
104 # CHECK-NEXT: Segments:
105 # CHECK-NEXT: - Offset:
106 # CHECK-NEXT: Opcode: I32_CONST
107 # CHECK-NEXT: Value: 1
108 # CHECK-NEXT: Functions: [ 0 ]
109 # CHECK-NEXT: - Type: DATACOUNT
110 # CHECK-NEXT: Count: 3
111 # CHECK-NEXT: - Type: CODE
112 # CHECK-NEXT: Relocations:
113 # CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
114 # CHECK-NEXT: Index: 0
115 # CHECK-NEXT: Offset: 0x9
116 # CHECK-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
117 # CHECK-NEXT: Index: 3
118 # CHECK-NEXT: Offset: 0x12
119 # CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_LEB
120 # CHECK-NEXT: Index: 5
121 # CHECK-NEXT: Offset: 0x1E
122 # CHECK-NEXT: - Type: R_WASM_TYPE_INDEX_LEB
123 # CHECK-NEXT: Index: 0
124 # CHECK-NEXT: Offset: 0x24
125 # CHECK-NEXT: - Type: R_WASM_MEMORY_ADDR_LEB
126 # CHECK-NEXT: Index: 7
127 # CHECK-NEXT: Offset: 0x31
128 # CHECK-NEXT: - Type: R_WASM_TYPE_INDEX_LEB
129 # CHECK-NEXT: Index: 0
130 # CHECK-NEXT: Offset: 0x37
131 # CHECK-NEXT: Functions:
132 # CHECK-NEXT: - Index: 0
133 # CHECK-NEXT: Locals: []
134 # CHECK-NEXT: Body: 41000B
135 # CHECK-NEXT: - Index: 1
136 # CHECK-NEXT: Locals: []
137 # CHECK-NEXT: Body: 1080808080000B
138 # CHECK-NEXT: - Index: 2
139 # CHECK-NEXT: Locals: []
140 # CHECK-NEXT: Body: 1080808080000B
141 # CHECK-NEXT: - Index: 3
142 # CHECK-NEXT: Locals: []
143 # CHECK-NEXT: Body: 410028028880808000118080808000000B
144 # CHECK-NEXT: - Index: 4
145 # CHECK-NEXT: Locals: []
146 # CHECK-NEXT: Body: 410028029080808000118080808000000B
147 # CHECK-NEXT: - Type: DATA
148 # CHECK-NEXT: Relocations:
149 # CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_I32
150 # CHECK-NEXT: Index: 0
151 # CHECK-NEXT: Offset: 0x13
152 # CHECK-NEXT: - Type: R_WASM_TABLE_INDEX_I32
153 # CHECK-NEXT: Index: 3
154 # CHECK-NEXT: Offset: 0x20
155 # CHECK-NEXT: Segments:
156 # CHECK-NEXT: - SectionOffset: 6
157 # CHECK-NEXT: InitFlags: 0
158 # CHECK-NEXT: Offset:
159 # CHECK-NEXT: Opcode: I32_CONST
160 # CHECK-NEXT: Value: 0
161 # CHECK-NEXT: Content: '0700000000000000'
162 # CHECK-NEXT: - SectionOffset: 19
163 # CHECK-NEXT: InitFlags: 0
164 # CHECK-NEXT: Offset:
165 # CHECK-NEXT: Opcode: I32_CONST
166 # CHECK-NEXT: Value: 8
167 # CHECK-NEXT: Content: '0100000000000000'
168 # CHECK-NEXT: - SectionOffset: 32
169 # CHECK-NEXT: InitFlags: 0
170 # CHECK-NEXT: Offset:
171 # CHECK-NEXT: Opcode: I32_CONST
172 # CHECK-NEXT: Value: 16
173 # CHECK-NEXT: Content: '0100000000000000'
174 # CHECK-NEXT: - Type: CUSTOM
175 # CHECK-NEXT: Name: linking
176 # CHECK-NEXT: Version: 2
177 # CHECK-NEXT: SymbolTable:
178 # CHECK-NEXT: - Index: 0
179 # CHECK-NEXT: Kind: FUNCTION
180 # CHECK-NEXT: Name: foo
181 # CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
182 # CHECK-NEXT: Function: 0
183 # CHECK-NEXT: - Index: 1
184 # CHECK-NEXT: Kind: FUNCTION
185 # CHECK-NEXT: Name: call_direct
186 # CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
187 # CHECK-NEXT: Function: 1
188 # CHECK-NEXT: - Index: 2
189 # CHECK-NEXT: Kind: FUNCTION
190 # CHECK-NEXT: Name: call_alias
191 # CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
192 # CHECK-NEXT: Function: 2
193 # CHECK-NEXT: - Index: 3
194 # CHECK-NEXT: Kind: FUNCTION
195 # CHECK-NEXT: Name: foo_alias
196 # CHECK-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN, NO_STRIP ]
197 # CHECK-NEXT: Function: 0
198 # CHECK-NEXT: - Index: 4
199 # CHECK-NEXT: Kind: FUNCTION
200 # CHECK-NEXT: Name: call_direct_ptr
201 # CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
202 # CHECK-NEXT: Function: 3
203 # CHECK-NEXT: - Index: 5
204 # CHECK-NEXT: Kind: DATA
205 # CHECK-NEXT: Name: direct_address
206 # CHECK-NEXT: Flags: [ ]
207 # CHECK-NEXT: Segment: 1
208 # CHECK-NEXT: Size: 4
209 # CHECK-NEXT: - Index: 6
210 # CHECK-NEXT: Kind: FUNCTION
211 # CHECK-NEXT: Name: call_alias_ptr
212 # CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ]
213 # CHECK-NEXT: Function: 4
214 # CHECK-NEXT: - Index: 7
215 # CHECK-NEXT: Kind: DATA
216 # CHECK-NEXT: Name: alias_address
217 # CHECK-NEXT: Flags: [ ]
218 # CHECK-NEXT: Segment: 2
219 # CHECK-NEXT: Size: 4
220 # CHECK-NEXT: - Index: 8
221 # CHECK-NEXT: Kind: DATA
222 # CHECK-NEXT: Name: bar
223 # CHECK-NEXT: Flags: [ ]
224 # CHECK-NEXT: Segment: 0
225 # CHECK-NEXT: Size: 4
226 # CHECK-NEXT: - Index: 9
227 # CHECK-NEXT: Kind: DATA
228 # CHECK-NEXT: Name: bar_alias
229 # CHECK-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN, NO_STRIP ]
230 # CHECK-NEXT: Segment: 0
231 # CHECK-NEXT: Size: 4
232 # CHECK-NEXT: SegmentInfo:
233 # CHECK-NEXT: - Index: 0
234 # CHECK-NEXT: Name: .data.bar
235 # CHECK-NEXT: Alignment: 3
236 # CHECK-NEXT: Flags: [ ]
237 # CHECK-NEXT: - Index: 1
238 # CHECK-NEXT: Name: .data.direct_address
239 # CHECK-NEXT: Alignment: 3
240 # CHECK-NEXT: Flags: [ ]
241 # CHECK-NEXT: - Index: 2
242 # CHECK-NEXT: Name: .data.alias_address
243 # CHECK-NEXT: Alignment: 3
244 # CHECK-NEXT: Flags: [ ]
245 # CHECK-NEXT: ...
247 # REF: - Type: TYPE
248 # REF-NEXT: Signatures:
249 # REF-NEXT: - Index: 0
250 # REF-NEXT: ParamTypes: []
251 # REF-NEXT: ReturnTypes:
252 # REF-NEXT: - I32
253 # REF-NEXT: - Type: IMPORT
254 # REF-NEXT: Imports:
255 # REF-NEXT: - Module: env
256 # REF-NEXT: Field: __linear_memory
257 # REF-NEXT: Kind: MEMORY
258 # REF-NEXT: Memory:
259 # REF-NEXT: Minimum: 0x1
260 # REF-NEXT: - Module: env
261 # REF-NEXT: Field: __indirect_function_table
262 # REF-NEXT: Kind: TABLE
263 # REF-NEXT: Table:
264 # REF-NEXT: Index: 0
265 # REF-NEXT: ElemType: FUNCREF
266 # REF-NEXT: Limits:
267 # REF-NEXT: Minimum: 0x1
268 # REF-NEXT: - Type: FUNCTION
269 # REF-NEXT: FunctionTypes: [ 0, 0, 0, 0, 0 ]
270 # REF-NEXT: - Type: ELEM
271 # REF-NEXT: Segments:
272 # REF-NEXT: - Offset:
273 # REF-NEXT: Opcode: I32_CONST
274 # REF-NEXT: Value: 1
275 # REF-NEXT: Functions: [ 0 ]
276 # REF-NEXT: - Type: DATACOUNT
277 # REF-NEXT: Count: 3
278 # REF-NEXT: - Type: CODE
279 # REF-NEXT: Relocations:
280 # REF-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
281 # REF-NEXT: Index: 0
282 # REF-NEXT: Offset: 0x9
283 # REF-NEXT: - Type: R_WASM_FUNCTION_INDEX_LEB
284 # REF-NEXT: Index: 3
285 # REF-NEXT: Offset: 0x12
286 # REF-NEXT: - Type: R_WASM_MEMORY_ADDR_LEB
287 # REF-NEXT: Index: 5
288 # REF-NEXT: Offset: 0x1E
289 # REF-NEXT: - Type: R_WASM_TYPE_INDEX_LEB
290 # REF-NEXT: Index: 0
291 # REF-NEXT: Offset: 0x24
292 # REF-NEXT: - Type: R_WASM_TABLE_NUMBER_LEB
293 # REF-NEXT: Index: 6
294 # REF-NEXT: Offset: 0x29
295 # REF-NEXT: - Type: R_WASM_MEMORY_ADDR_LEB
296 # REF-NEXT: Index: 8
297 # REF-NEXT: Offset: 0x35
298 # REF-NEXT: - Type: R_WASM_TYPE_INDEX_LEB
299 # REF-NEXT: Index: 0
300 # REF-NEXT: Offset: 0x3B
301 # REF-NEXT: - Type: R_WASM_TABLE_NUMBER_LEB
302 # REF-NEXT: Index: 6
303 # REF-NEXT: Offset: 0x40
304 # REF-NEXT: Functions:
305 # REF-NEXT: - Index: 0
306 # REF-NEXT: Locals: []
307 # REF-NEXT: Body: 41000B
308 # REF-NEXT: - Index: 1
309 # REF-NEXT: Locals: []
310 # REF-NEXT: Body: 1080808080000B
311 # REF-NEXT: - Index: 2
312 # REF-NEXT: Locals: []
313 # REF-NEXT: Body: 1080808080000B
314 # REF-NEXT: - Index: 3
315 # REF-NEXT: Locals: []
316 # REF-NEXT: Body: 41002802888080800011808080800080808080000B
317 # REF-NEXT: - Index: 4
318 # REF-NEXT: Locals: []
319 # REF-NEXT: Body: 41002802908080800011808080800080808080000B
320 # REF-NEXT: - Type: DATA
321 # REF-NEXT: Relocations:
322 # REF-NEXT: - Type: R_WASM_TABLE_INDEX_I32
323 # REF-NEXT: Index: 0
324 # REF-NEXT: Offset: 0x13
325 # REF-NEXT: - Type: R_WASM_TABLE_INDEX_I32
326 # REF-NEXT: Index: 3
327 # REF-NEXT: Offset: 0x20
328 # REF-NEXT: Segments:
329 # REF-NEXT: - SectionOffset: 6
330 # REF-NEXT: InitFlags: 0
331 # REF-NEXT: Offset:
332 # REF-NEXT: Opcode: I32_CONST
333 # REF-NEXT: Value: 0
334 # REF-NEXT: Content: '0700000000000000'
335 # REF-NEXT: - SectionOffset: 19
336 # REF-NEXT: InitFlags: 0
337 # REF-NEXT: Offset:
338 # REF-NEXT: Opcode: I32_CONST
339 # REF-NEXT: Value: 8
340 # REF-NEXT: Content: '0100000000000000'
341 # REF-NEXT: - SectionOffset: 32
342 # REF-NEXT: InitFlags: 0
343 # REF-NEXT: Offset:
344 # REF-NEXT: Opcode: I32_CONST
345 # REF-NEXT: Value: 16
346 # REF-NEXT: Content: '0100000000000000'
347 # REF-NEXT: - Type: CUSTOM
348 # REF-NEXT: Name: linking
349 # REF-NEXT: Version: 2
350 # REF-NEXT: SymbolTable:
351 # REF-NEXT: - Index: 0
352 # REF-NEXT: Kind: FUNCTION
353 # REF-NEXT: Name: foo
354 # REF-NEXT: Flags: [ VISIBILITY_HIDDEN ]
355 # REF-NEXT: Function: 0
356 # REF-NEXT: - Index: 1
357 # REF-NEXT: Kind: FUNCTION
358 # REF-NEXT: Name: call_direct
359 # REF-NEXT: Flags: [ VISIBILITY_HIDDEN ]
360 # REF-NEXT: Function: 1
361 # REF-NEXT: - Index: 2
362 # REF-NEXT: Kind: FUNCTION
363 # REF-NEXT: Name: call_alias
364 # REF-NEXT: Flags: [ VISIBILITY_HIDDEN ]
365 # REF-NEXT: Function: 2
366 # REF-NEXT: - Index: 3
367 # REF-NEXT: Kind: FUNCTION
368 # REF-NEXT: Name: foo_alias
369 # REF-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN, NO_STRIP ]
370 # REF-NEXT: Function: 0
371 # REF-NEXT: - Index: 4
372 # REF-NEXT: Kind: FUNCTION
373 # REF-NEXT: Name: call_direct_ptr
374 # REF-NEXT: Flags: [ VISIBILITY_HIDDEN ]
375 # REF-NEXT: Function: 3
376 # REF-NEXT: - Index: 5
377 # REF-NEXT: Kind: DATA
378 # REF-NEXT: Name: direct_address
379 # REF-NEXT: Flags: [ ]
380 # REF-NEXT: Segment: 1
381 # REF-NEXT: Size: 4
382 # REF-NEXT: - Index: 6
383 # REF-NEXT: Kind: TABLE
384 # REF-NEXT: Name: __indirect_function_table
385 # REF-NEXT: Flags: [ UNDEFINED, NO_STRIP ]
386 # REF-NEXT: Table: 0
387 # REF-NEXT: - Index: 7
388 # REF-NEXT: Kind: FUNCTION
389 # REF-NEXT: Name: call_alias_ptr
390 # REF-NEXT: Flags: [ VISIBILITY_HIDDEN ]
391 # REF-NEXT: Function: 4
392 # REF-NEXT: - Index: 8
393 # REF-NEXT: Kind: DATA
394 # REF-NEXT: Name: alias_address
395 # REF-NEXT: Flags: [ ]
396 # REF-NEXT: Segment: 2
397 # REF-NEXT: Size: 4
398 # REF-NEXT: - Index: 9
399 # REF-NEXT: Kind: DATA
400 # REF-NEXT: Name: bar
401 # REF-NEXT: Flags: [ ]
402 # REF-NEXT: Segment: 0
403 # REF-NEXT: Size: 4
404 # REF-NEXT: - Index: 10
405 # REF-NEXT: Kind: DATA
406 # REF-NEXT: Name: bar_alias
407 # REF-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN, NO_STRIP ]
408 # REF-NEXT: Segment: 0
409 # REF-NEXT: Size: 4
410 # REF-NEXT: SegmentInfo:
411 # REF-NEXT: - Index: 0
412 # REF-NEXT: Name: .data.bar
413 # REF-NEXT: Alignment: 3
414 # REF-NEXT: Flags: [ ]
415 # REF-NEXT: - Index: 1
416 # REF-NEXT: Name: .data.direct_address
417 # REF-NEXT: Alignment: 3
418 # REF-NEXT: Flags: [ ]
419 # REF-NEXT: - Index: 2
420 # REF-NEXT: Name: .data.alias_address
421 # REF-NEXT: Alignment: 3
422 # REF-NEXT: Flags: [ ]
423 # REF-NEXT: ...
425 # CHECK-SYMS: SYMBOL TABLE:
426 # CHECK-SYMS-NEXT: 00000001 g F CODE .hidden foo
427 # CHECK-SYMS-NEXT: 00000006 g F CODE .hidden call_direct
428 # CHECK-SYMS-NEXT: 0000000f g F CODE .hidden call_alias
429 # CHECK-SYMS-NEXT: 00000001 gw F CODE .hidden foo_alias
430 # CHECK-SYMS-NEXT: 00000018 g F CODE .hidden call_direct_ptr
431 # CHECK-SYMS-NEXT: 00000008 g O DATA direct_address
432 # CHECK-SYMS-NEXT: 0000002b g F CODE .hidden call_alias_ptr
433 # CHECK-SYMS-NEXT: 00000010 g O DATA alias_address
434 # CHECK-SYMS-NEXT: 00000000 g O DATA bar
435 # CHECK-SYMS-NEXT: 00000000 gw O DATA .hidden bar_alias