diff options
author | Thomas Lively <7121787+tlively@users.noreply.github.com> | 2017-09-01 14:26:01 -0400 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2017-09-01 11:26:01 -0700 |
commit | b013f744e3d70effd9be348cbde7fb93f0a16c6a (patch) | |
tree | 3b122293005d3370c931175eed92ad61e9dfd851 /test/wasm2asm.asserts.js | |
parent | b1e8b1b515b2a1d0264975abc4de39c8044f7195 (diff) | |
download | binaryen-b013f744e3d70effd9be348cbde7fb93f0a16c6a.tar.gz binaryen-b013f744e3d70effd9be348cbde7fb93f0a16c6a.tar.bz2 binaryen-b013f744e3d70effd9be348cbde7fb93f0a16c6a.zip |
i64 to i32 lowering for wasm2asm (#1134)
Diffstat (limited to 'test/wasm2asm.asserts.js')
-rw-r--r-- | test/wasm2asm.asserts.js | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/test/wasm2asm.asserts.js b/test/wasm2asm.asserts.js index 0fd8038dc..db4612077 100644 --- a/test/wasm2asm.asserts.js +++ b/test/wasm2asm.asserts.js @@ -12,13 +12,17 @@ function asmFunc(global, env, buffer) { var Math_fround = global.Math.fround; var Math_abs = global.Math.abs; var Math_clz32 = global.Math.clz32; - function $$0(x, y) { + function $$0() { + + } + + function $$1(x, y) { x = x | 0; y = y | 0; return x + y | 0 | 0; } - function $$1(x, y) { + function $$2(x, y) { x = x | 0; y = y | 0; return (x | 0) / (y | 0) | 0 | 0; @@ -26,28 +30,27 @@ function asmFunc(global, env, buffer) { function __wasm_ctz_i32(x) { x = x | 0; - var wasm2asm_i32$0 = 0; - if ((x | 0) == (0 | 0)) wasm2asm_i32$0 = 32; else wasm2asm_i32$0 = 31 - Math_clz32(x ^ (x - 1 | 0) | 0) | 0; - return wasm2asm_i32$0 | 0; + var $$1 = 0; + if ((x | 0) == (0 | 0)) $$1 = 32; else $$1 = 31 - Math_clz32(x ^ (x - 1 | 0) | 0) | 0; + return $$1 | 0; } function __wasm_popcnt_i32(x) { x = x | 0; - var count = 0, wasm2asm_i32$0 = 0; + var count = 0, $$2 = 0, $$3 = 0; count = 0; b : { l : do { - if ((x | 0) == (0 | 0)) { - wasm2asm_i32$0 = count; - break b; - } + $$2 = count; + if ((x | 0) == (0 | 0)) break b; x = x & (x - 1 | 0) | 0; count = count + 1 | 0; continue l; break l; } while (1); }; - return wasm2asm_i32$0 | 0; + $$3 = $$2; + return $$3 | 0; } function __wasm_rotl_i32(x, k) { @@ -63,8 +66,9 @@ function asmFunc(global, env, buffer) { } return { - add: $$0, - div_s: $$1 + empty: $$0, + add: $$1, + div_s: $$2 }; } @@ -82,7 +86,15 @@ var asmModule = asmFunc({ }, new ArrayBuffer(65536)); function check1() { - return (asmModule.add(1 | 0, 1 | 0) | 0 | 0) == (2 | 0) | 0; + var wasm2asm_i32$0 = 0; + asmModule.empty(); + wasm2asm_i32$0 = 1; + return wasm2asm_i32$0 | 0; } if (!check1()) fail1(); +function check2() { + return (asmModule.add(1 | 0, 1 | 0) | 0 | 0) == (2 | 0) | 0; +} + +if (!check2()) fail2(); |