diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/debugInfo.fromasm | 12 | ||||
-rw-r--r-- | test/debugInfo.fromasm.no-opts | 14 | ||||
-rw-r--r-- | test/emcc_O2_hello_world.fromasm | 13 | ||||
-rw-r--r-- | test/emcc_O2_hello_world.fromasm.no-opts | 15 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm | 59 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.no-opts | 67 | ||||
-rw-r--r-- | test/memorygrowth.fromasm | 13 | ||||
-rw-r--r-- | test/memorygrowth.fromasm.no-opts | 15 | ||||
-rw-r--r-- | test/unit.fromasm | 12 | ||||
-rw-r--r-- | test/unit.fromasm.no-opts | 14 | ||||
-rw-r--r-- | test/wasm-only.fromasm | 19 | ||||
-rw-r--r-- | test/wasm-only.fromasm.no-opts | 19 |
12 files changed, 240 insertions, 32 deletions
diff --git a/test/debugInfo.fromasm b/test/debugInfo.fromasm index f073f66a1..f19f244f5 100644 --- a/test/debugInfo.fromasm +++ b/test/debugInfo.fromasm @@ -1,7 +1,5 @@ (module - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$vii (func (param i32 i32))) - (import "asm2wasm" "i32s-rem" (func $i32s-rem (param i32 i32) (result i32))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 0 0 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -25,6 +23,16 @@ (i32.const 1) ) ) + (func $i32s-rem (param $0 i32) (param $1 i32) (result i32) + (if i32 + (get_local $1) + (i32.rem_s + (get_local $0) + (get_local $1) + ) + (i32.const 0) + ) + ) (func $opts (param $0 i32) (param $1 i32) (result i32) ;; even-opted.cpp:2 (set_local $1 diff --git a/test/debugInfo.fromasm.no-opts b/test/debugInfo.fromasm.no-opts index 0e450a5ab..af52ca902 100644 --- a/test/debugInfo.fromasm.no-opts +++ b/test/debugInfo.fromasm.no-opts @@ -1,7 +1,5 @@ (module - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$vii (func (param i32 i32))) - (import "asm2wasm" "i32s-rem" (func $i32s-rem (param i32 i32) (result i32))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 0 0 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -45,6 +43,18 @@ ) ) ) + (func $i32s-rem (param $0 i32) (param $1 i32) (result i32) + (if i32 + (i32.eqz + (get_local $1) + ) + (i32.const 0) + (i32.rem_s + (get_local $0) + (get_local $1) + ) + ) + ) (func $opts (param $x i32) (param $y i32) (result i32) ;; even-opted.cpp:1 (set_local $x diff --git a/test/emcc_O2_hello_world.fromasm b/test/emcc_O2_hello_world.fromasm index 1cc6427ef..40f7d3585 100644 --- a/test/emcc_O2_hello_world.fromasm +++ b/test/emcc_O2_hello_world.fromasm @@ -1,9 +1,9 @@ (module (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$i (func (result i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$v (func)) (type $FUNCSIG$vii (func (param i32 i32))) (import "env" "STACKTOP" (global $STACKTOP$asm2wasm$import i32)) @@ -23,7 +23,6 @@ (import "env" "___unlock" (func $___unlock (param i32))) (import "env" "___syscall140" (func $___syscall140 (param i32 i32) (result i32))) (import "env" "___syscall146" (func $___syscall146 (param i32 i32) (result i32))) - (import "asm2wasm" "i32u-div" (func $i32u-div (param i32 i32) (result i32))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 18 18 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -9450,6 +9449,16 @@ ) ) ) + (func $i32u-div (param $0 i32) (param $1 i32) (result i32) + (if i32 + (get_local $1) + (i32.div_u + (get_local $0) + (get_local $1) + ) + (i32.const 0) + ) + ) (func $_fwrite (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (local $4 i32) (local $5 i32) diff --git a/test/emcc_O2_hello_world.fromasm.no-opts b/test/emcc_O2_hello_world.fromasm.no-opts index 80801ea2d..e5c2052a6 100644 --- a/test/emcc_O2_hello_world.fromasm.no-opts +++ b/test/emcc_O2_hello_world.fromasm.no-opts @@ -1,9 +1,9 @@ (module (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$i (func (result i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$v (func)) (type $FUNCSIG$vii (func (param i32 i32))) (import "env" "STACKTOP" (global $STACKTOP$asm2wasm$import i32)) @@ -27,7 +27,6 @@ (import "env" "___unlock" (func $___unlock (param i32))) (import "env" "___syscall140" (func $___syscall140 (param i32 i32) (result i32))) (import "env" "___syscall146" (func $___syscall146 (param i32 i32) (result i32))) - (import "asm2wasm" "i32u-div" (func $i32u-div (param i32 i32) (result i32))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 18 18 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -11347,6 +11346,18 @@ (get_local $i4) ) ) + (func $i32u-div (param $0 i32) (param $1 i32) (result i32) + (if i32 + (i32.eqz + (get_local $1) + ) + (i32.const 0) + (i32.div_u + (get_local $0) + (get_local $1) + ) + ) + ) (func $_fwrite (param $i1 i32) (param $i2 i32) (param $i3 i32) (param $i4 i32) (result i32) (local $i5 i32) (local $i6 i32) diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index 7dbe75147..87cf3f385 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -1,11 +1,11 @@ (module (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (type $FUNCSIG$id (func (param f64) (result i32))) - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) (type $FUNCSIG$i (func (result i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$vii (func (param i32 i32))) (import "env" "STACKTOP" (global $STACKTOP$asm2wasm$import i32)) (import "env" "STACK_MAX" (global $STACK_MAX$asm2wasm$import i32)) @@ -29,10 +29,6 @@ (import "env" "_sysconf" (func $_sysconf (param i32) (result i32))) (import "env" "___syscall146" (func $___syscall146 (param i32 i32) (result i32))) (import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32))) - (import "asm2wasm" "i32s-div" (func $i32s-div (param i32 i32) (result i32))) - (import "asm2wasm" "i32s-rem" (func $i32s-rem (param i32 i32) (result i32))) - (import "asm2wasm" "i32u-rem" (func $i32u-rem (param i32 i32) (result i32))) - (import "asm2wasm" "i32u-div" (func $i32u-div (param i32 i32) (result i32))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 18 18 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -2234,6 +2230,59 @@ ) ) ) + (func $i32s-div (param $0 i32) (param $1 i32) (result i32) + (if i32 + (get_local $1) + (if i32 + (i32.and + (i32.eq + (get_local $0) + (i32.const -2147483648) + ) + (i32.eq + (get_local $1) + (i32.const -1) + ) + ) + (i32.const 0) + (i32.div_s + (get_local $0) + (get_local $1) + ) + ) + (i32.const 0) + ) + ) + (func $i32s-rem (param $0 i32) (param $1 i32) (result i32) + (if i32 + (get_local $1) + (i32.rem_s + (get_local $0) + (get_local $1) + ) + (i32.const 0) + ) + ) + (func $i32u-rem (param $0 i32) (param $1 i32) (result i32) + (if i32 + (get_local $1) + (i32.rem_u + (get_local $0) + (get_local $1) + ) + (i32.const 0) + ) + ) + (func $i32u-div (param $0 i32) (param $1 i32) (result i32) + (if i32 + (get_local $1) + (i32.div_u + (get_local $0) + (get_local $1) + ) + (i32.const 0) + ) + ) (func $_printf_core (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32) (local $5 i32) (local $6 i32) diff --git a/test/emcc_hello_world.fromasm.no-opts b/test/emcc_hello_world.fromasm.no-opts index 10cae59e8..1b51d826c 100644 --- a/test/emcc_hello_world.fromasm.no-opts +++ b/test/emcc_hello_world.fromasm.no-opts @@ -1,11 +1,11 @@ (module (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) (type $FUNCSIG$id (func (param f64) (result i32))) - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) (type $FUNCSIG$i (func (result i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$vii (func (param i32 i32))) (import "env" "STACKTOP" (global $STACKTOP$asm2wasm$import i32)) (import "env" "STACK_MAX" (global $STACK_MAX$asm2wasm$import i32)) @@ -33,10 +33,6 @@ (import "env" "_sysconf" (func $_sysconf (param i32) (result i32))) (import "env" "___syscall146" (func $___syscall146 (param i32 i32) (result i32))) (import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32))) - (import "asm2wasm" "i32s-div" (func $i32s-div (param i32 i32) (result i32))) - (import "asm2wasm" "i32s-rem" (func $i32s-rem (param i32 i32) (result i32))) - (import "asm2wasm" "i32u-rem" (func $i32u-rem (param i32 i32) (result i32))) - (import "asm2wasm" "i32u-div" (func $i32u-div (param i32 i32) (result i32))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 18 18 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -4638,6 +4634,67 @@ ) (return) ) + (func $i32s-div (param $0 i32) (param $1 i32) (result i32) + (if i32 + (i32.eqz + (get_local $1) + ) + (i32.const 0) + (if i32 + (i32.and + (i32.eq + (get_local $0) + (i32.const -2147483648) + ) + (i32.eq + (get_local $1) + (i32.const -1) + ) + ) + (i32.const 0) + (i32.div_s + (get_local $0) + (get_local $1) + ) + ) + ) + ) + (func $i32s-rem (param $0 i32) (param $1 i32) (result i32) + (if i32 + (i32.eqz + (get_local $1) + ) + (i32.const 0) + (i32.rem_s + (get_local $0) + (get_local $1) + ) + ) + ) + (func $i32u-rem (param $0 i32) (param $1 i32) (result i32) + (if i32 + (i32.eqz + (get_local $1) + ) + (i32.const 0) + (i32.rem_u + (get_local $0) + (get_local $1) + ) + ) + ) + (func $i32u-div (param $0 i32) (param $1 i32) (result i32) + (if i32 + (i32.eqz + (get_local $1) + ) + (i32.const 0) + (i32.div_u + (get_local $0) + (get_local $1) + ) + ) + ) (func $_printf_core (param $$f i32) (param $$fmt i32) (param $$ap i32) (param $$nl_arg i32) (param $$nl_type i32) (result i32) (local $$$ i32) (local $$$$i i32) diff --git a/test/memorygrowth.fromasm b/test/memorygrowth.fromasm index e33525578..b06a13f64 100644 --- a/test/memorygrowth.fromasm +++ b/test/memorygrowth.fromasm @@ -1,10 +1,10 @@ (module (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) (type $FUNCSIG$vii (func (param i32 i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (import "env" "STACKTOP" (global $r$asm2wasm$import i32)) (import "env" "STACK_MAX" (global $s$asm2wasm$import i32)) (import "env" "abort" (func $ja (param i32))) @@ -19,7 +19,6 @@ (import "env" "___syscall54" (func $wa (param i32 i32) (result i32))) (import "env" "___unlock" (func $xa (param i32))) (import "env" "___syscall146" (func $ya (param i32 i32) (result i32))) - (import "asm2wasm" "i32u-div" (func $i32u-div (param i32 i32) (result i32))) (import "env" "memory" (memory $0 256)) (import "env" "table" (table 8 8 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -9442,6 +9441,16 @@ ) ) ) + (func $i32u-div (param $0 i32) (param $1 i32) (result i32) + (if i32 + (get_local $1) + (i32.div_u + (get_local $0) + (get_local $1) + ) + (i32.const 0) + ) + ) (func $bb (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (result i32) (local $4 i32) (local $5 i32) diff --git a/test/memorygrowth.fromasm.no-opts b/test/memorygrowth.fromasm.no-opts index a27f419ae..c9569d0bd 100644 --- a/test/memorygrowth.fromasm.no-opts +++ b/test/memorygrowth.fromasm.no-opts @@ -1,10 +1,10 @@ (module (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32))) - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) (type $FUNCSIG$vii (func (param i32 i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (import "env" "STACKTOP" (global $r$asm2wasm$import i32)) (import "env" "STACK_MAX" (global $s$asm2wasm$import i32)) (import "env" "tempDoublePtr" (global $t$asm2wasm$import i32)) @@ -23,7 +23,6 @@ (import "env" "___syscall54" (func $wa (param i32 i32) (result i32))) (import "env" "___unlock" (func $xa (param i32))) (import "env" "___syscall146" (func $ya (param i32 i32) (result i32))) - (import "asm2wasm" "i32u-div" (func $i32u-div (param i32 i32) (result i32))) (import "env" "memory" (memory $0 256)) (import "env" "table" (table 8 8 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -11306,6 +11305,18 @@ (get_local $d) ) ) + (func $i32u-div (param $0 i32) (param $1 i32) (result i32) + (if i32 + (i32.eqz + (get_local $1) + ) + (i32.const 0) + (i32.div_u + (get_local $0) + (get_local $1) + ) + ) + ) (func $bb (param $a i32) (param $b i32) (param $c i32) (param $d i32) (result i32) (local $e i32) (local $f i32) diff --git a/test/unit.fromasm b/test/unit.fromasm index 4f7b2c6a9..bbce09412 100644 --- a/test/unit.fromasm +++ b/test/unit.fromasm @@ -1,7 +1,6 @@ (module (type $FUNCSIG$id (func (param f64) (result i32))) (type $FUNCSIG$ddd (func (param f64 f64) (result f64))) - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$vf (func (param f32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) @@ -17,7 +16,6 @@ (import "env" "return_int" (func $return_int (result i32))) (import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32))) (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64))) - (import "asm2wasm" "i32u-div" (func $i32u-div (param i32 i32) (result i32))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 24 24 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -252,6 +250,16 @@ (f64.const 1.2) ) ) + (func $i32u-div (param $0 i32) (param $1 i32) (result i32) + (if i32 + (get_local $1) + (i32.div_u + (get_local $0) + (get_local $1) + ) + (i32.const 0) + ) + ) (func $big_uint_div_u (result i32) (call $i32u-div (i32.const -1) diff --git a/test/unit.fromasm.no-opts b/test/unit.fromasm.no-opts index 29fede80c..d18dfd77e 100644 --- a/test/unit.fromasm.no-opts +++ b/test/unit.fromasm.no-opts @@ -1,7 +1,6 @@ (module (type $FUNCSIG$id (func (param f64) (result i32))) (type $FUNCSIG$ddd (func (param f64 f64) (result f64))) - (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (type $FUNCSIG$vf (func (param f32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) @@ -21,7 +20,6 @@ (import "env" "return_int" (func $return_int (result i32))) (import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32))) (import "asm2wasm" "f64-rem" (func $f64-rem (param f64 f64) (result f64))) - (import "asm2wasm" "i32u-div" (func $i32u-div (param i32 i32) (result i32))) (import "env" "memory" (memory $0 256 256)) (import "env" "table" (table 24 24 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) @@ -379,6 +377,18 @@ ) ) ) + (func $i32u-div (param $0 i32) (param $1 i32) (result i32) + (if i32 + (i32.eqz + (get_local $1) + ) + (i32.const 0) + (i32.div_u + (get_local $0) + (get_local $1) + ) + ) + ) (func $big_uint_div_u (result i32) (local $x i32) (set_local $x diff --git a/test/wasm-only.fromasm b/test/wasm-only.fromasm index 1a50a4385..dbb67e746 100644 --- a/test/wasm-only.fromasm +++ b/test/wasm-only.fromasm @@ -148,9 +148,22 @@ (get_local $1) ) (i64.const 0) - (i64.div_s - (get_local $0) - (get_local $1) + (if i64 + (i32.and + (i64.eq + (get_local $0) + (i64.const -9223372036854775808) + ) + (i64.eq + (get_local $1) + (i64.const -1) + ) + ) + (i64.const 0) + (i64.div_s + (get_local $0) + (get_local $1) + ) ) ) ) diff --git a/test/wasm-only.fromasm.no-opts b/test/wasm-only.fromasm.no-opts index eae9c4597..ae1fa211b 100644 --- a/test/wasm-only.fromasm.no-opts +++ b/test/wasm-only.fromasm.no-opts @@ -296,9 +296,22 @@ (get_local $1) ) (i64.const 0) - (i64.div_s - (get_local $0) - (get_local $1) + (if i64 + (i32.and + (i64.eq + (get_local $0) + (i64.const -9223372036854775808) + ) + (i64.eq + (get_local $1) + (i64.const -1) + ) + ) + (i64.const 0) + (i64.div_s + (get_local $0) + (get_local $1) + ) ) ) ) |