diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dynamicLibrary.fromasm | 5 | ||||
-rw-r--r-- | test/dynamicLibrary.fromasm.clamp | 5 | ||||
-rw-r--r-- | test/dynamicLibrary.fromasm.imprecise | 5 | ||||
-rw-r--r-- | test/emcc_O2_hello_world.fromasm | 10 | ||||
-rw-r--r-- | test/emcc_O2_hello_world.fromasm.clamp | 10 | ||||
-rw-r--r-- | test/emcc_O2_hello_world.fromasm.imprecise | 10 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm | 15 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.clamp | 15 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.imprecise | 15 | ||||
-rw-r--r-- | test/memorygrowth.fromasm | 10 | ||||
-rw-r--r-- | test/memorygrowth.fromasm.clamp | 10 | ||||
-rw-r--r-- | test/memorygrowth.fromasm.imprecise | 10 | ||||
-rw-r--r-- | test/passes/O1_print-stack-ir.txt | 10 | ||||
-rw-r--r-- | test/passes/O2_print-stack-ir.txt | 10 | ||||
-rw-r--r-- | test/passes/O3_print-stack-ir.txt | 6 | ||||
-rw-r--r-- | test/passes/Os_print-stack-ir.txt | 6 | ||||
-rw-r--r-- | test/passes/coalesce-locals.txt | 23 | ||||
-rw-r--r-- | test/passes/coalesce-locals.wast | 24 | ||||
-rw-r--r-- | test/passes/flatten_local-cse_Os.txt | 5 |
19 files changed, 127 insertions, 77 deletions
diff --git a/test/dynamicLibrary.fromasm b/test/dynamicLibrary.fromasm index 212353b58..8bc46560c 100644 --- a/test/dynamicLibrary.fromasm +++ b/test/dynamicLibrary.fromasm @@ -16,8 +16,7 @@ (export "runPostSets" (func $runPostSets)) (export "_global" (global $_global)) (func $__ZN3FooC2Ev (; 2 ;) (; has Stack IR ;) (param $0 i32) - (local $1 i32) - (local.set $1 + (local.set $0 (global.get $STACKTOP) ) (global.set $STACKTOP @@ -41,7 +40,7 @@ ) ) (global.set $STACKTOP - (local.get $1) + (local.get $0) ) ) (func $runPostSets (; 3 ;) (; has Stack IR ;) diff --git a/test/dynamicLibrary.fromasm.clamp b/test/dynamicLibrary.fromasm.clamp index 212353b58..8bc46560c 100644 --- a/test/dynamicLibrary.fromasm.clamp +++ b/test/dynamicLibrary.fromasm.clamp @@ -16,8 +16,7 @@ (export "runPostSets" (func $runPostSets)) (export "_global" (global $_global)) (func $__ZN3FooC2Ev (; 2 ;) (; has Stack IR ;) (param $0 i32) - (local $1 i32) - (local.set $1 + (local.set $0 (global.get $STACKTOP) ) (global.set $STACKTOP @@ -41,7 +40,7 @@ ) ) (global.set $STACKTOP - (local.get $1) + (local.get $0) ) ) (func $runPostSets (; 3 ;) (; has Stack IR ;) diff --git a/test/dynamicLibrary.fromasm.imprecise b/test/dynamicLibrary.fromasm.imprecise index 23e877917..9c5b5c7c3 100644 --- a/test/dynamicLibrary.fromasm.imprecise +++ b/test/dynamicLibrary.fromasm.imprecise @@ -13,8 +13,7 @@ (export "runPostSets" (func $runPostSets)) (export "_global" (global $_global)) (func $__ZN3FooC2Ev (; 2 ;) (; has Stack IR ;) (param $0 i32) - (local $1 i32) - (local.set $1 + (local.set $0 (global.get $STACKTOP) ) (global.set $STACKTOP @@ -38,7 +37,7 @@ ) ) (global.set $STACKTOP - (local.get $1) + (local.get $0) ) ) (func $runPostSets (; 3 ;) (; has Stack IR ;) diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm index ac6fa21b6..2ea71d54e 100644 --- a/test/emcc_O2_hello_world.fromasm +++ b/test/emcc_O2_hello_world.fromasm @@ -9158,12 +9158,12 @@ (local.get $0) ) (func $___syscall_ret (; 32 ;) (; has Stack IR ;) (param $0 i32) (result i32) - (if (result i32) + (if (i32.gt_u (local.get $0) (i32.const -4096) ) - (block (result i32) + (block (i32.store (call $___errno_location) (i32.sub @@ -9171,10 +9171,12 @@ (local.get $0) ) ) - (i32.const -1) + (local.set $0 + (i32.const -1) + ) ) - (local.get $0) ) + (local.get $0) ) (func $dynCall_iiii (; 33 ;) (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (call_indirect (type $FUNCSIG$iiii) diff --git a/test/emcc_O2_hello_world.fromasm.clamp b/test/emcc_O2_hello_world.fromasm.clamp index ac6fa21b6..2ea71d54e 100644 --- a/test/emcc_O2_hello_world.fromasm.clamp +++ b/test/emcc_O2_hello_world.fromasm.clamp @@ -9158,12 +9158,12 @@ (local.get $0) ) (func $___syscall_ret (; 32 ;) (; has Stack IR ;) (param $0 i32) (result i32) - (if (result i32) + (if (i32.gt_u (local.get $0) (i32.const -4096) ) - (block (result i32) + (block (i32.store (call $___errno_location) (i32.sub @@ -9171,10 +9171,12 @@ (local.get $0) ) ) - (i32.const -1) + (local.set $0 + (i32.const -1) + ) ) - (local.get $0) ) + (local.get $0) ) (func $dynCall_iiii (; 33 ;) (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (call_indirect (type $FUNCSIG$iiii) diff --git a/test/emcc_O2_hello_world.fromasm.imprecise b/test/emcc_O2_hello_world.fromasm.imprecise index 3319032df..2d1eb6660 100644 --- a/test/emcc_O2_hello_world.fromasm.imprecise +++ b/test/emcc_O2_hello_world.fromasm.imprecise @@ -9137,12 +9137,12 @@ (local.get $0) ) (func $___syscall_ret (; 31 ;) (; has Stack IR ;) (param $0 i32) (result i32) - (if (result i32) + (if (i32.gt_u (local.get $0) (i32.const -4096) ) - (block (result i32) + (block (i32.store (call $___errno_location) (i32.sub @@ -9150,10 +9150,12 @@ (local.get $0) ) ) - (i32.const -1) + (local.set $0 + (i32.const -1) + ) ) - (local.get $0) ) + (local.get $0) ) (func $dynCall_iiii (; 32 ;) (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (call_indirect (type $FUNCSIG$iiii) diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index 5d464d67d..de5871b8f 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -1810,12 +1810,12 @@ ) ) (func $___syscall_ret (; 42 ;) (; has Stack IR ;) (param $0 i32) (result i32) - (if (result i32) + (if (i32.gt_u (local.get $0) (i32.const -4096) ) - (block (result i32) + (block (i32.store (call $___errno_location) (i32.sub @@ -1823,10 +1823,12 @@ (local.get $0) ) ) - (i32.const -1) + (local.set $0 + (i32.const -1) + ) ) - (local.get $0) ) + (local.get $0) ) (func $___fflush_unlocked (; 43 ;) (; has Stack IR ;) (param $0 i32) (result i32) (local $1 i32) @@ -14427,7 +14429,6 @@ ) ) (func $_i64Add (; 56 ;) (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) - (local $4 i32) (global.set $tempRet0 (i32.add (i32.add @@ -14435,7 +14436,7 @@ (local.get $3) ) (i32.lt_u - (local.tee $4 + (local.tee $1 (i32.add (local.get $0) (local.get $2) @@ -14445,7 +14446,7 @@ ) ) ) - (local.get $4) + (local.get $1) ) (func $_memset (; 57 ;) (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) diff --git a/test/emcc_hello_world.fromasm.clamp b/test/emcc_hello_world.fromasm.clamp index e9fa14045..983b724c2 100644 --- a/test/emcc_hello_world.fromasm.clamp +++ b/test/emcc_hello_world.fromasm.clamp @@ -1808,12 +1808,12 @@ ) ) (func $___syscall_ret (; 41 ;) (; has Stack IR ;) (param $0 i32) (result i32) - (if (result i32) + (if (i32.gt_u (local.get $0) (i32.const -4096) ) - (block (result i32) + (block (i32.store (call $___errno_location) (i32.sub @@ -1821,10 +1821,12 @@ (local.get $0) ) ) - (i32.const -1) + (local.set $0 + (i32.const -1) + ) ) - (local.get $0) ) + (local.get $0) ) (func $___fflush_unlocked (; 42 ;) (; has Stack IR ;) (param $0 i32) (result i32) (local $1 i32) @@ -14477,7 +14479,6 @@ ) ) (func $_i64Add (; 57 ;) (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) - (local $4 i32) (global.set $tempRet0 (i32.add (i32.add @@ -14485,7 +14486,7 @@ (local.get $3) ) (i32.lt_u - (local.tee $4 + (local.tee $1 (i32.add (local.get $0) (local.get $2) @@ -14495,7 +14496,7 @@ ) ) ) - (local.get $4) + (local.get $1) ) (func $_memset (; 58 ;) (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise index 383826f85..3e6c03d49 100644 --- a/test/emcc_hello_world.fromasm.imprecise +++ b/test/emcc_hello_world.fromasm.imprecise @@ -1792,12 +1792,12 @@ ) ) (func $___syscall_ret (; 41 ;) (; has Stack IR ;) (param $0 i32) (result i32) - (if (result i32) + (if (i32.gt_u (local.get $0) (i32.const -4096) ) - (block (result i32) + (block (i32.store (call $___errno_location) (i32.sub @@ -1805,10 +1805,12 @@ (local.get $0) ) ) - (i32.const -1) + (local.set $0 + (i32.const -1) + ) ) - (local.get $0) ) + (local.get $0) ) (func $___fflush_unlocked (; 42 ;) (; has Stack IR ;) (param $0 i32) (result i32) (local $1 i32) @@ -14322,7 +14324,6 @@ ) ) (func $_i64Add (; 52 ;) (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) - (local $4 i32) (global.set $tempRet0 (i32.add (i32.add @@ -14330,7 +14331,7 @@ (local.get $3) ) (i32.lt_u - (local.tee $4 + (local.tee $1 (i32.add (local.get $0) (local.get $2) @@ -14340,7 +14341,7 @@ ) ) ) - (local.get $4) + (local.get $1) ) (func $_memset (; 53 ;) (; has Stack IR ;) (param $0 i32) (param $1 i32) (param $2 i32) (result i32) (local $3 i32) diff --git a/test/memorygrowth.fromasm b/test/memorygrowth.fromasm index 9431268a8..dbf763a92 100644 --- a/test/memorygrowth.fromasm +++ b/test/memorygrowth.fromasm @@ -9211,12 +9211,12 @@ (local.get $0) ) (func $Pa (; 30 ;) (; has Stack IR ;) (param $0 i32) (result i32) - (if (result i32) + (if (i32.gt_u (local.get $0) (i32.const -4096) ) - (block (result i32) + (block (i32.store (call $Qa) (i32.sub @@ -9224,10 +9224,12 @@ (local.get $0) ) ) - (i32.const -1) + (local.set $0 + (i32.const -1) + ) ) - (local.get $0) ) + (local.get $0) ) (func $Qa (; 31 ;) (; has Stack IR ;) (result i32) (if (result i32) diff --git a/test/memorygrowth.fromasm.clamp b/test/memorygrowth.fromasm.clamp index 9431268a8..dbf763a92 100644 --- a/test/memorygrowth.fromasm.clamp +++ b/test/memorygrowth.fromasm.clamp @@ -9211,12 +9211,12 @@ (local.get $0) ) (func $Pa (; 30 ;) (; has Stack IR ;) (param $0 i32) (result i32) - (if (result i32) + (if (i32.gt_u (local.get $0) (i32.const -4096) ) - (block (result i32) + (block (i32.store (call $Qa) (i32.sub @@ -9224,10 +9224,12 @@ (local.get $0) ) ) - (i32.const -1) + (local.set $0 + (i32.const -1) + ) ) - (local.get $0) ) + (local.get $0) ) (func $Qa (; 31 ;) (; has Stack IR ;) (result i32) (if (result i32) diff --git a/test/memorygrowth.fromasm.imprecise b/test/memorygrowth.fromasm.imprecise index 7b1515990..8d12816bb 100644 --- a/test/memorygrowth.fromasm.imprecise +++ b/test/memorygrowth.fromasm.imprecise @@ -9186,12 +9186,12 @@ (local.get $0) ) (func $Pa (; 29 ;) (; has Stack IR ;) (param $0 i32) (result i32) - (if (result i32) + (if (i32.gt_u (local.get $0) (i32.const -4096) ) - (block (result i32) + (block (i32.store (call $Qa) (i32.sub @@ -9199,10 +9199,12 @@ (local.get $0) ) ) - (i32.const -1) + (local.set $0 + (i32.const -1) + ) ) - (local.get $0) ) + (local.get $0) ) (func $Qa (; 30 ;) (; has Stack IR ;) (result i32) (select diff --git a/test/passes/O1_print-stack-ir.txt b/test/passes/O1_print-stack-ir.txt index 7849776f2..7a6354ff1 100644 --- a/test/passes/O1_print-stack-ir.txt +++ b/test/passes/O1_print-stack-ir.txt @@ -2,13 +2,12 @@ (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (; 0 ;) (type $0) (param $0 i32) (result i32) - (local $1 i32) (i32.add (call $stacky-help (i32.const 0) ) (block (result i32) - (local.set $1 + (local.set $0 (call $stacky-help (i32.const 1) ) @@ -19,7 +18,7 @@ ) ) (i32.eqz - (local.get $1) + (local.get $0) ) ) ) @@ -29,13 +28,12 @@ (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (; 0 ;) (type $0) (param $0 i32) (result i32) - (local $1 i32) (i32.add (call $stacky-help (i32.const 0) ) (block (result i32) - (local.set $1 + (local.set $0 (call $stacky-help (i32.const 1) ) @@ -46,7 +44,7 @@ ) ) (i32.eqz - (local.get $1) + (local.get $0) ) ) ) diff --git a/test/passes/O2_print-stack-ir.txt b/test/passes/O2_print-stack-ir.txt index 2b056c13a..7a63d5cb1 100644 --- a/test/passes/O2_print-stack-ir.txt +++ b/test/passes/O2_print-stack-ir.txt @@ -2,16 +2,15 @@ (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (; 0 ;) (type $0) (param $0 i32) (result i32) - (local $1 i32) i32.const 0 call $stacky-help i32.const 1 call $stacky-help - local.set $1 + local.set $0 i32.const 2 call $stacky-help drop - local.get $1 + local.get $0 i32.eqz i32.add ) @@ -20,13 +19,12 @@ (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (; 0 ;) (; has Stack IR ;) (type $0) (param $0 i32) (result i32) - (local $1 i32) (i32.add (call $stacky-help (i32.const 0) ) (block (result i32) - (local.set $1 + (local.set $0 (call $stacky-help (i32.const 1) ) @@ -37,7 +35,7 @@ ) ) (i32.eqz - (local.get $1) + (local.get $0) ) ) ) diff --git a/test/passes/O3_print-stack-ir.txt b/test/passes/O3_print-stack-ir.txt index ee35fe489..0ec5a0c74 100644 --- a/test/passes/O3_print-stack-ir.txt +++ b/test/passes/O3_print-stack-ir.txt @@ -2,7 +2,6 @@ (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (; 0 ;) (type $0) (param $0 i32) (result i32) - (local $1 i32) i32.const 0 call $stacky-help i32.const 1 @@ -18,13 +17,12 @@ (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (; 0 ;) (; has Stack IR ;) (type $0) (param $0 i32) (result i32) - (local $1 i32) (i32.add (call $stacky-help (i32.const 0) ) (block (result i32) - (local.set $1 + (local.set $0 (call $stacky-help (i32.const 1) ) @@ -35,7 +33,7 @@ ) ) (i32.eqz - (local.get $1) + (local.get $0) ) ) ) diff --git a/test/passes/Os_print-stack-ir.txt b/test/passes/Os_print-stack-ir.txt index ee35fe489..0ec5a0c74 100644 --- a/test/passes/Os_print-stack-ir.txt +++ b/test/passes/Os_print-stack-ir.txt @@ -2,7 +2,6 @@ (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (; 0 ;) (type $0) (param $0 i32) (result i32) - (local $1 i32) i32.const 0 call $stacky-help i32.const 1 @@ -18,13 +17,12 @@ (type $0 (func (param i32) (result i32))) (export "stacky-help" (func $stacky-help)) (func $stacky-help (; 0 ;) (; has Stack IR ;) (type $0) (param $0 i32) (result i32) - (local $1 i32) (i32.add (call $stacky-help (i32.const 0) ) (block (result i32) - (local.set $1 + (local.set $0 (call $stacky-help (i32.const 1) ) @@ -35,7 +33,7 @@ ) ) (i32.eqz - (local.get $1) + (local.get $0) ) ) ) diff --git a/test/passes/coalesce-locals.txt b/test/passes/coalesce-locals.txt index 51388ace2..dddbf416c 100644 --- a/test/passes/coalesce-locals.txt +++ b/test/passes/coalesce-locals.txt @@ -1245,4 +1245,27 @@ ) (local.get $0) ) + (func $reuse-param (; 57 ;) (type $FUNCSIG$iii) (param $0 i32) (param $1 i32) (result i32) + (i32.add + (local.tee $0 + (i32.xor + (i32.shr_s + (i32.shl + (local.get $0) + (i32.const 16) + ) + (i32.const 16) + ) + (i32.shr_s + (i32.shl + (local.get $1) + (i32.const 16) + ) + (i32.const 16) + ) + ) + ) + (local.get $0) + ) + ) ) diff --git a/test/passes/coalesce-locals.wast b/test/passes/coalesce-locals.wast index c055ff349..ad62d1c7a 100644 --- a/test/passes/coalesce-locals.wast +++ b/test/passes/coalesce-locals.wast @@ -1198,4 +1198,28 @@ (local.get $var$2) ) ) + (func $reuse-param (param $x i32) (param $y i32) (result i32) + (local $temp i32) + (i32.add + (local.tee $temp + (i32.xor + (i32.shr_s + (i32.shl + (local.get $x) ;; $x and $temp do not interfere + (i32.const 16) + ) + (i32.const 16) + ) + (i32.shr_s + (i32.shl + (local.get $y) + (i32.const 16) + ) + (i32.const 16) + ) + ) + ) + (local.get $temp) + ) + ) ) diff --git a/test/passes/flatten_local-cse_Os.txt b/test/passes/flatten_local-cse_Os.txt index cee61f4ba..ec612f52f 100644 --- a/test/passes/flatten_local-cse_Os.txt +++ b/test/passes/flatten_local-cse_Os.txt @@ -2,9 +2,8 @@ (type $0 (func (param i32 i32) (result i32))) (export "div16_internal" (func $0)) (func $0 (; 0 ;) (; has Stack IR ;) (type $0) (param $0 i32) (param $1 i32) (result i32) - (local $2 i32) (i32.add - (local.tee $2 + (local.tee $0 (i32.xor (i32.shr_s (i32.shl @@ -22,7 +21,7 @@ ) ) ) - (local.get $2) + (local.get $0) ) ) ) |