diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/emcc_O2_hello_world.fromasm | 5 | ||||
-rw-r--r-- | test/emcc_O2_hello_world.fromasm.imprecise | 5 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm | 260 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.imprecise | 260 | ||||
-rw-r--r-- | test/memorygrowth.fromasm | 5 | ||||
-rw-r--r-- | test/memorygrowth.fromasm.imprecise | 5 | ||||
-rw-r--r-- | test/min.fromasm | 4 | ||||
-rw-r--r-- | test/min.fromasm.imprecise | 4 | ||||
-rw-r--r-- | test/passes/precompute.txt | 16 | ||||
-rw-r--r-- | test/passes/precompute.wast | 19 | ||||
-rw-r--r-- | test/unit.fromasm | 23 | ||||
-rw-r--r-- | test/unit.fromasm.imprecise | 23 |
12 files changed, 117 insertions, 512 deletions
diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm index acbeb2a0b..be4324f2c 100644 --- a/test/emcc_O2_hello_world.fromasm +++ b/test/emcc_O2_hello_world.fromasm @@ -9223,10 +9223,7 @@ (set_local $6 (i32.and (get_local $4) - (i32.xor - (i32.const 3) - (i32.const -1) - ) + (i32.const -4) ) ) (if diff --git a/test/emcc_O2_hello_world.fromasm.imprecise b/test/emcc_O2_hello_world.fromasm.imprecise index acbeb2a0b..be4324f2c 100644 --- a/test/emcc_O2_hello_world.fromasm.imprecise +++ b/test/emcc_O2_hello_world.fromasm.imprecise @@ -9223,10 +9223,7 @@ (set_local $6 (i32.and (get_local $4) - (i32.xor - (i32.const 3) - (i32.const -1) - ) + (i32.const -4) ) ) (if diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index 02e6d6002..79f28f9e8 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -3743,24 +3743,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -4158,24 +4143,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -5312,10 +5282,7 @@ (get_local $1) (i32.const 2146435072) ) - (i32.lt_s - (i32.const 0) - (i32.const 0) - ) + (i32.const 0) ) ) (block @@ -7959,10 +7926,7 @@ (get_local $14) (get_local $14) ) - (f64.ne - (f64.const 0) - (f64.const 0) - ) + (i32.const 0) ) ) ) @@ -9033,24 +8997,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9076,24 +9025,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9132,24 +9066,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9180,24 +9099,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 8) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 8) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 7) ) + (i32.const -8) ) ) ) @@ -9233,24 +9137,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9303,24 +9192,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9353,24 +9227,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9423,24 +9282,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9473,24 +9317,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 8) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 8) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 7) ) + (i32.const -8) ) ) ) @@ -9516,24 +9345,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 8) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 8) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 7) ) + (i32.const -8) ) ) ) @@ -15472,20 +15286,20 @@ ) (i32.store offset=4 (get_local $4) - (i32.load offset=4 - (i32.const 624) + (i32.load + (i32.const 628) ) ) (i32.store offset=8 (get_local $4) - (i32.load offset=8 - (i32.const 624) + (i32.load + (i32.const 632) ) ) (i32.store offset=12 (get_local $4) - (i32.load offset=12 - (i32.const 624) + (i32.load + (i32.const 636) ) ) (i32.store @@ -18127,10 +17941,7 @@ (set_local $6 (i32.and (get_local $4) - (i32.xor - (i32.const 3) - (i32.const -1) - ) + (i32.const -4) ) ) (if @@ -20027,10 +19838,7 @@ (get_local $7) (i32.const 1) ) - (i32.shr_u - (i32.const 0) - (i32.const 31) - ) + (i32.const 0) ) (i32.const -2) ) diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise index b7e3d5f59..cdfd59b07 100644 --- a/test/emcc_hello_world.fromasm.imprecise +++ b/test/emcc_hello_world.fromasm.imprecise @@ -3741,24 +3741,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -4156,24 +4141,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -5310,10 +5280,7 @@ (get_local $1) (i32.const 2146435072) ) - (i32.lt_s - (i32.const 0) - (i32.const 0) - ) + (i32.const 0) ) ) (block @@ -7957,10 +7924,7 @@ (get_local $14) (get_local $14) ) - (f64.ne - (f64.const 0) - (f64.const 0) - ) + (i32.const 0) ) ) ) @@ -9031,24 +8995,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9074,24 +9023,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9130,24 +9064,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9178,24 +9097,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 8) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 8) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 7) ) + (i32.const -8) ) ) ) @@ -9231,24 +9135,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9301,24 +9190,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9351,24 +9225,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9421,24 +9280,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 4) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 3) ) + (i32.const -4) ) ) ) @@ -9471,24 +9315,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 8) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 8) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 7) ) + (i32.const -8) ) ) ) @@ -9514,24 +9343,9 @@ (i32.load (get_local $2) ) - (i32.sub - (i32.add - (i32.const 0) - (i32.const 8) - ) - (i32.const 1) - ) - ) - (i32.xor - (i32.sub - (i32.add - (i32.const 0) - (i32.const 8) - ) - (i32.const 1) - ) - (i32.const -1) + (i32.const 7) ) + (i32.const -8) ) ) ) @@ -15470,20 +15284,20 @@ ) (i32.store offset=4 (get_local $4) - (i32.load offset=4 - (i32.const 624) + (i32.load + (i32.const 628) ) ) (i32.store offset=8 (get_local $4) - (i32.load offset=8 - (i32.const 624) + (i32.load + (i32.const 632) ) ) (i32.store offset=12 (get_local $4) - (i32.load offset=12 - (i32.const 624) + (i32.load + (i32.const 636) ) ) (i32.store @@ -18125,10 +17939,7 @@ (set_local $6 (i32.and (get_local $4) - (i32.xor - (i32.const 3) - (i32.const -1) - ) + (i32.const -4) ) ) (if @@ -20025,10 +19836,7 @@ (get_local $7) (i32.const 1) ) - (i32.shr_u - (i32.const 0) - (i32.const 31) - ) + (i32.const 0) ) (i32.const -2) ) diff --git a/test/memorygrowth.fromasm b/test/memorygrowth.fromasm index 3d3f9468b..9f2c4b2b8 100644 --- a/test/memorygrowth.fromasm +++ b/test/memorygrowth.fromasm @@ -9289,10 +9289,7 @@ (set_local $6 (i32.and (get_local $4) - (i32.xor - (i32.const 3) - (i32.const -1) - ) + (i32.const -4) ) ) (if diff --git a/test/memorygrowth.fromasm.imprecise b/test/memorygrowth.fromasm.imprecise index 3d3f9468b..9f2c4b2b8 100644 --- a/test/memorygrowth.fromasm.imprecise +++ b/test/memorygrowth.fromasm.imprecise @@ -9289,10 +9289,7 @@ (set_local $6 (i32.and (get_local $4) - (i32.xor - (i32.const 3) - (i32.const -1) - ) + (i32.const -4) ) ) (if diff --git a/test/min.fromasm b/test/min.fromasm index 51750dd53..b5d826e4f 100644 --- a/test/min.fromasm +++ b/test/min.fromasm @@ -24,8 +24,6 @@ (nop) ) (func $ctzzzz (result i32) - (i32.ctz - (i32.const 4660) - ) + (i32.const 2) ) ) diff --git a/test/min.fromasm.imprecise b/test/min.fromasm.imprecise index 51750dd53..b5d826e4f 100644 --- a/test/min.fromasm.imprecise +++ b/test/min.fromasm.imprecise @@ -24,8 +24,6 @@ (nop) ) (func $ctzzzz (result i32) - (i32.ctz - (i32.const 4660) - ) + (i32.const 2) ) ) diff --git a/test/passes/precompute.txt b/test/passes/precompute.txt new file mode 100644 index 000000000..2e343c7fa --- /dev/null +++ b/test/passes/precompute.txt @@ -0,0 +1,16 @@ +(module + (memory 0) + (func $x (param $x i32) + (i32.const 3) + (i32.add + (i32.const 1) + (get_local $x) + ) + (i32.const 6) + (i32.const -1) + (i32.const 3) + (loop $loop-out0 $in + (br $in) + ) + ) +) diff --git a/test/passes/precompute.wast b/test/passes/precompute.wast new file mode 100644 index 000000000..0282ac61b --- /dev/null +++ b/test/passes/precompute.wast @@ -0,0 +1,19 @@ +(module + (func $x (param $x i32) + (i32.add (i32.const 1) (i32.const 2)) ;; precomputable + (i32.add (i32.const 1) (get_local $x)) + (i32.add (i32.const 1) (i32.add (i32.const 2) (i32.const 3))) ;; cascade + (i32.sub (i32.const 1) (i32.const 2)) + (i32.sub + (i32.add + (i32.const 0) + (i32.const 4) + ) + (i32.const 1) + ) + (loop $in ;; infinite loop + (br $in) + ) + ) +) + diff --git a/test/unit.fromasm b/test/unit.fromasm index 38d8c2c67..6939b9138 100644 --- a/test/unit.fromasm +++ b/test/unit.fromasm @@ -207,13 +207,7 @@ ) ) (func $big_uint_div_u (result i32) - (i32.and - (i32.div_u - (i32.const -1) - (i32.const 2) - ) - (i32.const -1) - ) + (i32.const 2147483647) ) (func $fr (param $0 f32) (nop) @@ -225,10 +219,7 @@ (local $0 f32) (call_indirect $FUNCSIG$vf (i32.add - (i32.and - (i32.const 1) - (i32.const 7) - ) + (i32.const 1) (i32.const 8) ) (f32.neg @@ -239,10 +230,7 @@ (func $cneg (param $0 f32) (call_indirect $FUNCSIG$vf (i32.add - (i32.and - (i32.const 1) - (i32.const 7) - ) + (i32.const 1) (i32.const 8) ) (get_local $0) @@ -280,10 +268,7 @@ (func $cneg_nosemicolon (call_indirect $FUNCSIG$vi (i32.add - (i32.and - (i32.const 1) - (i32.const 7) - ) + (i32.const 1) (i32.const 8) ) (i32.const 1) diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise index b493c66d0..ba8dae715 100644 --- a/test/unit.fromasm.imprecise +++ b/test/unit.fromasm.imprecise @@ -199,13 +199,7 @@ ) ) (func $big_uint_div_u (result i32) - (i32.and - (i32.div_u - (i32.const -1) - (i32.const 2) - ) - (i32.const -1) - ) + (i32.const 2147483647) ) (func $fr (param $0 f32) (nop) @@ -217,10 +211,7 @@ (local $0 f32) (call_indirect $FUNCSIG$vf (i32.add - (i32.and - (i32.const 1) - (i32.const 7) - ) + (i32.const 1) (i32.const 8) ) (f32.neg @@ -231,10 +222,7 @@ (func $cneg (param $0 f32) (call_indirect $FUNCSIG$vf (i32.add - (i32.and - (i32.const 1) - (i32.const 7) - ) + (i32.const 1) (i32.const 8) ) (get_local $0) @@ -272,10 +260,7 @@ (func $cneg_nosemicolon (call_indirect $FUNCSIG$vi (i32.add - (i32.and - (i32.const 1) - (i32.const 7) - ) + (i32.const 1) (i32.const 8) ) (i32.const 1) |