diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/passes/optimize-instructions.txt | 77 | ||||
-rw-r--r-- | test/passes/optimize-instructions.wast | 70 | ||||
-rw-r--r-- | test/polymorphic_stack.wast | 10 | ||||
-rw-r--r-- | test/polymorphic_stack.wast.from-wast | 10 | ||||
-rw-r--r-- | test/polymorphic_stack.wast.fromBinary | 11 | ||||
-rw-r--r-- | test/polymorphic_stack.wast.fromBinary.noDebugInfo | 11 |
6 files changed, 180 insertions, 9 deletions
diff --git a/test/passes/optimize-instructions.txt b/test/passes/optimize-instructions.txt index a399a9096..55501dfb8 100644 --- a/test/passes/optimize-instructions.txt +++ b/test/passes/optimize-instructions.txt @@ -7,6 +7,7 @@ (type $5 (func (param i32))) (type $6 (func (param i32 i32) (result i32))) (type $7 (func (param i64) (result i64))) + (type $8 (func (result i64))) (memory $0 0) (export "load-off-2" (func $load-off-2)) (func $f (type $0) (param $i1 i32) (param $i2 i64) @@ -827,11 +828,14 @@ ) ) (drop - (i32.shl - (i32.clz - (i32.const 0) + (i32.shr_s + (i32.shl + (i32.clz + (i32.const 0) + ) + (i32.const 26) ) - (i32.const 2) + (i32.const 24) ) ) (drop @@ -853,13 +857,16 @@ ) ) (drop - (i32.shl - (i32.wrap/i64 - (i64.clz - (i64.const 0) + (i32.shr_s + (i32.shl + (i32.wrap/i64 + (i64.clz + (i64.const 0) + ) ) + (i32.const 25) ) - (i32.const 1) + (i32.const 24) ) ) (drop @@ -2061,4 +2068,56 @@ (i32.const 9) ) ) + (func $mix-shifts (type $2) (result i32) + (i32.shr_s + (i32.shl + (i32.const 23) + (i32.const -61) + ) + (i32.const 168) + ) + ) + (func $actually-no-shifts (type $2) (result i32) + (i32.const 33) + ) + (func $less-shifts-than-it-seems (type $3) (param $x i32) (result i32) + (i32.const 4800) + ) + (func $and-popcount32 (type $2) (result i32) + (i32.and + (i32.popcnt + (i32.const -1) + ) + (i32.const 31) + ) + ) + (func $and-popcount32-big (type $2) (result i32) + (i32.popcnt + (i32.const -1) + ) + ) + (func $and-popcount64 (type $8) (result i64) + (i64.and + (i64.popcnt + (i64.const -1) + ) + (i64.const 63) + ) + ) + (func $and-popcount64-big (type $8) (result i64) + (i64.and + (i64.popcnt + (i64.const -1) + ) + (i64.const 127) + ) + ) + (func $and-popcount64-bigger (type $8) (result i64) + (i64.and + (i64.popcnt + (i64.const -1) + ) + (i64.const 255) + ) + ) ) diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index 8362453e9..c26aad196 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -2496,4 +2496,74 @@ (i32.const 4098) ;; 2 bits effectively ) ) + (func $mix-shifts (result i32) + (i32.shr_s + (i32.shl + (i32.const 23) + (i32.const -61) + ) + (i32.const 168) + ) + ) + (func $actually-no-shifts (result i32) + (i32.add + (i32.shl + (i32.const 23) + (i32.const 32) ;; really 0 + ) + (i32.const 10) + ) + ) + (func $less-shifts-than-it-seems (param $x i32) (result i32) + (i32.add + (i32.shl + (i32.const 200) + (i32.const 36) ;; really 4 + ) + (i32.shl + (i32.const 100) + (i32.const 4) + ) + ) + ) + (func $and-popcount32 (result i32) + (i32.and + (i32.popcnt + (i32.const -1) + ) + (i32.const 31) + ) + ) + (func $and-popcount32-big (result i32) + (i32.and + (i32.popcnt + (i32.const -1) + ) + (i32.const 63) + ) + ) + (func $and-popcount64 (result i64) ;; these are TODOs + (i64.and + (i64.popcnt + (i64.const -1) + ) + (i64.const 63) + ) + ) + (func $and-popcount64-big (result i64) + (i64.and + (i64.popcnt + (i64.const -1) + ) + (i64.const 127) + ) + ) + (func $and-popcount64-bigger (result i64) + (i64.and + (i64.popcnt + (i64.const -1) + ) + (i64.const 255) + ) + ) ) diff --git a/test/polymorphic_stack.wast b/test/polymorphic_stack.wast index 2241ab910..b618fbb6c 100644 --- a/test/polymorphic_stack.wast +++ b/test/polymorphic_stack.wast @@ -86,5 +86,15 @@ ) ) ) + (func $br_table_unreachable_to_also_unreachable (result i32) + (block $a (result i32) + (block $b + (br_table $a $b ;; seems to send a value, but is not taken + (unreachable) + (unreachable) + ) + ) + ) + ) ) diff --git a/test/polymorphic_stack.wast.from-wast b/test/polymorphic_stack.wast.from-wast index b4b88f16b..c20f9218d 100644 --- a/test/polymorphic_stack.wast.from-wast +++ b/test/polymorphic_stack.wast.from-wast @@ -90,4 +90,14 @@ ) ) ) + (func $br_table_unreachable_to_also_unreachable (type $1) (result i32) + (block $a (result i32) + (block $b + (br_table $a $b + (unreachable) + (unreachable) + ) + ) + ) + ) ) diff --git a/test/polymorphic_stack.wast.fromBinary b/test/polymorphic_stack.wast.fromBinary index e0ee6577d..b139c9c06 100644 --- a/test/polymorphic_stack.wast.fromBinary +++ b/test/polymorphic_stack.wast.fromBinary @@ -125,5 +125,16 @@ (unreachable) ) ) + (func $br_table_unreachable_to_also_unreachable (type $1) (result i32) + (block $label$0 (result i32) + (block $label$1 + (unreachable) + (unreachable) + (unreachable) + (unreachable) + ) + (unreachable) + ) + ) ) diff --git a/test/polymorphic_stack.wast.fromBinary.noDebugInfo b/test/polymorphic_stack.wast.fromBinary.noDebugInfo index 857a3660c..e707d5046 100644 --- a/test/polymorphic_stack.wast.fromBinary.noDebugInfo +++ b/test/polymorphic_stack.wast.fromBinary.noDebugInfo @@ -125,5 +125,16 @@ (unreachable) ) ) + (func $6 (type $1) (result i32) + (block $label$0 (result i32) + (block $label$1 + (unreachable) + (unreachable) + (unreachable) + (unreachable) + ) + (unreachable) + ) + ) ) |