diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-03-07 13:56:35 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-07 13:56:35 -0800 |
commit | 71804e2bfd1ba49b7dd4ce82b6ad26ba13f1bca8 (patch) | |
tree | 7a91f560708b5017cf795850db94267f2cb58f62 /test/debugInfo.fromasm.clamp.no-opts | |
parent | a452f92aeb96e9617a20146503720cd5acb64f29 (diff) | |
download | binaryen-71804e2bfd1ba49b7dd4ce82b6ad26ba13f1bca8.tar.gz binaryen-71804e2bfd1ba49b7dd4ce82b6ad26ba13f1bca8.tar.bz2 binaryen-71804e2bfd1ba49b7dd4ce82b6ad26ba13f1bca8.zip |
Use 3 modes for potentially trapping ops in asm2wasm (#929)
* use 3 modes for potentially trapping ops in asm2wasm: allow (just emit a potentially trapping op), js (do exactly what js does, even if it takes a slow ffi to do it), and clamp (avoid the trap by clamping as necessary)
Diffstat (limited to 'test/debugInfo.fromasm.clamp.no-opts')
-rw-r--r-- | test/debugInfo.fromasm.clamp.no-opts | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/test/debugInfo.fromasm.clamp.no-opts b/test/debugInfo.fromasm.clamp.no-opts new file mode 100644 index 000000000..ca91651d5 --- /dev/null +++ b/test/debugInfo.fromasm.clamp.no-opts @@ -0,0 +1,88 @@ +(module + (type $FUNCSIG$vii (func (param i32 i32))) + (import "env" "memory" (memory $0 256 256)) + (import "env" "table" (table 0 0 anyfunc)) + (import "env" "memoryBase" (global $memoryBase i32)) + (import "env" "tableBase" (global $tableBase i32)) + (export "add" (func $add)) + (export "ret" (func $ret)) + (export "opts" (func $opts)) + (func $add (param $x i32) (param $y i32) (result i32) + ;; tests/hello_world.c:5 + (set_local $x + (get_local $x) + ) + ;; tests/hello_world.c:6 + (set_local $y + (get_local $y) + ) + ;; tests/other_file.cpp:314159 + (set_local $x + (get_local $y) + ) + (return + (i32.add + (get_local $x) + (get_local $y) + ) + ) + ) + (func $ret (param $x i32) (result i32) + ;; return.cpp:50 + (set_local $x + (i32.shl + (get_local $x) + (i32.const 1) + ) + ) + ;; return.cpp:100 + (return + (i32.add + (get_local $x) + (i32.const 1) + ) + ) + (unreachable) + ) + (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 + (i32.add + (get_local $x) + (get_local $y) + ) + ) + ;; even-opted.cpp:2 + (set_local $y + (i32.shr_s + (get_local $y) + (get_local $x) + ) + ) + ;; even-opted.cpp:3 + (set_local $x + (call $i32s-rem + (get_local $x) + (get_local $y) + ) + ) + (return + (i32.add + (get_local $x) + (get_local $y) + ) + ) + ) +) |