Debian Codegraph @

js/src/jit-test/tests/wasm/spec/memory64/align64.wast.js

raw
1 /* Copyright 2021 Mozilla Foundation
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 // ./test/core/align64.wast
17
18 // ./test/core/align64.wast:3
19 let $0 = instantiate(`(module (memory i64 0) (func (drop (i32.load8_s align=1 (i64.const 0)))))`);
20
21 // ./test/core/align64.wast:4
22 let $1 = instantiate(`(module (memory i64 0) (func (drop (i32.load8_u align=1 (i64.const 0)))))`);
23
24 // ./test/core/align64.wast:5
25 let $2 = instantiate(`(module (memory i64 0) (func (drop (i32.load16_s align=2 (i64.const 0)))))`);
26
27 // ./test/core/align64.wast:6
28 let $3 = instantiate(`(module (memory i64 0) (func (drop (i32.load16_u align=2 (i64.const 0)))))`);
29
30 // ./test/core/align64.wast:7
31 let $4 = instantiate(`(module (memory i64 0) (func (drop (i32.load align=4 (i64.const 0)))))`);
32
33 // ./test/core/align64.wast:8
34 let $5 = instantiate(`(module (memory i64 0) (func (drop (i64.load8_s align=1 (i64.const 0)))))`);
35
36 // ./test/core/align64.wast:9
37 let $6 = instantiate(`(module (memory i64 0) (func (drop (i64.load8_u align=1 (i64.const 0)))))`);
38
39 // ./test/core/align64.wast:10
40 let $7 = instantiate(`(module (memory i64 0) (func (drop (i64.load16_s align=2 (i64.const 0)))))`);
41
42 // ./test/core/align64.wast:11
43 let $8 = instantiate(`(module (memory i64 0) (func (drop (i64.load16_u align=2 (i64.const 0)))))`);
44
45 // ./test/core/align64.wast:12
46 let $9 = instantiate(`(module (memory i64 0) (func (drop (i64.load32_s align=4 (i64.const 0)))))`);
47
48 // ./test/core/align64.wast:13
49 let $10 = instantiate(`(module (memory i64 0) (func (drop (i64.load32_u align=4 (i64.const 0)))))`);
50
51 // ./test/core/align64.wast:14
52 let $11 = instantiate(`(module (memory i64 0) (func (drop (i64.load align=8 (i64.const 0)))))`);
53
54 // ./test/core/align64.wast:15
55 let $12 = instantiate(`(module (memory i64 0) (func (drop (f32.load align=4 (i64.const 0)))))`);
56
57 // ./test/core/align64.wast:16
58 let $13 = instantiate(`(module (memory i64 0) (func (drop (f64.load align=8 (i64.const 0)))))`);
59
60 // ./test/core/align64.wast:17
61 let $14 = instantiate(`(module (memory i64 0) (func (i32.store8 align=1 (i64.const 0) (i32.const 1))))`);
62
63 // ./test/core/align64.wast:18
64 let $15 = instantiate(`(module (memory i64 0) (func (i32.store16 align=2 (i64.const 0) (i32.const 1))))`);
65
66 // ./test/core/align64.wast:19
67 let $16 = instantiate(`(module (memory i64 0) (func (i32.store align=4 (i64.const 0) (i32.const 1))))`);
68
69 // ./test/core/align64.wast:20
70 let $17 = instantiate(`(module (memory i64 0) (func (i64.store8 align=1 (i64.const 0) (i64.const 1))))`);
71
72 // ./test/core/align64.wast:21
73 let $18 = instantiate(`(module (memory i64 0) (func (i64.store16 align=2 (i64.const 0) (i64.const 1))))`);
74
75 // ./test/core/align64.wast:22
76 let $19 = instantiate(`(module (memory i64 0) (func (i64.store32 align=4 (i64.const 0) (i64.const 1))))`);
77
78 // ./test/core/align64.wast:23
79 let $20 = instantiate(`(module (memory i64 0) (func (i64.store align=8 (i64.const 0) (i64.const 1))))`);
80
81 // ./test/core/align64.wast:24
82 let $21 = instantiate(`(module (memory i64 0) (func (f32.store align=4 (i64.const 0) (f32.const 1.0))))`);
83
84 // ./test/core/align64.wast:25
85 let $22 = instantiate(`(module (memory i64 0) (func (f64.store align=8 (i64.const 0) (f64.const 1.0))))`);
86
87 // ./test/core/align64.wast:27
88 assert_malformed(
89 () => instantiate(`(module (memory i64 0) (func (drop (i32.load8_s align=0 (i64.const 0))))) `),
90 `alignment`,
91 );
92
93 // ./test/core/align64.wast:33
94 assert_malformed(
95 () => instantiate(`(module (memory i64 0) (func (drop (i32.load8_s align=7 (i64.const 0))))) `),
96 `alignment`,
97 );
98
99 // ./test/core/align64.wast:39
100 assert_malformed(
101 () => instantiate(`(module (memory i64 0) (func (drop (i32.load8_u align=0 (i64.const 0))))) `),
102 `alignment`,
103 );
104
105 // ./test/core/align64.wast:45
106 assert_malformed(
107 () => instantiate(`(module (memory i64 0) (func (drop (i32.load8_u align=7 (i64.const 0))))) `),
108 `alignment`,
109 );
110
111 // ./test/core/align64.wast:51
112 assert_malformed(
113 () => instantiate(`(module (memory i64 0) (func (drop (i32.load16_s align=0 (i64.const 0))))) `),
114 `alignment`,
115 );
116
117 // ./test/core/align64.wast:57
118 assert_malformed(
119 () => instantiate(`(module (memory i64 0) (func (drop (i32.load16_s align=7 (i64.const 0))))) `),
120 `alignment`,
121 );
122
123 // ./test/core/align64.wast:63
124 assert_malformed(
125 () => instantiate(`(module (memory i64 0) (func (drop (i32.load16_u align=0 (i64.const 0))))) `),
126 `alignment`,
127 );
128
129 // ./test/core/align64.wast:69
130 assert_malformed(
131 () => instantiate(`(module (memory i64 0) (func (drop (i32.load16_u align=7 (i64.const 0))))) `),
132 `alignment`,
133 );
134
135 // ./test/core/align64.wast:75
136 assert_malformed(
137 () => instantiate(`(module (memory i64 0) (func (drop (i32.load align=0 (i64.const 0))))) `),
138 `alignment`,
139 );
140
141 // ./test/core/align64.wast:81
142 assert_malformed(
143 () => instantiate(`(module (memory i64 0) (func (drop (i32.load align=7 (i64.const 0))))) `),
144 `alignment`,
145 );
146
147 // ./test/core/align64.wast:87
148 assert_malformed(
149 () => instantiate(`(module (memory i64 0) (func (drop (i64.load8_s align=0 (i64.const 0))))) `),
150 `alignment`,
151 );
152
153 // ./test/core/align64.wast:93
154 assert_malformed(
155 () => instantiate(`(module (memory i64 0) (func (drop (i64.load8_s align=7 (i64.const 0))))) `),
156 `alignment`,
157 );
158
159 // ./test/core/align64.wast:99
160 assert_malformed(
161 () => instantiate(`(module (memory i64 0) (func (drop (i64.load8_u align=0 (i64.const 0))))) `),
162 `alignment`,
163 );
164
165 // ./test/core/align64.wast:105
166 assert_malformed(
167 () => instantiate(`(module (memory i64 0) (func (drop (i64.load8_u align=7 (i64.const 0))))) `),
168 `alignment`,
169 );
170
171 // ./test/core/align64.wast:111
172 assert_malformed(
173 () => instantiate(`(module (memory i64 0) (func (drop (i64.load16_s align=0 (i64.const 0))))) `),
174 `alignment`,
175 );
176
177 // ./test/core/align64.wast:117
178 assert_malformed(
179 () => instantiate(`(module (memory i64 0) (func (drop (i64.load16_s align=7 (i64.const 0))))) `),
180 `alignment`,
181 );
182
183 // ./test/core/align64.wast:123
184 assert_malformed(
185 () => instantiate(`(module (memory i64 0) (func (drop (i64.load16_u align=0 (i64.const 0))))) `),
186 `alignment`,
187 );
188
189 // ./test/core/align64.wast:129
190 assert_malformed(
191 () => instantiate(`(module (memory i64 0) (func (drop (i64.load16_u align=7 (i64.const 0))))) `),
192 `alignment`,
193 );
194
195 // ./test/core/align64.wast:135
196 assert_malformed(
197 () => instantiate(`(module (memory i64 0) (func (drop (i64.load32_s align=0 (i64.const 0))))) `),
198 `alignment`,
199 );
200
201 // ./test/core/align64.wast:141
202 assert_malformed(
203 () => instantiate(`(module (memory i64 0) (func (drop (i64.load32_s align=7 (i64.const 0))))) `),
204 `alignment`,
205 );
206
207 // ./test/core/align64.wast:147
208 assert_malformed(
209 () => instantiate(`(module (memory i64 0) (func (drop (i64.load32_u align=0 (i64.const 0))))) `),
210 `alignment`,
211 );
212
213 // ./test/core/align64.wast:153
214 assert_malformed(
215 () => instantiate(`(module (memory i64 0) (func (drop (i64.load32_u align=7 (i64.const 0))))) `),
216 `alignment`,
217 );
218
219 // ./test/core/align64.wast:159
220 assert_malformed(
221 () => instantiate(`(module (memory i64 0) (func (drop (i64.load align=0 (i64.const 0))))) `),
222 `alignment`,
223 );
224
225 // ./test/core/align64.wast:165
226 assert_malformed(
227 () => instantiate(`(module (memory i64 0) (func (drop (i64.load align=7 (i64.const 0))))) `),
228 `alignment`,
229 );
230
231 // ./test/core/align64.wast:171
232 assert_malformed(
233 () => instantiate(`(module (memory i64 0) (func (drop (f32.load align=0 (i64.const 0))))) `),
234 `alignment`,
235 );
236
237 // ./test/core/align64.wast:177
238 assert_malformed(
239 () => instantiate(`(module (memory i64 0) (func (drop (f32.load align=7 (i64.const 0))))) `),
240 `alignment`,
241 );
242
243 // ./test/core/align64.wast:183
244 assert_malformed(
245 () => instantiate(`(module (memory i64 0) (func (drop (f64.load align=0 (i64.const 0))))) `),
246 `alignment`,
247 );
248
249 // ./test/core/align64.wast:189
250 assert_malformed(
251 () => instantiate(`(module (memory i64 0) (func (drop (f64.load align=7 (i64.const 0))))) `),
252 `alignment`,
253 );
254
255 // ./test/core/align64.wast:196
256 assert_malformed(
257 () => instantiate(`(module (memory i64 0) (func (i32.store8 align=0 (i64.const 0) (i32.const 0)))) `),
258 `alignment`,
259 );
260
261 // ./test/core/align64.wast:202
262 assert_malformed(
263 () => instantiate(`(module (memory i64 0) (func (i32.store8 align=7 (i64.const 0) (i32.const 0)))) `),
264 `alignment`,
265 );
266
267 // ./test/core/align64.wast:208
268 assert_malformed(
269 () => instantiate(`(module (memory i64 0) (func (i32.store16 align=0 (i64.const 0) (i32.const 0)))) `),
270 `alignment`,
271 );
272
273 // ./test/core/align64.wast:214
274 assert_malformed(
275 () => instantiate(`(module (memory i64 0) (func (i32.store16 align=7 (i64.const 0) (i32.const 0)))) `),
276 `alignment`,
277 );
278
279 // ./test/core/align64.wast:220
280 assert_malformed(
281 () => instantiate(`(module (memory i64 0) (func (i32.store align=0 (i64.const 0) (i32.const 0)))) `),
282 `alignment`,
283 );
284
285 // ./test/core/align64.wast:226
286 assert_malformed(
287 () => instantiate(`(module (memory i64 0) (func (i32.store align=7 (i64.const 0) (i32.const 0)))) `),
288 `alignment`,
289 );
290
291 // ./test/core/align64.wast:232
292 assert_malformed(
293 () => instantiate(`(module (memory i64 0) (func (i64.store8 align=0 (i64.const 0) (i64.const 0)))) `),
294 `alignment`,
295 );
296
297 // ./test/core/align64.wast:238
298 assert_malformed(
299 () => instantiate(`(module (memory i64 0) (func (i64.store8 align=7 (i64.const 0) (i64.const 0)))) `),
300 `alignment`,
301 );
302
303 // ./test/core/align64.wast:244
304 assert_malformed(
305 () => instantiate(`(module (memory i64 0) (func (i64.store16 align=0 (i64.const 0) (i64.const 0)))) `),
306 `alignment`,
307 );
308
309 // ./test/core/align64.wast:250
310 assert_malformed(
311 () => instantiate(`(module (memory i64 0) (func (i64.store16 align=7 (i64.const 0) (i64.const 0)))) `),
312 `alignment`,
313 );
314
315 // ./test/core/align64.wast:256
316 assert_malformed(
317 () => instantiate(`(module (memory i64 0) (func (i64.store32 align=0 (i64.const 0) (i64.const 0)))) `),
318 `alignment`,
319 );
320
321 // ./test/core/align64.wast:262
322 assert_malformed(
323 () => instantiate(`(module (memory i64 0) (func (i64.store32 align=7 (i64.const 0) (i64.const 0)))) `),
324 `alignment`,
325 );
326
327 // ./test/core/align64.wast:268
328 assert_malformed(
329 () => instantiate(`(module (memory i64 0) (func (i64.store align=0 (i64.const 0) (i64.const 0)))) `),
330 `alignment`,
331 );
332
333 // ./test/core/align64.wast:274
334 assert_malformed(
335 () => instantiate(`(module (memory i64 0) (func (i64.store align=7 (i64.const 0) (i64.const 0)))) `),
336 `alignment`,
337 );
338
339 // ./test/core/align64.wast:280
340 assert_malformed(
341 () => instantiate(`(module (memory i64 0) (func (f32.store align=0 (i64.const 0) (f32.const 0)))) `),
342 `alignment`,
343 );
344
345 // ./test/core/align64.wast:286
346 assert_malformed(
347 () => instantiate(`(module (memory i64 0) (func (f32.store align=7 (i64.const 0) (f32.const 0)))) `),
348 `alignment`,
349 );
350
351 // ./test/core/align64.wast:292
352 assert_malformed(
353 () => instantiate(`(module (memory i64 0) (func (f64.store align=0 (i64.const 0) (f32.const 0)))) `),
354 `alignment`,
355 );
356
357 // ./test/core/align64.wast:298
358 assert_malformed(
359 () => instantiate(`(module (memory i64 0) (func (f64.store align=7 (i64.const 0) (f32.const 0)))) `),
360 `alignment`,
361 );
362
363 // ./test/core/align64.wast:305
364 assert_invalid(
365 () => instantiate(`(module (memory i64 0) (func (drop (i32.load8_s align=2 (i64.const 0)))))`),
366 `alignment must not be larger than natural`,
367 );
368
369 // ./test/core/align64.wast:309
370 assert_invalid(
371 () => instantiate(`(module (memory i64 0) (func (drop (i32.load8_u align=2 (i64.const 0)))))`),
372 `alignment must not be larger than natural`,
373 );
374
375 // ./test/core/align64.wast:313
376 assert_invalid(
377 () => instantiate(`(module (memory i64 0) (func (drop (i32.load16_s align=4 (i64.const 0)))))`),
378 `alignment must not be larger than natural`,
379 );
380
381 // ./test/core/align64.wast:317
382 assert_invalid(
383 () => instantiate(`(module (memory i64 0) (func (drop (i32.load16_u align=4 (i64.const 0)))))`),
384 `alignment must not be larger than natural`,
385 );
386
387 // ./test/core/align64.wast:321
388 assert_invalid(
389 () => instantiate(`(module (memory i64 0) (func (drop (i32.load align=8 (i64.const 0)))))`),
390 `alignment must not be larger than natural`,
391 );
392
393 // ./test/core/align64.wast:325
394 assert_invalid(
395 () => instantiate(`(module (memory i64 0) (func (drop (i64.load8_s align=2 (i64.const 0)))))`),
396 `alignment must not be larger than natural`,
397 );
398
399 // ./test/core/align64.wast:329
400 assert_invalid(
401 () => instantiate(`(module (memory i64 0) (func (drop (i64.load8_u align=2 (i64.const 0)))))`),
402 `alignment must not be larger than natural`,
403 );
404
405 // ./test/core/align64.wast:333
406 assert_invalid(
407 () => instantiate(`(module (memory i64 0) (func (drop (i64.load16_s align=4 (i64.const 0)))))`),
408 `alignment must not be larger than natural`,
409 );
410
411 // ./test/core/align64.wast:337
412 assert_invalid(
413 () => instantiate(`(module (memory i64 0) (func (drop (i64.load16_u align=4 (i64.const 0)))))`),
414 `alignment must not be larger than natural`,
415 );
416
417 // ./test/core/align64.wast:341
418 assert_invalid(
419 () => instantiate(`(module (memory i64 0) (func (drop (i64.load32_s align=8 (i64.const 0)))))`),
420 `alignment must not be larger than natural`,
421 );
422
423 // ./test/core/align64.wast:345
424 assert_invalid(
425 () => instantiate(`(module (memory i64 0) (func (drop (i64.load32_u align=8 (i64.const 0)))))`),
426 `alignment must not be larger than natural`,
427 );
428
429 // ./test/core/align64.wast:349
430 assert_invalid(
431 () => instantiate(`(module (memory i64 0) (func (drop (i64.load align=16 (i64.const 0)))))`),
432 `alignment must not be larger than natural`,
433 );
434
435 // ./test/core/align64.wast:353
436 assert_invalid(
437 () => instantiate(`(module (memory i64 0) (func (drop (f32.load align=8 (i64.const 0)))))`),
438 `alignment must not be larger than natural`,
439 );
440
441 // ./test/core/align64.wast:357
442 assert_invalid(
443 () => instantiate(`(module (memory i64 0) (func (drop (f64.load align=16 (i64.const 0)))))`),
444 `alignment must not be larger than natural`,
445 );
446
447 // ./test/core/align64.wast:362
448 assert_invalid(
449 () => instantiate(`(module (memory i64 0) (func (drop (i32.load8_s align=2 (i64.const 0)))))`),
450 `alignment must not be larger than natural`,
451 );
452
453 // ./test/core/align64.wast:366
454 assert_invalid(
455 () => instantiate(`(module (memory i64 0) (func (drop (i32.load8_u align=2 (i64.const 0)))))`),
456 `alignment must not be larger than natural`,
457 );
458
459 // ./test/core/align64.wast:370
460 assert_invalid(
461 () => instantiate(`(module (memory i64 0) (func (drop (i32.load16_s align=4 (i64.const 0)))))`),
462 `alignment must not be larger than natural`,
463 );
464
465 // ./test/core/align64.wast:374
466 assert_invalid(
467 () => instantiate(`(module (memory i64 0) (func (drop (i32.load16_u align=4 (i64.const 0)))))`),
468 `alignment must not be larger than natural`,
469 );
470
471 // ./test/core/align64.wast:378
472 assert_invalid(
473 () => instantiate(`(module (memory i64 0) (func (drop (i32.load align=8 (i64.const 0)))))`),
474 `alignment must not be larger than natural`,
475 );
476
477 // ./test/core/align64.wast:382
478 assert_invalid(
479 () => instantiate(`(module (memory i64 0) (func (drop (i64.load8_s align=2 (i64.const 0)))))`),
480 `alignment must not be larger than natural`,
481 );
482
483 // ./test/core/align64.wast:386
484 assert_invalid(
485 () => instantiate(`(module (memory i64 0) (func (drop (i64.load8_u align=2 (i64.const 0)))))`),
486 `alignment must not be larger than natural`,
487 );
488
489 // ./test/core/align64.wast:390
490 assert_invalid(
491 () => instantiate(`(module (memory i64 0) (func (drop (i64.load16_s align=4 (i64.const 0)))))`),
492 `alignment must not be larger than natural`,
493 );
494
495 // ./test/core/align64.wast:394
496 assert_invalid(
497 () => instantiate(`(module (memory i64 0) (func (drop (i64.load16_u align=4 (i64.const 0)))))`),
498 `alignment must not be larger than natural`,
499 );
500
501 // ./test/core/align64.wast:398
502 assert_invalid(
503 () => instantiate(`(module (memory i64 0) (func (drop (i64.load32_s align=8 (i64.const 0)))))`),
504 `alignment must not be larger than natural`,
505 );
506
507 // ./test/core/align64.wast:402
508 assert_invalid(
509 () => instantiate(`(module (memory i64 0) (func (drop (i64.load32_u align=8 (i64.const 0)))))`),
510 `alignment must not be larger than natural`,
511 );
512
513 // ./test/core/align64.wast:406
514 assert_invalid(
515 () => instantiate(`(module (memory i64 0) (func (drop (i64.load align=16 (i64.const 0)))))`),
516 `alignment must not be larger than natural`,
517 );
518
519 // ./test/core/align64.wast:410
520 assert_invalid(
521 () => instantiate(`(module (memory i64 0) (func (drop (f32.load align=8 (i64.const 0)))))`),
522 `alignment must not be larger than natural`,
523 );
524
525 // ./test/core/align64.wast:414
526 assert_invalid(
527 () => instantiate(`(module (memory i64 0) (func (drop (f64.load align=16 (i64.const 0)))))`),
528 `alignment must not be larger than natural`,
529 );
530
531 // ./test/core/align64.wast:419
532 assert_invalid(
533 () => instantiate(`(module (memory i64 0) (func (i32.store8 align=2 (i64.const 0) (i32.const 0))))`),
534 `alignment must not be larger than natural`,
535 );
536
537 // ./test/core/align64.wast:423
538 assert_invalid(
539 () => instantiate(`(module (memory i64 0) (func (i32.store16 align=4 (i64.const 0) (i32.const 0))))`),
540 `alignment must not be larger than natural`,
541 );
542
543 // ./test/core/align64.wast:427
544 assert_invalid(
545 () => instantiate(`(module (memory i64 0) (func (i32.store align=8 (i64.const 0) (i32.const 0))))`),
546 `alignment must not be larger than natural`,
547 );
548
549 // ./test/core/align64.wast:431
550 assert_invalid(
551 () => instantiate(`(module (memory i64 0) (func (i64.store8 align=2 (i64.const 0) (i64.const 0))))`),
552 `alignment must not be larger than natural`,
553 );
554
555 // ./test/core/align64.wast:435
556 assert_invalid(
557 () => instantiate(`(module (memory i64 0) (func (i64.store16 align=4 (i64.const 0) (i64.const 0))))`),
558 `alignment must not be larger than natural`,
559 );
560
561 // ./test/core/align64.wast:439
562 assert_invalid(
563 () => instantiate(`(module (memory i64 0) (func (i64.store32 align=8 (i64.const 0) (i64.const 0))))`),
564 `alignment must not be larger than natural`,
565 );
566
567 // ./test/core/align64.wast:443
568 assert_invalid(
569 () => instantiate(`(module (memory i64 0) (func (i64.store align=16 (i64.const 0) (i64.const 0))))`),
570 `alignment must not be larger than natural`,
571 );
572
573 // ./test/core/align64.wast:447
574 assert_invalid(
575 () => instantiate(`(module (memory i64 0) (func (f32.store align=8 (i64.const 0) (f32.const 0))))`),
576 `alignment must not be larger than natural`,
577 );
578
579 // ./test/core/align64.wast:451
580 assert_invalid(
581 () => instantiate(`(module (memory i64 0) (func (f64.store align=16 (i64.const 0) (f64.const 0))))`),
582 `alignment must not be larger than natural`,
583 );
584
585 // ./test/core/align64.wast:458
586 let $23 = instantiate(`(module
587 (memory i64 1)
588
589 ;; $$default: natural alignment, $$1: align=1, $$2: align=2, $$4: align=4, $$8: align=8
590
591 (func (export "f32_align_switch") (param i32) (result f32)
592 (local f32 f32)
593 (local.set 1 (f32.const 10.0))
594 (block $$4
595 (block $$2
596 (block $$1
597 (block $$default
598 (block $$0
599 (br_table $$0 $$default $$1 $$2 $$4 (local.get 0))
600 ) ;; 0
601 (f32.store (i64.const 0) (local.get 1))
602 (local.set 2 (f32.load (i64.const 0)))
603 (br $$4)
604 ) ;; default
605 (f32.store align=1 (i64.const 0) (local.get 1))
606 (local.set 2 (f32.load align=1 (i64.const 0)))
607 (br $$4)
608 ) ;; 1
609 (f32.store align=2 (i64.const 0) (local.get 1))
610 (local.set 2 (f32.load align=2 (i64.const 0)))
611 (br $$4)
612 ) ;; 2
613 (f32.store align=4 (i64.const 0) (local.get 1))
614 (local.set 2 (f32.load align=4 (i64.const 0)))
615 ) ;; 4
616 (local.get 2)
617 )
618
619 (func (export "f64_align_switch") (param i32) (result f64)
620 (local f64 f64)
621 (local.set 1 (f64.const 10.0))
622 (block $$8
623 (block $$4
624 (block $$2
625 (block $$1
626 (block $$default
627 (block $$0
628 (br_table $$0 $$default $$1 $$2 $$4 $$8 (local.get 0))
629 ) ;; 0
630 (f64.store (i64.const 0) (local.get 1))
631 (local.set 2 (f64.load (i64.const 0)))
632 (br $$8)
633 ) ;; default
634 (f64.store align=1 (i64.const 0) (local.get 1))
635 (local.set 2 (f64.load align=1 (i64.const 0)))
636 (br $$8)
637 ) ;; 1
638 (f64.store align=2 (i64.const 0) (local.get 1))
639 (local.set 2 (f64.load align=2 (i64.const 0)))
640 (br $$8)
641 ) ;; 2
642 (f64.store align=4 (i64.const 0) (local.get 1))
643 (local.set 2 (f64.load align=4 (i64.const 0)))
644 (br $$8)
645 ) ;; 4
646 (f64.store align=8 (i64.const 0) (local.get 1))
647 (local.set 2 (f64.load align=8 (i64.const 0)))
648 ) ;; 8
649 (local.get 2)
650 )
651
652 ;; $$8s: i32/i64.load8_s, $$8u: i32/i64.load8_u, $$16s: i32/i64.load16_s, $$16u: i32/i64.load16_u, $$32: i32.load
653 ;; $$32s: i64.load32_s, $$32u: i64.load32_u, $$64: i64.load
654
655 (func (export "i32_align_switch") (param i32 i32) (result i32)
656 (local i32 i32)
657 (local.set 2 (i32.const 10))
658 (block $$32
659 (block $$16u
660 (block $$16s
661 (block $$8u
662 (block $$8s
663 (block $$0
664 (br_table $$0 $$8s $$8u $$16s $$16u $$32 (local.get 0))
665 ) ;; 0
666 (if (i32.eq (local.get 1) (i32.const 0))
667 (then
668 (i32.store8 (i64.const 0) (local.get 2))
669 (local.set 3 (i32.load8_s (i64.const 0)))
670 )
671 )
672 (if (i32.eq (local.get 1) (i32.const 1))
673 (then
674 (i32.store8 align=1 (i64.const 0) (local.get 2))
675 (local.set 3 (i32.load8_s align=1 (i64.const 0)))
676 )
677 )
678 (br $$32)
679 ) ;; 8s
680 (if (i32.eq (local.get 1) (i32.const 0))
681 (then
682 (i32.store8 (i64.const 0) (local.get 2))
683 (local.set 3 (i32.load8_u (i64.const 0)))
684 )
685 )
686 (if (i32.eq (local.get 1) (i32.const 1))
687 (then
688 (i32.store8 align=1 (i64.const 0) (local.get 2))
689 (local.set 3 (i32.load8_u align=1 (i64.const 0)))
690 )
691 )
692 (br $$32)
693 ) ;; 8u
694 (if (i32.eq (local.get 1) (i32.const 0))
695 (then
696 (i32.store16 (i64.const 0) (local.get 2))
697 (local.set 3 (i32.load16_s (i64.const 0)))
698 )
699 )
700 (if (i32.eq (local.get 1) (i32.const 1))
701 (then
702 (i32.store16 align=1 (i64.const 0) (local.get 2))
703 (local.set 3 (i32.load16_s align=1 (i64.const 0)))
704 )
705 )
706 (if (i32.eq (local.get 1) (i32.const 2))
707 (then
708 (i32.store16 align=2 (i64.const 0) (local.get 2))
709 (local.set 3 (i32.load16_s align=2 (i64.const 0)))
710 )
711 )
712 (br $$32)
713 ) ;; 16s
714 (if (i32.eq (local.get 1) (i32.const 0))
715 (then
716 (i32.store16 (i64.const 0) (local.get 2))
717 (local.set 3 (i32.load16_u (i64.const 0)))
718 )
719 )
720 (if (i32.eq (local.get 1) (i32.const 1))
721 (then
722 (i32.store16 align=1 (i64.const 0) (local.get 2))
723 (local.set 3 (i32.load16_u align=1 (i64.const 0)))
724 )
725 )
726 (if (i32.eq (local.get 1) (i32.const 2))
727 (then
728 (i32.store16 align=2 (i64.const 0) (local.get 2))
729 (local.set 3 (i32.load16_u align=2 (i64.const 0)))
730 )
731 )
732 (br $$32)
733 ) ;; 16u
734 (if (i32.eq (local.get 1) (i32.const 0))
735 (then
736 (i32.store (i64.const 0) (local.get 2))
737 (local.set 3 (i32.load (i64.const 0)))
738 )
739 )
740 (if (i32.eq (local.get 1) (i32.const 1))
741 (then
742 (i32.store align=1 (i64.const 0) (local.get 2))
743 (local.set 3 (i32.load align=1 (i64.const 0)))
744 )
745 )
746 (if (i32.eq (local.get 1) (i32.const 2))
747 (then
748 (i32.store align=2 (i64.const 0) (local.get 2))
749 (local.set 3 (i32.load align=2 (i64.const 0)))
750 )
751 )
752 (if (i32.eq (local.get 1) (i32.const 4))
753 (then
754 (i32.store align=4 (i64.const 0) (local.get 2))
755 (local.set 3 (i32.load align=4 (i64.const 0)))
756 )
757 )
758 ) ;; 32
759 (local.get 3)
760 )
761
762 (func (export "i64_align_switch") (param i32 i32) (result i64)
763 (local i64 i64)
764 (local.set 2 (i64.const 10))
765 (block $$64
766 (block $$32u
767 (block $$32s
768 (block $$16u
769 (block $$16s
770 (block $$8u
771 (block $$8s
772 (block $$0
773 (br_table $$0 $$8s $$8u $$16s $$16u $$32s $$32u $$64 (local.get 0))
774 ) ;; 0
775 (if (i32.eq (local.get 1) (i32.const 0))
776 (then
777 (i64.store8 (i64.const 0) (local.get 2))
778 (local.set 3 (i64.load8_s (i64.const 0)))
779 )
780 )
781 (if (i32.eq (local.get 1) (i32.const 1))
782 (then
783 (i64.store8 align=1 (i64.const 0) (local.get 2))
784 (local.set 3 (i64.load8_s align=1 (i64.const 0)))
785 )
786 )
787 (br $$64)
788 ) ;; 8s
789 (if (i32.eq (local.get 1) (i32.const 0))
790 (then
791 (i64.store8 (i64.const 0) (local.get 2))
792 (local.set 3 (i64.load8_u (i64.const 0)))
793 )
794 )
795 (if (i32.eq (local.get 1) (i32.const 1))
796 (then
797 (i64.store8 align=1 (i64.const 0) (local.get 2))
798 (local.set 3 (i64.load8_u align=1 (i64.const 0)))
799 )
800 )
801 (br $$64)
802 ) ;; 8u
803 (if (i32.eq (local.get 1) (i32.const 0))
804 (then
805 (i64.store16 (i64.const 0) (local.get 2))
806 (local.set 3 (i64.load16_s (i64.const 0)))
807 )
808 )
809 (if (i32.eq (local.get 1) (i32.const 1))
810 (then
811 (i64.store16 align=1 (i64.const 0) (local.get 2))
812 (local.set 3 (i64.load16_s align=1 (i64.const 0)))
813 )
814 )
815 (if (i32.eq (local.get 1) (i32.const 2))
816 (then
817 (i64.store16 align=2 (i64.const 0) (local.get 2))
818 (local.set 3 (i64.load16_s align=2 (i64.const 0)))
819 )
820 )
821 (br $$64)
822 ) ;; 16s
823 (if (i32.eq (local.get 1) (i32.const 0))
824 (then
825 (i64.store16 (i64.const 0) (local.get 2))
826 (local.set 3 (i64.load16_u (i64.const 0)))
827 )
828 )
829 (if (i32.eq (local.get 1) (i32.const 1))
830 (then
831 (i64.store16 align=1 (i64.const 0) (local.get 2))
832 (local.set 3 (i64.load16_u align=1 (i64.const 0)))
833 )
834 )
835 (if (i32.eq (local.get 1) (i32.const 2))
836 (then
837 (i64.store16 align=2 (i64.const 0) (local.get 2))
838 (local.set 3 (i64.load16_u align=2 (i64.const 0)))
839 )
840 )
841 (br $$64)
842 ) ;; 16u
843 (if (i32.eq (local.get 1) (i32.const 0))
844 (then
845 (i64.store32 (i64.const 0) (local.get 2))
846 (local.set 3 (i64.load32_s (i64.const 0)))
847 )
848 )
849 (if (i32.eq (local.get 1) (i32.const 1))
850 (then
851 (i64.store32 align=1 (i64.const 0) (local.get 2))
852 (local.set 3 (i64.load32_s align=1 (i64.const 0)))
853 )
854 )
855 (if (i32.eq (local.get 1) (i32.const 2))
856 (then
857 (i64.store32 align=2 (i64.const 0) (local.get 2))
858 (local.set 3 (i64.load32_s align=2 (i64.const 0)))
859 )
860 )
861 (if (i32.eq (local.get 1) (i32.const 4))
862 (then
863 (i64.store32 align=4 (i64.const 0) (local.get 2))
864 (local.set 3 (i64.load32_s align=4 (i64.const 0)))
865 )
866 )
867 (br $$64)
868 ) ;; 32s
869 (if (i32.eq (local.get 1) (i32.const 0))
870 (then
871 (i64.store32 (i64.const 0) (local.get 2))
872 (local.set 3 (i64.load32_u (i64.const 0)))
873 )
874 )
875 (if (i32.eq (local.get 1) (i32.const 1))
876 (then
877 (i64.store32 align=1 (i64.const 0) (local.get 2))
878 (local.set 3 (i64.load32_u align=1 (i64.const 0)))
879 )
880 )
881 (if (i32.eq (local.get 1) (i32.const 2))
882 (then
883 (i64.store32 align=2 (i64.const 0) (local.get 2))
884 (local.set 3 (i64.load32_u align=2 (i64.const 0)))
885 )
886 )
887 (if (i32.eq (local.get 1) (i32.const 4))
888 (then
889 (i64.store32 align=4 (i64.const 0) (local.get 2))
890 (local.set 3 (i64.load32_u align=4 (i64.const 0)))
891 )
892 )
893 (br $$64)
894 ) ;; 32u
895 (if (i32.eq (local.get 1) (i32.const 0))
896 (then
897 (i64.store (i64.const 0) (local.get 2))
898 (local.set 3 (i64.load (i64.const 0)))
899 )
900 )
901 (if (i32.eq (local.get 1) (i32.const 1))
902 (then
903 (i64.store align=1 (i64.const 0) (local.get 2))
904 (local.set 3 (i64.load align=1 (i64.const 0)))
905 )
906 )
907 (if (i32.eq (local.get 1) (i32.const 2))
908 (then
909 (i64.store align=2 (i64.const 0) (local.get 2))
910 (local.set 3 (i64.load align=2 (i64.const 0)))
911 )
912 )
913 (if (i32.eq (local.get 1) (i32.const 4))
914 (then
915 (i64.store align=4 (i64.const 0) (local.get 2))
916 (local.set 3 (i64.load align=4 (i64.const 0)))
917 )
918 )
919 (if (i32.eq (local.get 1) (i32.const 8))
920 (then
921 (i64.store align=8 (i64.const 0) (local.get 2))
922 (local.set 3 (i64.load align=8 (i64.const 0)))
923 )
924 )
925 ) ;; 64
926 (local.get 3)
927 )
928 )`);
929
930 // ./test/core/align64.wast:802
931 assert_return(() => invoke($23, `f32_align_switch`, [0]), [value("f32", 10)]);
932
933 // ./test/core/align64.wast:803
934 assert_return(() => invoke($23, `f32_align_switch`, [1]), [value("f32", 10)]);
935
936 // ./test/core/align64.wast:804
937 assert_return(() => invoke($23, `f32_align_switch`, [2]), [value("f32", 10)]);
938
939 // ./test/core/align64.wast:805
940 assert_return(() => invoke($23, `f32_align_switch`, [3]), [value("f32", 10)]);
941
942 // ./test/core/align64.wast:807
943 assert_return(() => invoke($23, `f64_align_switch`, [0]), [value("f64", 10)]);
944
945 // ./test/core/align64.wast:808
946 assert_return(() => invoke($23, `f64_align_switch`, [1]), [value("f64", 10)]);
947
948 // ./test/core/align64.wast:809
949 assert_return(() => invoke($23, `f64_align_switch`, [2]), [value("f64", 10)]);
950
951 // ./test/core/align64.wast:810
952 assert_return(() => invoke($23, `f64_align_switch`, [3]), [value("f64", 10)]);
953
954 // ./test/core/align64.wast:811
955 assert_return(() => invoke($23, `f64_align_switch`, [4]), [value("f64", 10)]);
956
957 // ./test/core/align64.wast:813
958 assert_return(() => invoke($23, `i32_align_switch`, [0, 0]), [value("i32", 10)]);
959
960 // ./test/core/align64.wast:814
961 assert_return(() => invoke($23, `i32_align_switch`, [0, 1]), [value("i32", 10)]);
962
963 // ./test/core/align64.wast:815
964 assert_return(() => invoke($23, `i32_align_switch`, [1, 0]), [value("i32", 10)]);
965
966 // ./test/core/align64.wast:816
967 assert_return(() => invoke($23, `i32_align_switch`, [1, 1]), [value("i32", 10)]);
968
969 // ./test/core/align64.wast:817
970 assert_return(() => invoke($23, `i32_align_switch`, [2, 0]), [value("i32", 10)]);
971
972 // ./test/core/align64.wast:818
973 assert_return(() => invoke($23, `i32_align_switch`, [2, 1]), [value("i32", 10)]);
974
975 // ./test/core/align64.wast:819
976 assert_return(() => invoke($23, `i32_align_switch`, [2, 2]), [value("i32", 10)]);
977
978 // ./test/core/align64.wast:820
979 assert_return(() => invoke($23, `i32_align_switch`, [3, 0]), [value("i32", 10)]);
980
981 // ./test/core/align64.wast:821
982 assert_return(() => invoke($23, `i32_align_switch`, [3, 1]), [value("i32", 10)]);
983
984 // ./test/core/align64.wast:822
985 assert_return(() => invoke($23, `i32_align_switch`, [3, 2]), [value("i32", 10)]);
986
987 // ./test/core/align64.wast:823
988 assert_return(() => invoke($23, `i32_align_switch`, [4, 0]), [value("i32", 10)]);
989
990 // ./test/core/align64.wast:824
991 assert_return(() => invoke($23, `i32_align_switch`, [4, 1]), [value("i32", 10)]);
992
993 // ./test/core/align64.wast:825
994 assert_return(() => invoke($23, `i32_align_switch`, [4, 2]), [value("i32", 10)]);
995
996 // ./test/core/align64.wast:826
997 assert_return(() => invoke($23, `i32_align_switch`, [4, 4]), [value("i32", 10)]);
998
999 // ./test/core/align64.wast:828
1000 assert_return(() => invoke($23, `i64_align_switch`, [0, 0]), [value("i64", 10n)]);
1001
1002 // ./test/core/align64.wast:829
1003 assert_return(() => invoke($23, `i64_align_switch`, [0, 1]), [value("i64", 10n)]);
1004
1005 // ./test/core/align64.wast:830
1006 assert_return(() => invoke($23, `i64_align_switch`, [1, 0]), [value("i64", 10n)]);
1007
1008 // ./test/core/align64.wast:831
1009 assert_return(() => invoke($23, `i64_align_switch`, [1, 1]), [value("i64", 10n)]);
1010
1011 // ./test/core/align64.wast:832
1012 assert_return(() => invoke($23, `i64_align_switch`, [2, 0]), [value("i64", 10n)]);
1013
1014 // ./test/core/align64.wast:833
1015 assert_return(() => invoke($23, `i64_align_switch`, [2, 1]), [value("i64", 10n)]);
1016
1017 // ./test/core/align64.wast:834
1018 assert_return(() => invoke($23, `i64_align_switch`, [2, 2]), [value("i64", 10n)]);
1019
1020 // ./test/core/align64.wast:835
1021 assert_return(() => invoke($23, `i64_align_switch`, [3, 0]), [value("i64", 10n)]);
1022
1023 // ./test/core/align64.wast:836
1024 assert_return(() => invoke($23, `i64_align_switch`, [3, 1]), [value("i64", 10n)]);
1025
1026 // ./test/core/align64.wast:837
1027 assert_return(() => invoke($23, `i64_align_switch`, [3, 2]), [value("i64", 10n)]);
1028
1029 // ./test/core/align64.wast:838
1030 assert_return(() => invoke($23, `i64_align_switch`, [4, 0]), [value("i64", 10n)]);
1031
1032 // ./test/core/align64.wast:839
1033 assert_return(() => invoke($23, `i64_align_switch`, [4, 1]), [value("i64", 10n)]);
1034
1035 // ./test/core/align64.wast:840
1036 assert_return(() => invoke($23, `i64_align_switch`, [4, 2]), [value("i64", 10n)]);
1037
1038 // ./test/core/align64.wast:841
1039 assert_return(() => invoke($23, `i64_align_switch`, [4, 4]), [value("i64", 10n)]);
1040
1041 // ./test/core/align64.wast:842
1042 assert_return(() => invoke($23, `i64_align_switch`, [5, 0]), [value("i64", 10n)]);
1043
1044 // ./test/core/align64.wast:843
1045 assert_return(() => invoke($23, `i64_align_switch`, [5, 1]), [value("i64", 10n)]);
1046
1047 // ./test/core/align64.wast:844
1048 assert_return(() => invoke($23, `i64_align_switch`, [5, 2]), [value("i64", 10n)]);
1049
1050 // ./test/core/align64.wast:845
1051 assert_return(() => invoke($23, `i64_align_switch`, [5, 4]), [value("i64", 10n)]);
1052
1053 // ./test/core/align64.wast:846
1054 assert_return(() => invoke($23, `i64_align_switch`, [6, 0]), [value("i64", 10n)]);
1055
1056 // ./test/core/align64.wast:847
1057 assert_return(() => invoke($23, `i64_align_switch`, [6, 1]), [value("i64", 10n)]);
1058
1059 // ./test/core/align64.wast:848
1060 assert_return(() => invoke($23, `i64_align_switch`, [6, 2]), [value("i64", 10n)]);
1061
1062 // ./test/core/align64.wast:849
1063 assert_return(() => invoke($23, `i64_align_switch`, [6, 4]), [value("i64", 10n)]);
1064
1065 // ./test/core/align64.wast:850
1066 assert_return(() => invoke($23, `i64_align_switch`, [6, 8]), [value("i64", 10n)]);
1067
1068 // ./test/core/align64.wast:854
1069 let $24 = instantiate(`(module
1070 (memory i64 1)
1071 (func (export "store") (param i64 i64)
1072 (i64.store align=4 (local.get 0) (local.get 1))
1073 )
1074 (func (export "load") (param i64) (result i32)
1075 (i32.load (local.get 0))
1076 )
1077 )`);
1078
1079 // Bug 1737225 - do not observe the partial store caused by bug 1666747 on
1080 // some native platforms.
1081 if (!partialOobWriteMayWritePartialData()) {
1082 // ./test/core/align64.wast:864
1083 assert_trap(
1084 () => invoke($24, `store`, [65532n, -1n]),
1085 `out of bounds memory access`,
1086 );
1087
1088 // ./test/core/align64.wast:866
1089 assert_return(() => invoke($24, `load`, [65532n]), [value("i32", 0)]);
1090 }