diff options
author | Alex Crichton <alex@alexcrichton.com> | 2018-08-30 16:10:26 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2018-08-30 16:10:26 -0700 |
commit | f109f3cae1cd81db22ba490a4da17a7a4c495047 (patch) | |
tree | fd7307a567505a28f879ccce00a30d2d0d27b848 /test/wasm2js/i64-rotate.wast | |
parent | 3976440ccb2c3ab9d67af7239f87ae04ebdeda1e (diff) | |
download | binaryen-f109f3cae1cd81db22ba490a4da17a7a4c495047.tar.gz binaryen-f109f3cae1cd81db22ba490a4da17a7a4c495047.tar.bz2 binaryen-f109f3cae1cd81db22ba490a4da17a7a4c495047.zip |
Rename `wasm2asm` to `wasm2js`, emit ESM by default (#1642)
* Rename the `wasm2asm` tool to `wasm2js`
This commit performs a relatively simple rename of the `wasm2asm` tool to
`wasm2js`. The functionality of the tool doesn't change just yet but it's
intended that we'll start generating an ES module instead of just an `asm.js`
function soon.
* wasm2js: Support `*.wasm` input files
Previously `wasm2js` only supported `*.wast` files but to make it a bit easier
to use in tooling pipelines this commit adds support for reading in a `*.wasm`
file directly. Determining which parser to use depends on the input filename,
where the binary parser is used with `*.wasm` files and the wast parser is used
for all other files.
* wasm2js: Emit ESM imports/exports by default
This commit alters the default behavior of `wasm2js` to emit an ESM by default,
either importing items from the environment or exporting. Items like
initialization of memory are also handled here.
Diffstat (limited to 'test/wasm2js/i64-rotate.wast')
-rw-r--r-- | test/wasm2js/i64-rotate.wast | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/test/wasm2js/i64-rotate.wast b/test/wasm2js/i64-rotate.wast new file mode 100644 index 000000000..7de93b381 --- /dev/null +++ b/test/wasm2js/i64-rotate.wast @@ -0,0 +1,70 @@ +;; Testing i64 rotates + +(module + (func $dummy) + + (func (export "rotl") (param $0 i64) (param $1 i64) (param $2 i64) (result i32) + (i64.eq (i64.rotl (get_local $0) (get_local $1)) (get_local $2))) + (func (export "rotr") (param $0 i64) (param $1 i64) (param $2 i64) (result i32) + (i64.eq (i64.rotr (get_local $0) (get_local $1)) (get_local $2))) +) + +(assert_return (invoke "rotl" (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 0)) + (i32.const 1)) +(assert_return (invoke "rotl" (i32.const 1) (i32.const 0) + (i32.const 1) (i32.const 0) + (i32.const 2) (i32.const 0)) + (i32.const 1)) +(assert_return (invoke "rotl" (i32.const 1) (i32.const 0) + (i32.const 31) (i32.const 0) + (i32.const 2147483648) (i32.const 0)) + (i32.const 1)) +(assert_return (invoke "rotl" (i32.const 1) (i32.const 0) + (i32.const 32) (i32.const 0) + (i32.const 0) (i32.const 1)) + (i32.const 1)) +(assert_return (invoke "rotl" (i32.const 1) (i32.const 0) + (i32.const 33) (i32.const 0) + (i32.const 0) (i32.const 2)) + (i32.const 1)) + +(assert_return (invoke "rotl" (i32.const 1) (i32.const 1) + (i32.const 1) (i32.const 0) + (i32.const 2) (i32.const 2)) + (i32.const 1)) +(assert_return (invoke "rotl" (i32.const 1) (i32.const 1) + (i32.const 31) (i32.const 0) + (i32.const 2147483648) (i32.const 2147483648)) + (i32.const 1)) +(assert_return (invoke "rotl" (i32.const 1) (i32.const 1) + (i32.const 32) (i32.const 0) + (i32.const 1) (i32.const 1)) + (i32.const 1)) +(assert_return (invoke "rotl" (i32.const 1) (i32.const 1) + (i32.const 33) (i32.const 0) + (i32.const 2) (i32.const 2)) + (i32.const 1)) + + +(assert_return (invoke "rotr" (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 0)) + (i32.const 1)) +(assert_return (invoke "rotr" (i32.const 1) (i32.const 0) + (i32.const 1) (i32.const 0) + (i32.const 0) (i32.const 2147483648)) + (i32.const 1)) +(assert_return (invoke "rotr" (i32.const 1) (i32.const 0) + (i32.const 31) (i32.const 0) + (i32.const 0) (i32.const 2)) + (i32.const 1)) +(assert_return (invoke "rotr" (i32.const 1) (i32.const 0) + (i32.const 32) (i32.const 0) + (i32.const 0) (i32.const 1)) + (i32.const 1)) +(assert_return (invoke "rotr" (i32.const 1) (i32.const 0) + (i32.const 33) (i32.const 0) + (i32.const 2147483648) (i32.const 0)) + (i32.const 1)) |