| 1 |
;; RUN: wast --assert default,snapshot-folded --snapshot tests/snapshots % |
| 2 |
|
| 3 |
;;; WABT fold-basic.wat test (Copyright 2016- WebAssembly Community Group participants) |
| 4 |
(module |
| 5 |
(func $fold-binary (result i32) |
| 6 |
i32.const 1 |
| 7 |
i32.const 2 |
| 8 |
i32.add) |
| 9 |
|
| 10 |
(func $fold-binary-chain (result i32) |
| 11 |
i32.const 1 |
| 12 |
i32.const 1 |
| 13 |
i32.const 1 |
| 14 |
i32.add |
| 15 |
i32.sub) |
| 16 |
|
| 17 |
(func $fold-compare (result i32) |
| 18 |
f32.const 1 |
| 19 |
f32.const 2 |
| 20 |
f32.le) |
| 21 |
|
| 22 |
(func $fold-unary (result f32) |
| 23 |
f32.const 1 |
| 24 |
f32.neg |
| 25 |
f32.neg) |
| 26 |
|
| 27 |
(func $fold-convert (result i64) |
| 28 |
f64.const 0 |
| 29 |
f32.demote_f64 |
| 30 |
i32.trunc_f32_s |
| 31 |
i64.extend_i32_s) |
| 32 |
|
| 33 |
(func $fold-select (result f32) |
| 34 |
f32.const 1 |
| 35 |
f32.const 2 |
| 36 |
i32.const 3 |
| 37 |
select)) |