diff options
Diffstat (limited to 'test/passes/simplify-locals.wast')
-rw-r--r-- | test/passes/simplify-locals.wast | 203 |
1 files changed, 203 insertions, 0 deletions
diff --git a/test/passes/simplify-locals.wast b/test/passes/simplify-locals.wast index 60531717c..5396e6a5b 100644 --- a/test/passes/simplify-locals.wast +++ b/test/passes/simplify-locals.wast @@ -12,6 +12,8 @@ (import $_i64Subtract "env" "i64sub" (param i32 i32 i32 i32) (result i32)) (import $___udivmoddi4 "env" "moddi" (param i32 i32 i32 i32 i32) (result i32)) (import $lp "env" "lp" (param i32 i32) (result i32)) + (import "fuzzing-support" "log-f32" (func $fimport$0 (param f32))) + (global $global$0 (mut i32) (i32.const 10)) (func $contrast ;; check for tee and structure sinking (local $x i32) (local $y i32) @@ -882,6 +884,207 @@ ) ) ) + (func $if-one-side (result i32) + (local $x i32) + (if + (i32.const 1) + (set_local $x + (i32.const 2) + ) + ) + (get_local $x) + ) + (func $if-one-side-undo (result i32) + (local $x i32) + (local $y i32) + (set_local $y + (i32.const 0) + ) + (if + (i32.const 1) + (set_local $x + (i32.const 2) + ) + ) + (get_local $y) + ) + (func $if-one-side-multi (param $0 i32) (result i32) + (if + (i32.lt_s + (get_local $0) + (i32.const -1073741824) + ) + (set_local $0 + (i32.const -1073741824) + ) + (if + (i32.gt_s + (get_local $0) + (i32.const 1073741823) + ) + (set_local $0 + (i32.const 1073741823) + ) + ) + ) + (get_local $0) + ) + (func $if-one-side-undo-but-its-a-tee (param $0 i32) (result i32) + (local $1 i32) + (local $2 i32) + (local $3 i32) + (local $4 i32) + (local $x i32) + (local $y i32) + (local $z i32) + ;; break these splittable ifs up + (set_local $x + (if (result i32) + (i32.const -1) + (i32.const -2) + (get_local $x) + ) + ) + ;; oops, this one is a tee + (drop + (call $if-one-side-undo-but-its-a-tee + (tee_local $x + (if (result i32) + (i32.const -3) + (i32.const -4) + (get_local $x) + ) + ) + ) + ) + ;; sinkable + (set_local $y + (if (result i32) + (i32.const -5) + (i32.const -6) + (get_local $y) + ) + ) + (drop (i32.eqz (get_local $y))) + ;; tee-able at best + (set_local $z + (if (result i32) + (i32.const -7) + (i32.const -8) + (get_local $z) + ) + ) + (drop + (i32.add + (get_local $z) + (get_local $z) + ) + ) + (if + (block $label$1 (result i32) + (if + (i32.const 1) + (set_local $4 + (i32.const 2) + ) + ) + (if + (get_local $4) + (set_local $4 + (i32.const 0) + ) + ) + (get_local $4) + ) + (unreachable) + ) + (i32.const 0) + ) + (func $splittable-ifs-multicycle (param $20 i32) (result i32) + (set_local $20 + (if (result i32) + (i32.const 1) + (if (result i32) + (i32.const 2) + (if (result i32) + (i32.const 3) + (i32.const 4) + (get_local $20) + ) + (get_local $20) + ) + (get_local $20) + ) + ) + (get_local $20) + ) + (func $update-getCounter (param $0 i32) (param $1 f64) (param $2 f64) (param $3 f32) (param $4 i32) (result f64) + (set_global $global$0 + (i32.sub + (get_global $global$0) + (i32.const 1) + ) + ) + (set_global $global$0 + (i32.sub + (get_global $global$0) + (i32.const 1) + ) + ) + (loop $label$1 (result f64) + (set_global $global$0 + (i32.sub + (get_global $global$0) + (i32.const 1) + ) + ) + (set_global $global$0 + (i32.sub + (get_global $global$0) + (i32.const 1) + ) + ) + (call $fimport$0 + (tee_local $3 + (if (result f32) + (i32.eqz + (get_local $0) + ) + (f32.const 4623408228068004207103214e13) + (get_local $3) + ) + ) + ) + (set_global $global$0 + (i32.sub + (get_global $global$0) + (i32.const 1) + ) + ) + (if (result f64) + (get_global $global$0) + (block + (set_global $global$0 + (i32.sub + (get_global $global$0) + (i32.const 1) + ) + ) + (set_local $0 + (i32.const -65) + ) + (set_global $global$0 + (i32.sub + (get_global $global$0) + (i32.const 1) + ) + ) + (br $label$1) + ) + (f64.const -70) + ) + ) + ) ) (module (memory (shared 256 256)) |