[AArch64][SME2] Add multi-vector saturating doubling multiply high intrinsics
[llvm-project.git] / lld / test / wasm / weak-alias.ll
blobcba39acda8e9c02d67e534f365b89164df12ba4a
1 ; RUN: llc -mcpu=mvp -filetype=obj -o %t.o %s
2 ; RUN: llc -mcpu=mvp -filetype=obj %S/Inputs/weak-alias.ll -o %t2.o
3 ; RUN: wasm-ld --export-dynamic %t.o %t2.o -o %t.wasm
4 ; RUN: obj2yaml %t.wasm | FileCheck %s
6 ; Test that weak aliases (alias_fn is a weak alias of direct_fn) are linked correctly
8 target triple = "wasm32-unknown-unknown"
10 declare i32 @alias_fn() local_unnamed_addr #1
12 ; Function Attrs: nounwind uwtable
13 define void @_start() local_unnamed_addr #1 {
14 entry:
15   %call = tail call i32 @alias_fn() #2
16   ret void
19 ; CHECK:      --- !WASM
20 ; CHECK-NEXT: FileHeader:
21 ; CHECK-NEXT:   Version:         0x1
22 ; CHECK-NEXT: Sections:
23 ; CHECK-NEXT:   - Type:            TYPE
24 ; CHECK-NEXT:     Signatures:
25 ; CHECK-NEXT:       - Index:           0
26 ; CHECK-NEXT:         ParamTypes:
27 ; CHECK-NEXT:         ReturnTypes:     []
28 ; CHECK-NEXT:       - Index:           1
29 ; CHECK-NEXT:         ParamTypes:      []
30 ; CHECK-NEXT:         ReturnTypes:
31 ; CHECK-NEXT:           - I32
32 ; CHECK-NEXT:   - Type:            FUNCTION
33 ; CHECK-NEXT:     FunctionTypes:   [ 0, 1, 1, 1, 1, 1 ]
34 ; CHECK-NEXT:   - Type:            TABLE
35 ; CHECK-NEXT:     Tables:
36 ; CHECK-NEXT:       - Index:           0
37 ; CHECK-NEXT:         ElemType:        FUNCREF
38 ; CHECK-NEXT:         Limits:
39 ; CHECK-NEXT:           Flags:           [ HAS_MAX ]
40 ; CHECK-NEXT:           Minimum:         0x2
41 ; CHECK-NEXT:           Maximum:         0x2
42 ; CHECK-NEXT:   - Type:            MEMORY
43 ; CHECK-NEXT:     Memories:
44 ; CHECK-NEXT:       - Minimum:         0x2
45 ; CHECK-NEXT:   - Type:            GLOBAL
46 ; CHECK-NEXT:     Globals:
47 ; CHECK-NEXT:       - Index:           0
48 ; CHECK-NEXT:         Type:            I32
49 ; CHECK-NEXT:         Mutable:         true
50 ; CHECK-NEXT:         InitExpr:
51 ; CHECK-NEXT:           Opcode:          I32_CONST
52 ; CHECK-NEXT:           Value:           66560
53 ; CHECK-NEXT:   - Type:            EXPORT
54 ; CHECK-NEXT:     Exports:
55 ; CHECK-NEXT:       - Name:            memory
56 ; CHECK-NEXT:         Kind:            MEMORY
57 ; CHECK-NEXT:         Index:           0
58 ; CHECK-NEXT:       - Name:            _start
59 ; CHECK-NEXT:         Kind:            FUNCTION
60 ; CHECK-NEXT:         Index:           0
61 ; CHECK-NEXT:       - Name:            alias_fn
62 ; CHECK-NEXT:         Kind:            FUNCTION
63 ; CHECK-NEXT:         Index:           1
64 ; CHECK-NEXT:       - Name:            direct_fn
65 ; CHECK-NEXT:         Kind:            FUNCTION
66 ; CHECK-NEXT:         Index:           1
67 ; CHECK-NEXT:       - Name:            call_direct
68 ; CHECK-NEXT:         Kind:            FUNCTION
69 ; CHECK-NEXT:         Index:           2
70 ; CHECK-NEXT:       - Name:            call_alias
71 ; CHECK-NEXT:         Kind:            FUNCTION
72 ; CHECK-NEXT:         Index:           3
73 ; CHECK-NEXT:       - Name:            call_alias_ptr
74 ; CHECK-NEXT:         Kind:            FUNCTION
75 ; CHECK-NEXT:         Index:           4
76 ; CHECK-NEXT:       - Name:            call_direct_ptr
77 ; CHECK-NEXT:         Kind:            FUNCTION
78 ; CHECK-NEXT:         Index:           5
79 ; CHECK-NEXT:   - Type:            ELEM
80 ; CHECK-NEXT:     Segments:
81 ; CHECK-NEXT:       - Offset:
82 ; CHECK-NEXT:           Opcode:          I32_CONST
83 ; CHECK-NEXT:           Value:           1
84 ; CHECK-NEXT:         Functions:       [ 1 ]
85 ; CHECK-NEXT:   - Type:            CODE
86 ; CHECK-NEXT:     Functions:
87 ; CHECK-NEXT:       - Index:           0
88 ; CHECK-NEXT:         Locals:
89 ; CHECK-NEXT:         Body:            1081808080001A0B
90 ; CHECK-NEXT:       - Index:           1
91 ; CHECK-NEXT:         Locals:
92 ; CHECK-NEXT:         Body:            41000B
93 ; CHECK-NEXT:       - Index:           2
94 ; CHECK-NEXT:         Locals:
95 ; CHECK-NEXT:         Body:            1081808080000B
96 ; CHECK-NEXT:       - Index:           3
97 ; CHECK-NEXT:         Locals:
98 ; CHECK-NEXT:         Body:            1081808080000B
99 ; CHECK-NEXT:       - Index:           4
100 ; CHECK-NEXT:         Locals:
101 ; CHECK-NEXT:           - Type:            I32
102 ; CHECK-NEXT:             Count:           2
103 ; CHECK-NEXT:         Body:            23808080800041106B220024808080800020004181808080003602081081808080002101200041106A24808080800020010B
104 ; CHECK-NEXT:       - Index:           5
105 ; CHECK-NEXT:         Locals:
106 ; CHECK-NEXT:           - Type:            I32
107 ; CHECK-NEXT:             Count:           2
108 ; CHECK-NEXT:         Body:            23808080800041106B220024808080800020004181808080003602081081808080002101200041106A24808080800020010B
109 ; CHECK-NEXT:   - Type:            CUSTOM
110 ; CHECK-NEXT:     Name:            name
111 ; CHECK-NEXT:     FunctionNames:
112 ; CHECK-NEXT:       - Index:           0
113 ; CHECK-NEXT:         Name:            _start
114 ; CHECK-NEXT:       - Index:           1
115 ; CHECK-NEXT:         Name:            direct_fn
116 ; CHECK-NEXT:       - Index:           2
117 ; CHECK-NEXT:         Name:            call_direct
118 ; CHECK-NEXT:       - Index:           3
119 ; CHECK-NEXT:         Name:            call_alias
120 ; CHECK-NEXT:       - Index:           4
121 ; CHECK-NEXT:         Name:            call_alias_ptr
122 ; CHECK-NEXT:       - Index:           5
123 ; CHECK-NEXT:         Name:            call_direct_ptr
124 ; CHECK-NEXT:     GlobalNames:
125 ; CHECK-NEXT:       - Index:           0
126 ; CHECK-NEXT:         Name:            __stack_pointer
127 ; CHECK-NEXT: ...
129 ; RUN: wasm-ld --relocatable %t.o %t2.o -o %t.reloc.o
130 ; RUN: obj2yaml %t.reloc.o | FileCheck %s -check-prefix=RELOC
132 ; RELOC:      --- !WASM
133 ; RELOC-NEXT: FileHeader:
134 ; RELOC-NEXT:   Version:         0x1
135 ; RELOC-NEXT: Sections:
136 ; RELOC-NEXT:   - Type:            TYPE
137 ; RELOC-NEXT:     Signatures:
138 ; RELOC-NEXT:       - Index:           0
139 ; RELOC-NEXT:         ParamTypes:      []
140 ; RELOC-NEXT:         ReturnTypes:     []
141 ; RELOC-NEXT:       - Index:           1
142 ; RELOC-NEXT:         ParamTypes:      []
143 ; RELOC-NEXT:         ReturnTypes:
144 ; RELOC-NEXT:           - I32
145 ; RELOC-NEXT:   - Type:            IMPORT
146 ; RELOC-NEXT:     Imports:
147 ; RELOC-NEXT:       - Module:          env
148 ; RELOC-NEXT:         Field:           __indirect_function_table
149 ; RELOC-NEXT:         Kind:            TABLE
150 ; RELOC-NEXT:         Table:
151 ; RELOC-NEXT:           Index:           0
152 ; RELOC-NEXT:           ElemType:        FUNCREF
153 ; RELOC-NEXT:           Limits:
154 ; RELOC-NEXT:             Minimum:         0x2
155 ; RELOC-NEXT:       - Module:          env
156 ; RELOC-NEXT:         Field:           __stack_pointer
157 ; RELOC-NEXT:         Kind:            GLOBAL
158 ; RELOC-NEXT:         GlobalType:      I32
159 ; RELOC-NEXT:         GlobalMutable:   true
160 ; RELOC-NEXT:   - Type:            FUNCTION
161 ; RELOC-NEXT:     FunctionTypes:   [ 0, 1, 1, 1, 1, 1 ]
162 ; RELOC-NEXT:   - Type:            MEMORY
163 ; RELOC-NEXT:     Memories:
164 ; RELOC-NEXT:       - Minimum:         0x0
165 ; RELOC-NEXT:   - Type:            ELEM
166 ; RELOC-NEXT:     Segments:
167 ; RELOC-NEXT:       - Offset:
168 ; RELOC-NEXT:           Opcode:          I32_CONST
169 ; RELOC-NEXT:           Value:           1
170 ; RELOC-NEXT:         Functions:       [ 1 ]
171 ; RELOC-NEXT:   - Type:            CODE
172 ; RELOC-NEXT:     Relocations:
173 ; RELOC-NEXT:       - Type:            R_WASM_FUNCTION_INDEX_LEB
174 ; RELOC-NEXT:         Index:           1
175 ; RELOC-NEXT:         Offset:          0x4
176 ; RELOC-NEXT:       - Type:            R_WASM_FUNCTION_INDEX_LEB
177 ; RELOC-NEXT:         Index:           2
178 ; RELOC-NEXT:         Offset:          0x13
179 ; RELOC-NEXT:       - Type:            R_WASM_FUNCTION_INDEX_LEB
180 ; RELOC-NEXT:         Index:           1
181 ; RELOC-NEXT:         Offset:          0x1C
182 ; RELOC-NEXT:       - Type:            R_WASM_GLOBAL_INDEX_LEB
183 ; RELOC-NEXT:         Index:           6
184 ; RELOC-NEXT:         Offset:          0x27
185 ; RELOC-NEXT:       - Type:            R_WASM_GLOBAL_INDEX_LEB
186 ; RELOC-NEXT:         Index:           6
187 ; RELOC-NEXT:         Offset:          0x32
188 ; RELOC-NEXT:       - Type:            R_WASM_TABLE_INDEX_SLEB
189 ; RELOC-NEXT:         Index:           1
190 ; RELOC-NEXT:         Offset:          0x3A
191 ; RELOC-NEXT:       - Type:            R_WASM_FUNCTION_INDEX_LEB
192 ; RELOC-NEXT:         Index:           1
193 ; RELOC-NEXT:         Offset:          0x43
194 ; RELOC-NEXT:       - Type:            R_WASM_GLOBAL_INDEX_LEB
195 ; RELOC-NEXT:         Index:           6
196 ; RELOC-NEXT:         Offset:          0x50
197 ; RELOC-NEXT:       - Type:            R_WASM_GLOBAL_INDEX_LEB
198 ; RELOC-NEXT:         Index:           6
199 ; RELOC-NEXT:         Offset:          0x5D
200 ; RELOC-NEXT:       - Type:            R_WASM_GLOBAL_INDEX_LEB
201 ; RELOC-NEXT:         Index:           6
202 ; RELOC-NEXT:         Offset:          0x68
203 ; RELOC-NEXT:       - Type:            R_WASM_TABLE_INDEX_SLEB
204 ; RELOC-NEXT:         Index:           2
205 ; RELOC-NEXT:         Offset:          0x70
206 ; RELOC-NEXT:       - Type:            R_WASM_FUNCTION_INDEX_LEB
207 ; RELOC-NEXT:         Index:           2
208 ; RELOC-NEXT:         Offset:          0x79
209 ; RELOC-NEXT:       - Type:            R_WASM_GLOBAL_INDEX_LEB
210 ; RELOC-NEXT:         Index:           6
211 ; RELOC-NEXT:         Offset:          0x86
212 ; RELOC-NEXT:     Functions:
213 ; RELOC-NEXT:       - Index:           0
214 ; RELOC-NEXT:         Locals:
215 ; RELOC-NEXT:         Body:            1081808080001A0B
216 ; RELOC-NEXT:       - Index:           1
217 ; RELOC-NEXT:         Locals:
218 ; RELOC-NEXT:         Body:            41000B
219 ; RELOC-NEXT:       - Index:           2
220 ; RELOC-NEXT:         Locals:
221 ; RELOC-NEXT:         Body:            1081808080000B
222 ; RELOC-NEXT:       - Index:           3
223 ; RELOC-NEXT:         Locals:
224 ; RELOC-NEXT:         Body:            1081808080000B
225 ; RELOC-NEXT:       - Index:           4
226 ; RELOC-NEXT:         Locals:
227 ; RELOC-NEXT:           - Type:            I32
228 ; RELOC-NEXT:             Count:           2
229 ; RELOC-NEXT:         Body:            23808080800041106B220024808080800020004181808080003602081081808080002101200041106A24808080800020010B
230 ; RELOC-NEXT:       - Index:           5
231 ; RELOC-NEXT:         Locals:
232 ; RELOC-NEXT:           - Type:            I32
233 ; RELOC-NEXT:             Count:           2
234 ; RELOC-NEXT:         Body:            23808080800041106B220024808080800020004181808080003602081081808080002101200041106A24808080800020010B
235 ; RELOC-NEXT:   - Type:            CUSTOM
236 ; RELOC-NEXT:     Name:            linking
237 ; RELOC-NEXT:     Version:         2
238 ; RELOC-NEXT:     SymbolTable:
239 ; RELOC-NEXT:       - Index:           0
240 ; RELOC-NEXT:         Kind:            FUNCTION
241 ; RELOC-NEXT:         Name:            _start
242 ; RELOC-NEXT:         Flags:           [  ]
243 ; RELOC-NEXT:         Function:        0
244 ; RELOC-NEXT:       - Index:           1
245 ; RELOC-NEXT:         Kind:            FUNCTION
246 ; RELOC-NEXT:         Name:            alias_fn
247 ; RELOC-NEXT:         Flags:           [ BINDING_WEAK ]
248 ; RELOC-NEXT:         Function:        1
249 ; RELOC-NEXT:       - Index:           2
250 ; RELOC-NEXT:         Kind:            FUNCTION
251 ; RELOC-NEXT:         Name:            direct_fn
252 ; RELOC-NEXT:         Flags:           [  ]
253 ; RELOC-NEXT:         Function:        1
254 ; RELOC-NEXT:       - Index:           3
255 ; RELOC-NEXT:         Kind:            FUNCTION
256 ; RELOC-NEXT:         Name:            call_direct
257 ; RELOC-NEXT:         Flags:           [  ]
258 ; RELOC-NEXT:         Function:        2
259 ; RELOC-NEXT:       - Index:           4
260 ; RELOC-NEXT:         Kind:            FUNCTION
261 ; RELOC-NEXT:         Name:            call_alias
262 ; RELOC-NEXT:         Flags:           [  ]
263 ; RELOC-NEXT:         Function:        3
264 ; RELOC-NEXT:       - Index:           5
265 ; RELOC-NEXT:         Kind:            FUNCTION
266 ; RELOC-NEXT:         Name:            call_alias_ptr
267 ; RELOC-NEXT:         Flags:           [  ]
268 ; RELOC-NEXT:         Function:        4
269 ; RELOC-NEXT:       - Index:           6
270 ; RELOC-NEXT:         Kind:            GLOBAL
271 ; RELOC-NEXT:         Name:            __stack_pointer
272 ; RELOC-NEXT:         Flags:           [ UNDEFINED ]
273 ; RELOC-NEXT:         Global:          0
274 ; RELOC-NEXT:       - Index:           7
275 ; RELOC-NEXT:         Kind:            FUNCTION
276 ; RELOC-NEXT:         Name:            call_direct_ptr
277 ; RELOC-NEXT:         Flags:           [  ]
278 ; RELOC-NEXT:         Function:        5
279 ; RELOC-NEXT:       - Index:           8
280 ; RELOC-NEXT:         Kind:            TABLE
281 ; RELOC-NEXT:         Name:            __indirect_function_table
282 ; RELOC-NEXT:         Flags:           [ UNDEFINED, NO_STRIP ]
283 ; RELOC-NEXT:         Table:           0
284 ; RELOC-NEXT:   - Type:            CUSTOM
285 ; RELOC-NEXT:     Name:            name
286 ; RELOC-NEXT:     FunctionNames:
287 ; RELOC-NEXT:       - Index:           0
288 ; RELOC-NEXT:         Name:            _start
289 ; RELOC-NEXT:       - Index:           1
290 ; RELOC-NEXT:         Name:            direct_fn
291 ; RELOC-NEXT:       - Index:           2
292 ; RELOC-NEXT:         Name:            call_direct
293 ; RELOC-NEXT:       - Index:           3
294 ; RELOC-NEXT:         Name:            call_alias
295 ; RELOC-NEXT:       - Index:           4
296 ; RELOC-NEXT:         Name:            call_alias_ptr
297 ; RELOC-NEXT:       - Index:           5
298 ; RELOC-NEXT:         Name:            call_direct_ptr
299 ; RELOC-NEXT:     GlobalNames:
300 ; RELOC-NEXT:       - Index:           0
301 ; RELOC-NEXT:         Name:            __stack_pointer
302 ; RELOC-NEXT: ...