diff options
Diffstat (limited to 'test/dot_s')
-rw-r--r-- | test/dot_s/traps.clamp.wast | 113 | ||||
-rw-r--r-- | test/dot_s/traps.js.wast | 65 | ||||
-rw-r--r-- | test/dot_s/traps.s | 14 | ||||
-rw-r--r-- | test/dot_s/traps.wast | 49 |
4 files changed, 241 insertions, 0 deletions
diff --git a/test/dot_s/traps.clamp.wast b/test/dot_s/traps.clamp.wast new file mode 100644 index 000000000..3cab71072 --- /dev/null +++ b/test/dot_s/traps.clamp.wast @@ -0,0 +1,113 @@ +(module + (import "env" "memory" (memory $0 1)) + (table 0 anyfunc) + (export "stackSave" (func $stackSave)) + (export "stackAlloc" (func $stackAlloc)) + (export "stackRestore" (func $stackRestore)) + (export "test_traps" (func $test_traps)) + (func $test_traps (param $0 f32) (param $1 f64) (result i32) + (call $i32u-div + (call $f32-to-int + (get_local $0) + ) + (call $f64-to-uint + (get_local $1) + ) + ) + ) + (func $f32-to-int (param $0 f32) (result i32) + (if (result i32) + (f32.ne + (get_local $0) + (get_local $0) + ) + (i32.const -2147483648) + (if (result i32) + (f32.ge + (get_local $0) + (f32.const 2147483648) + ) + (i32.const -2147483648) + (if (result i32) + (f32.le + (get_local $0) + (f32.const -2147483648) + ) + (i32.const -2147483648) + (i32.trunc_s/f32 + (get_local $0) + ) + ) + ) + ) + ) + (func $f64-to-uint (param $0 f64) (result i32) + (if (result i32) + (f64.ne + (get_local $0) + (get_local $0) + ) + (i32.const 0) + (if (result i32) + (f64.ge + (get_local $0) + (f64.const 4294967296) + ) + (i32.const 0) + (if (result i32) + (f64.le + (get_local $0) + (f64.const -1) + ) + (i32.const 0) + (i32.trunc_u/f64 + (get_local $0) + ) + ) + ) + ) + ) + (func $i32u-div (param $0 i32) (param $1 i32) (result i32) + (if (result i32) + (i32.eqz + (get_local $1) + ) + (i32.const 0) + (i32.div_u + (get_local $0) + (get_local $1) + ) + ) + ) + (func $stackSave (result i32) + (i32.load offset=4 + (i32.const 0) + ) + ) + (func $stackAlloc (param $0 i32) (result i32) + (local $1 i32) + (set_local $1 + (i32.load offset=4 + (i32.const 0) + ) + ) + (i32.store offset=4 + (i32.const 0) + (i32.and + (i32.sub + (get_local $1) + (get_local $0) + ) + (i32.const -16) + ) + ) + (get_local $1) + ) + (func $stackRestore (param $0 i32) + (i32.store offset=4 + (i32.const 0) + (get_local $0) + ) + ) +) +;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] } diff --git a/test/dot_s/traps.js.wast b/test/dot_s/traps.js.wast new file mode 100644 index 000000000..39d08f4c0 --- /dev/null +++ b/test/dot_s/traps.js.wast @@ -0,0 +1,65 @@ +(module + (type $FUNCSIG$id (func (param f64) (result i32))) + (import "asm2wasm" "f64-to-int" (func $f64-to-int (param f64) (result i32))) + (import "env" "memory" (memory $0 1)) + (table 0 anyfunc) + (export "stackSave" (func $stackSave)) + (export "stackAlloc" (func $stackAlloc)) + (export "stackRestore" (func $stackRestore)) + (export "test_traps" (func $test_traps)) + (func $test_traps (param $0 f32) (param $1 f64) (result i32) + (call $i32u-div + (call $f64-to-int + (f64.promote/f32 + (get_local $0) + ) + ) + (call $f64-to-int + (get_local $1) + ) + ) + ) + (func $i32u-div (param $0 i32) (param $1 i32) (result i32) + (if (result i32) + (i32.eqz + (get_local $1) + ) + (i32.const 0) + (i32.div_u + (get_local $0) + (get_local $1) + ) + ) + ) + (func $stackSave (result i32) + (i32.load offset=4 + (i32.const 0) + ) + ) + (func $stackAlloc (param $0 i32) (result i32) + (local $1 i32) + (set_local $1 + (i32.load offset=4 + (i32.const 0) + ) + ) + (i32.store offset=4 + (i32.const 0) + (i32.and + (i32.sub + (get_local $1) + (get_local $0) + ) + (i32.const -16) + ) + ) + (get_local $1) + ) + (func $stackRestore (param $0 i32) + (i32.store offset=4 + (i32.const 0) + (get_local $0) + ) + ) +) +;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] } diff --git a/test/dot_s/traps.s b/test/dot_s/traps.s new file mode 100644 index 000000000..b75cf8d00 --- /dev/null +++ b/test/dot_s/traps.s @@ -0,0 +1,14 @@ + .text + .file "" + .globl test_traps + .type test_traps,@function +test_traps: + .param f32, f64 + .result i32 +# BB#0: + i32.trunc_s/f32 $push0=, $0 + i32.trunc_u/f64 $push1=, $1 + i32.div_u $push2=, $pop0, $pop1 + .endfunc +.Lfunc_end0: + .size test_traps, .Lfunc_end0-test_traps diff --git a/test/dot_s/traps.wast b/test/dot_s/traps.wast new file mode 100644 index 000000000..2ade5362a --- /dev/null +++ b/test/dot_s/traps.wast @@ -0,0 +1,49 @@ +(module + (import "env" "memory" (memory $0 1)) + (table 0 anyfunc) + (export "stackSave" (func $stackSave)) + (export "stackAlloc" (func $stackAlloc)) + (export "stackRestore" (func $stackRestore)) + (export "test_traps" (func $test_traps)) + (func $test_traps (param $0 f32) (param $1 f64) (result i32) + (i32.div_u + (i32.trunc_s/f32 + (get_local $0) + ) + (i32.trunc_u/f64 + (get_local $1) + ) + ) + ) + (func $stackSave (result i32) + (i32.load offset=4 + (i32.const 0) + ) + ) + (func $stackAlloc (param $0 i32) (result i32) + (local $1 i32) + (set_local $1 + (i32.load offset=4 + (i32.const 0) + ) + ) + (i32.store offset=4 + (i32.const 0) + (i32.and + (i32.sub + (get_local $1) + (get_local $0) + ) + (i32.const -16) + ) + ) + (get_local $1) + ) + (func $stackRestore (param $0 i32) + (i32.store offset=4 + (i32.const 0) + (get_local $0) + ) + ) +) +;; METADATA: { "asmConsts": {},"staticBump": 12, "initializers": [] } |