diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/binaryen.js/sieve.js.txt | 4 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm | 30 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.clamp | 30 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.imprecise | 30 | ||||
-rw-r--r-- | test/example/relooper-fuzz.txt | 8 | ||||
-rw-r--r-- | test/example/relooper-fuzz1.txt | 12 | ||||
-rw-r--r-- | test/passes/optimize-instructions.txt | 124 | ||||
-rw-r--r-- | test/passes/optimize-instructions.wast | 131 |
8 files changed, 289 insertions, 80 deletions
diff --git a/test/binaryen.js/sieve.js.txt b/test/binaryen.js/sieve.js.txt index cd1c47362..2c4b906dd 100644 --- a/test/binaryen.js/sieve.js.txt +++ b/test/binaryen.js/sieve.js.txt @@ -62,9 +62,9 @@ optimized: (local $1 i32) (if (i32.lt_u - (i32.mul + (i32.shl (current_memory) - (i32.const 65536) + (i32.const 16) ) (get_local $0) ) diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index fa4ef94fd..cf5630cbe 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -3997,25 +3997,14 @@ (set_local $7 (block $do-once49 (result i32) (if (result i32) - (i32.or - (i32.lt_u - (tee_local $5 - (i32.and - (i32.load offset=4 - (get_global $tempDoublePtr) - ) - (i32.const 2146435072) - ) - ) - (i32.const 2146435072) - ) + (i32.lt_u (i32.and - (i32.eq - (get_local $5) - (i32.const 2146435072) + (i32.load offset=4 + (get_global $tempDoublePtr) ) - (i32.const 0) + (i32.const 2146435072) ) + (i32.const 2146435072) ) (block (result i32) (if @@ -6291,12 +6280,9 @@ (i32.const 0) (get_local $27) (tee_local $6 - (i32.or - (f64.ne - (get_local $15) - (get_local $15) - ) - (i32.const 0) + (f64.ne + (get_local $15) + (get_local $15) ) ) ) diff --git a/test/emcc_hello_world.fromasm.clamp b/test/emcc_hello_world.fromasm.clamp index c1c7f1485..1100106f4 100644 --- a/test/emcc_hello_world.fromasm.clamp +++ b/test/emcc_hello_world.fromasm.clamp @@ -4047,25 +4047,14 @@ (set_local $7 (block $do-once49 (result i32) (if (result i32) - (i32.or - (i32.lt_u - (tee_local $5 - (i32.and - (i32.load offset=4 - (get_global $tempDoublePtr) - ) - (i32.const 2146435072) - ) - ) - (i32.const 2146435072) - ) + (i32.lt_u (i32.and - (i32.eq - (get_local $5) - (i32.const 2146435072) + (i32.load offset=4 + (get_global $tempDoublePtr) ) - (i32.const 0) + (i32.const 2146435072) ) + (i32.const 2146435072) ) (block (result i32) (if @@ -6341,12 +6330,9 @@ (i32.const 0) (get_local $27) (tee_local $6 - (i32.or - (f64.ne - (get_local $15) - (get_local $15) - ) - (i32.const 0) + (f64.ne + (get_local $15) + (get_local $15) ) ) ) diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise index b19993aa8..96c7306ff 100644 --- a/test/emcc_hello_world.fromasm.imprecise +++ b/test/emcc_hello_world.fromasm.imprecise @@ -3938,25 +3938,14 @@ (set_local $7 (block $do-once49 (result i32) (if (result i32) - (i32.or - (i32.lt_u - (tee_local $5 - (i32.and - (i32.load offset=4 - (get_global $tempDoublePtr) - ) - (i32.const 2146435072) - ) - ) - (i32.const 2146435072) - ) + (i32.lt_u (i32.and - (i32.eq - (get_local $5) - (i32.const 2146435072) + (i32.load offset=4 + (get_global $tempDoublePtr) ) - (i32.const 0) + (i32.const 2146435072) ) + (i32.const 2146435072) ) (block (result i32) (if @@ -6226,12 +6215,9 @@ (i32.const 0) (get_local $27) (tee_local $6 - (i32.or - (f64.ne - (get_local $15) - (get_local $15) - ) - (i32.const 0) + (f64.ne + (get_local $15) + (get_local $15) ) ) ) diff --git a/test/example/relooper-fuzz.txt b/test/example/relooper-fuzz.txt index e53ca13ce..aeee64325 100644 --- a/test/example/relooper-fuzz.txt +++ b/test/example/relooper-fuzz.txt @@ -449,9 +449,9 @@ (i32.const 0) ) (if - (i32.rem_u + (i32.and (call $check) - (i32.const 2) + (i32.const 1) ) (block (call $print @@ -480,9 +480,9 @@ ) (br_if $shape$3$continue (i32.eqz - (i32.rem_u + (i32.and (call $check) - (i32.const 2) + (i32.const 1) ) ) ) diff --git a/test/example/relooper-fuzz1.txt b/test/example/relooper-fuzz1.txt index 6d0bba603..5da2f5ff3 100644 --- a/test/example/relooper-fuzz1.txt +++ b/test/example/relooper-fuzz1.txt @@ -438,17 +438,17 @@ (i32.const 0) ) (if - (i32.rem_u + (i32.and (tee_local $0 (call $check) ) - (i32.const 4) + (i32.const 3) ) (if (i32.eq - (i32.rem_u + (i32.and (get_local $0) - (i32.const 4) + (i32.const 3) ) (i32.const 2) ) @@ -470,9 +470,9 @@ (i32.const 2) ) (br_if $block$10$break - (i32.rem_u + (i32.and (call $check) - (i32.const 2) + (i32.const 1) ) ) ) diff --git a/test/passes/optimize-instructions.txt b/test/passes/optimize-instructions.txt index 88709e2fe..d77a1e1c2 100644 --- a/test/passes/optimize-instructions.txt +++ b/test/passes/optimize-instructions.txt @@ -1032,9 +1032,9 @@ ) (drop (i32.add - (i32.mul + (i32.shl (get_local $0) - (i32.const 2) + (i32.const 1) ) (i32.const 34) ) @@ -2296,6 +2296,126 @@ ) ) ) + (func $mul-power-2 (; 60 ;) (type $3) (param $x i32) (result i32) + (drop + (call $mul-power-2 + (i32.shl + (get_local $x) + (i32.const 2) + ) + ) + ) + (drop + (call $mul-power-2 + (i32.mul + (get_local $x) + (i32.const 5) + ) + ) + ) + (drop + (call $mul-power-2 + (get_local $x) + ) + ) + (drop + (call $mul-power-2 + (i32.const 0) + ) + ) + (drop + (call $mul-power-2 + (i32.mul + (call $mul-power-2 + (i32.const 123) + ) + (i32.const 0) + ) + ) + ) + (drop + (call $mul-power-2 + (i32.mul + (get_local $x) + (i32.const -1) + ) + ) + ) + (drop + (call $mul-power-2 + (i32.shl + (get_local $x) + (i32.const 31) + ) + ) + ) + (unreachable) + ) + (func $urem-power-2 (; 61 ;) (type $3) (param $x i32) (result i32) + (drop + (call $urem-power-2 + (i32.and + (get_local $x) + (i32.const 3) + ) + ) + ) + (drop + (call $urem-power-2 + (i32.rem_u + (get_local $x) + (i32.const 5) + ) + ) + ) + (drop + (call $urem-power-2 + (i32.const 0) + ) + ) + (drop + (call $urem-power-2 + (i32.rem_u + (get_local $x) + (i32.const 0) + ) + ) + ) + (drop + (call $urem-power-2 + (i32.rem_u + (get_local $x) + (i32.const -1) + ) + ) + ) + (drop + (call $urem-power-2 + (i32.and + (get_local $x) + (i32.const 2147483647) + ) + ) + ) + (unreachable) + ) + (func $orZero (; 62 ;) (type $3) (param $0 i32) (result i32) + (get_local $0) + ) + (func $andZero (; 63 ;) (type $3) (param $0 i32) (result i32) + (drop + (i32.const 0) + ) + (drop + (i32.and + (call $andZero + (i32.const 1234) + ) + (i32.const 0) + ) + ) + (unreachable) + ) ) (module (type $0 (func)) diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index 60bfc9b7d..5d1ba7308 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -2707,6 +2707,137 @@ ) ) ) + (func $mul-power-2 (param $x i32) (result i32) + (drop + (call $mul-power-2 + (i32.mul + (get_local $x) + (i32.const 4) + ) + ) + ) + (drop + (call $mul-power-2 + (i32.mul + (get_local $x) + (i32.const 5) + ) + ) + ) + (drop + (call $mul-power-2 + (i32.mul + (get_local $x) + (i32.const 1) + ) + ) + ) + (drop + (call $mul-power-2 + (i32.mul + (get_local $x) + (i32.const 0) + ) + ) + ) + (drop + (call $mul-power-2 + (i32.mul + (call $mul-power-2 (i32.const 123)) ;; side effects + (i32.const 0) + ) + ) + ) + (drop + (call $mul-power-2 + (i32.mul + (get_local $x) + (i32.const 0xffffffff) + ) + ) + ) + (drop + (call $mul-power-2 + (i32.mul + (get_local $x) + (i32.const 0x80000000) + ) + ) + ) + (unreachable) + ) + (func $urem-power-2 (param $x i32) (result i32) + (drop + (call $urem-power-2 + (i32.rem_u + (get_local $x) + (i32.const 4) + ) + ) + ) + (drop + (call $urem-power-2 + (i32.rem_u + (get_local $x) + (i32.const 5) + ) + ) + ) + (drop + (call $urem-power-2 + (i32.rem_u + (get_local $x) + (i32.const 1) + ) + ) + ) + (drop + (call $urem-power-2 + (i32.rem_u + (get_local $x) + (i32.const 0) + ) + ) + ) + (drop + (call $urem-power-2 + (i32.rem_u + (get_local $x) + (i32.const 0xffffffff) + ) + ) + ) + (drop + (call $urem-power-2 + (i32.rem_u + (get_local $x) + (i32.const 0x80000000) + ) + ) + ) + (unreachable) + ) + (func $orZero (param $0 i32) (result i32) + (i32.or + (get_local $0) + (i32.const 0) + ) + ) + (func $andZero (param $0 i32) (result i32) + (drop + (i32.and + (get_local $0) + (i32.const 0) + ) + ) + (drop + (i32.and + (call $andZero (i32.const 1234)) ;; side effects + (i32.const 0) + ) + ) + (unreachable) + ) ) (module (import "env" "memory" (memory $0 (shared 256 256))) |