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/address.2asm.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/address.2asm.js')
-rw-r--r-- | test/address.2asm.js | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/test/address.2asm.js b/test/address.2asm.js index 3aa8b0cd8..b2c78fca9 100644 --- a/test/address.2asm.js +++ b/test/address.2asm.js @@ -13,7 +13,7 @@ function asmFunc(global, env, buffer) { var Math_abs = global.Math.abs; var Math_clz32 = global.Math.clz32; var print = env.print; - function good(i) { + function $$0(i) { i = i | 0; var wasm2asm_i32$0 = 0; print(HEAPU8[i >> 0] | 0 | 0); @@ -31,14 +31,51 @@ function asmFunc(global, env, buffer) { print((wasm2asm_i32$0 = i, HEAPU8[(wasm2asm_i32$0 + 25 | 0) >> 0] | 0 | 0 | (HEAPU8[(wasm2asm_i32$0 + 26 | 0) >> 0] | 0 | 0) << 8 | (HEAPU8[(wasm2asm_i32$0 + 27 | 0) >> 0] | 0 | 0) << 16 | (HEAPU8[(wasm2asm_i32$0 + 28 | 0) >> 0] | 0 | 0) << 24) | 0); } - function bad2(i) { + function $$1(i) { i = i | 0; - HEAPU32[(i + 4294967295 | 0) >> 2] | 0 + HEAPU32[(i + 4294967295 | 0) >> 2] | 0; + } + + function __wasm_ctz_i32(x) { + x = x | 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, $$2 = 0, $$3 = 0; + count = 0; + b : { + l : do { + $$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); + }; + $$3 = $$2; + return $$3 | 0; + } + + function __wasm_rotl_i32(x, k) { + x = x | 0; + k = k | 0; + return ((4294967295 >>> (k & 31 | 0) | 0) & x | 0) << (k & 31 | 0) | 0 | (((4294967295 << (32 - (k & 31 | 0) | 0) | 0) & x | 0) >>> (32 - (k & 31 | 0) | 0) | 0) | 0 | 0; + } + + function __wasm_rotr_i32(x, k) { + x = x | 0; + k = k | 0; + return ((4294967295 << (k & 31 | 0) | 0) & x | 0) >>> (k & 31 | 0) | 0 | (((4294967295 >>> (32 - (k & 31 | 0) | 0) | 0) & x | 0) << (32 - (k & 31 | 0) | 0) | 0) | 0 | 0; } return { - good: good, - bad2: bad2 + good: $$0, + bad: $$1 }; } |