| 1 |
;; RUN: wast --assert default,snapshot-folded --snapshot tests/snapshots % |
| 2 |
|
| 3 |
;;; WABT fold-block.wat test (Copyright 2016- WebAssembly Community Group participants) |
| 4 |
(module |
| 5 |
(func $fold-block (result f32) |
| 6 |
f32.const 2 |
| 7 |
block |
| 8 |
f32.const 3 |
| 9 |
br 0 |
| 10 |
end |
| 11 |
f32.const 1 |
| 12 |
f32.add) |
| 13 |
|
| 14 |
(func $fold-block-br-value (result i32) |
| 15 |
block (result i32) |
| 16 |
i32.const 1 |
| 17 |
br 0 |
| 18 |
end) |
| 19 |
|
| 20 |
(func $fold-loop |
| 21 |
loop (result i64) |
| 22 |
br 0 |
| 23 |
i64.const 1 |
| 24 |
end |
| 25 |
drop) |
| 26 |
|
| 27 |
(func $fold-loop-br (result i32) |
| 28 |
loop (result i32) |
| 29 |
i32.const 1 |
| 30 |
br 0 |
| 31 |
end) |
| 32 |
|
| 33 |
(func $fold-if |
| 34 |
i32.const 1 |
| 35 |
if |
| 36 |
nop |
| 37 |
nop |
| 38 |
end) |
| 39 |
|
| 40 |
(func $fold-if-else |
| 41 |
i32.const 1 |
| 42 |
if (result i32) |
| 43 |
i32.const 2 |
| 44 |
else |
| 45 |
i32.const 3 |
| 46 |
end |
| 47 |
drop) |
| 48 |
|
| 49 |
(func $fold-if-else-br |
| 50 |
i32.const 1 |
| 51 |
if (result i32) |
| 52 |
i32.const 2 |
| 53 |
br 0 |
| 54 |
else |
| 55 |
i32.const 3 |
| 56 |
end |
| 57 |
drop)) |