summaryrefslogtreecommitdiff
path: root/test/empty_table.2asm.js
diff options
context:
space:
mode:
authorThomas Lively <tlively@users.noreply.github.com>2017-08-07 13:42:49 -0700
committerAlon Zakai <alonzakai@gmail.com>2017-08-07 13:42:49 -0700
commit62f6a12c4fa109522229526e9d89969d2fde7399 (patch)
treefa2023676c4e698d98c25d409556d9bbb08a89b9 /test/empty_table.2asm.js
parentffd9a72d28d36915fb173a6d52fbb6e43f7c15db (diff)
downloadbinaryen-62f6a12c4fa109522229526e9d89969d2fde7399.tar.gz
binaryen-62f6a12c4fa109522229526e9d89969d2fde7399.tar.bz2
binaryen-62f6a12c4fa109522229526e9d89969d2fde7399.zip
wasm2asm i32 arithmetic support (#1120)
* Rotations, popcnt, ctz, etc
Diffstat (limited to 'test/empty_table.2asm.js')
-rw-r--r--test/empty_table.2asm.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/empty_table.2asm.js b/test/empty_table.2asm.js
index 30a200587..70e17ea9d 100644
--- a/test/empty_table.2asm.js
+++ b/test/empty_table.2asm.js
@@ -12,6 +12,44 @@ function asmFunc(global, env, buffer) {
var Math_fround = global.Math.fround;
var Math_abs = global.Math.abs;
var Math_clz32 = global.Math.clz32;
+ 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;
+ }
+
+ function __wasm_popcnt_i32(x) {
+ x = x | 0;
+ var count = 0, wasm2asm_i32$0 = 0;
+ count = 0;
+ b : {
+ l : do {
+ if ((x | 0) == (0 | 0)) {
+ wasm2asm_i32$0 = count;
+ break b;
+ }
+ x = x & (x - 1 | 0) | 0;
+ count = count + 1 | 0;
+ continue l;
+ break l;
+ } while (1);
+ };
+ return wasm2asm_i32$0 | 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 {
};