summaryrefslogtreecommitdiff
path: root/test/wasm2asm.asserts.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2017-10-20 10:01:49 -0700
committerGitHub <noreply@github.com>2017-10-20 10:01:49 -0700
commit23808ad092d409c1022b552eddae8093160fd37e (patch)
tree0d7ac01a84f6127af36389746cfd7db814ee1067 /test/wasm2asm.asserts.js
parentb66518f2300ed1a9c28f983cbbfb377dcb8502a8 (diff)
downloadbinaryen-23808ad092d409c1022b552eddae8093160fd37e.tar.gz
binaryen-23808ad092d409c1022b552eddae8093160fd37e.tar.bz2
binaryen-23808ad092d409c1022b552eddae8093160fd37e.zip
use simplify-locals in wasm2asm, so the output is not horribly verbose with los of extra inefficient variables. this is more similar to the output we had before the flatten rewrite (#1229)
Diffstat (limited to 'test/wasm2asm.asserts.js')
-rw-r--r--test/wasm2asm.asserts.js102
1 files changed, 19 insertions, 83 deletions
diff --git a/test/wasm2asm.asserts.js b/test/wasm2asm.asserts.js
index c9b28888e..a9f5c86ff 100644
--- a/test/wasm2asm.asserts.js
+++ b/test/wasm2asm.asserts.js
@@ -19,39 +19,24 @@ function asmFunc(global, env, buffer) {
function $$1(x, y) {
x = x | 0;
y = y | 0;
- var $$2 = 0, $$3 = 0, $$4 = 0;
- $$2 = x;
- $$3 = y;
- $$4 = $$2 + $$3 | 0;
- return $$4 | 0;
+ var $$2 = 0, $$3 = 0, $$4 = 0, wasm2asm_i32$0 = 0;
+ return x + y | 0 | 0;
+ return wasm2asm_i32$0 | 0;
}
function $$2(x, y) {
x = x | 0;
y = y | 0;
- var $$2 = 0, $$3 = 0, $$4 = 0;
- $$2 = x;
- $$3 = y;
- $$4 = ($$2 | 0) / ($$3 | 0) | 0;
- return $$4 | 0;
+ var $$2 = 0, $$3 = 0, $$4 = 0, wasm2asm_i32$0 = 0;
+ return (x | 0) / (y | 0) | 0 | 0;
+ return wasm2asm_i32$0 | 0;
}
function __wasm_ctz_i32(x) {
x = x | 0;
var $$1 = 0, $$2 = 0, $$3 = 0, $$4 = 0, $$5 = 0, $$6 = 0, $$7 = 0, $$8 = 0, $$9 = 0, $$10 = 0;
- $$1 = x;
- $$2 = ($$1 | 0) == (0 | 0);
- if ($$2) $$9 = 32; else {
- $$3 = x;
- $$4 = x;
- $$5 = $$4 - 1 | 0;
- $$6 = $$3 ^ $$5 | 0;
- $$7 = Math_clz32($$6);
- $$8 = 31 - $$7 | 0;
- $$9 = $$8;
- }
- $$10 = $$9;
- return $$10 | 0;
+ if ((x | 0) == (0 | 0)) $$9 = 32; else $$9 = 31 - Math_clz32(x ^ (x - 1 | 0) | 0) | 0;
+ return $$9 | 0;
}
function __wasm_popcnt_i32(x) {
@@ -60,80 +45,31 @@ function asmFunc(global, env, buffer) {
count = 0;
b : {
l : do {
- $$2 = count;
- $$3 = x;
- $$4 = ($$3 | 0) == (0 | 0);
- $$5 = $$2;
- if ($$4) break b;
- $$6 = $$5;
- $$7 = x;
- $$8 = x;
- $$9 = $$8 - 1 | 0;
- $$10 = $$7 & $$9 | 0;
- x = $$10;
- $$11 = count;
- $$12 = $$11 + 1 | 0;
- count = $$12;
+ $$5 = count;
+ if ((x | 0) == (0 | 0)) break b;
+ x = x & (x - 1 | 0) | 0;
+ count = count + 1 | 0;
continue l;
break l;
} while (1);
};
- $$13 = $$5;
- $$14 = $$13;
- $$15 = $$14;
- return $$15 | 0;
+ return $$5 | 0;
}
function __wasm_rotl_i32(x, k) {
x = x | 0;
k = k | 0;
- var $$2 = 0, $$3 = 0, $$4 = 0, $$5 = 0, $$6 = 0, $$7 = 0, $$8 = 0, $$9 = 0, $$10 = 0, $$11 = 0, $$12 = 0, $$13 = 0, $$14 = 0, $$15 = 0, $$16 = 0, $$17 = 0, $$18 = 0, $$19 = 0, $$20 = 0;
- $$2 = k;
- $$3 = $$2 & 31 | 0;
- $$4 = 4294967295 >>> $$3 | 0;
- $$5 = x;
- $$6 = $$4 & $$5 | 0;
- $$7 = k;
- $$8 = $$7 & 31 | 0;
- $$9 = $$6 << $$8 | 0;
- $$10 = k;
- $$11 = $$10 & 31 | 0;
- $$12 = 32 - $$11 | 0;
- $$13 = 4294967295 << $$12 | 0;
- $$14 = x;
- $$15 = $$13 & $$14 | 0;
- $$16 = k;
- $$17 = $$16 & 31 | 0;
- $$18 = 32 - $$17 | 0;
- $$19 = $$15 >>> $$18 | 0;
- $$20 = $$9 | $$19 | 0;
- return $$20 | 0;
+ var $$2 = 0, $$3 = 0, $$4 = 0, $$5 = 0, $$6 = 0, $$7 = 0, $$8 = 0, $$9 = 0, $$10 = 0, $$11 = 0, $$12 = 0, $$13 = 0, $$14 = 0, $$15 = 0, $$16 = 0, $$17 = 0, $$18 = 0, $$19 = 0, $$20 = 0, wasm2asm_i32$0 = 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 wasm2asm_i32$0 | 0;
}
function __wasm_rotr_i32(x, k) {
x = x | 0;
k = k | 0;
- var $$2 = 0, $$3 = 0, $$4 = 0, $$5 = 0, $$6 = 0, $$7 = 0, $$8 = 0, $$9 = 0, $$10 = 0, $$11 = 0, $$12 = 0, $$13 = 0, $$14 = 0, $$15 = 0, $$16 = 0, $$17 = 0, $$18 = 0, $$19 = 0, $$20 = 0;
- $$2 = k;
- $$3 = $$2 & 31 | 0;
- $$4 = 4294967295 << $$3 | 0;
- $$5 = x;
- $$6 = $$4 & $$5 | 0;
- $$7 = k;
- $$8 = $$7 & 31 | 0;
- $$9 = $$6 >>> $$8 | 0;
- $$10 = k;
- $$11 = $$10 & 31 | 0;
- $$12 = 32 - $$11 | 0;
- $$13 = 4294967295 >>> $$12 | 0;
- $$14 = x;
- $$15 = $$13 & $$14 | 0;
- $$16 = k;
- $$17 = $$16 & 31 | 0;
- $$18 = 32 - $$17 | 0;
- $$19 = $$15 << $$18 | 0;
- $$20 = $$9 | $$19 | 0;
- return $$20 | 0;
+ var $$2 = 0, $$3 = 0, $$4 = 0, $$5 = 0, $$6 = 0, $$7 = 0, $$8 = 0, $$9 = 0, $$10 = 0, $$11 = 0, $$12 = 0, $$13 = 0, $$14 = 0, $$15 = 0, $$16 = 0, $$17 = 0, $$18 = 0, $$19 = 0, $$20 = 0, wasm2asm_i32$0 = 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 wasm2asm_i32$0 | 0;
}
return {