summaryrefslogtreecommitdiff
path: root/test/wasm2js
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-05-10 12:24:03 -0700
committerGitHub <noreply@github.com>2019-05-10 12:24:03 -0700
commit4b35f384fe753f06c22a04bfa1be056e92f67739 (patch)
tree5a1a9c515dbffb01bae91d113ce88e8210e91e8b /test/wasm2js
parentd216f8742ba0663fffb035c577a5449bbc8a33a2 (diff)
downloadbinaryen-4b35f384fe753f06c22a04bfa1be056e92f67739.tar.gz
binaryen-4b35f384fe753f06c22a04bfa1be056e92f67739.tar.bz2
binaryen-4b35f384fe753f06c22a04bfa1be056e92f67739.zip
Look through fallthrough values in precompute-propagate (#2093)
This helps quite a lot on wasm2js.
Diffstat (limited to 'test/wasm2js')
-rw-r--r--test/wasm2js/conversions-modified.2asm.js.opt22
-rw-r--r--test/wasm2js/float-ops.2asm.js.opt4
-rw-r--r--test/wasm2js/get-set-local.2asm.js.opt6
-rw-r--r--test/wasm2js/i64-add-sub.2asm.js.opt41
-rw-r--r--test/wasm2js/i64-ctz.2asm.js.opt34
-rw-r--r--test/wasm2js/i64-lowering.2asm.js.opt116
-rw-r--r--test/wasm2js/i64-shifts.2asm.js.opt62
-rw-r--r--test/wasm2js/reinterpret.2asm.js.opt13
-rw-r--r--test/wasm2js/stack-modified.2asm.js.opt60
-rw-r--r--test/wasm2js/unaligned.2asm.js.opt11
-rw-r--r--test/wasm2js/unary-ops.2asm.js.opt63
11 files changed, 75 insertions, 357 deletions
diff --git a/test/wasm2js/conversions-modified.2asm.js.opt b/test/wasm2js/conversions-modified.2asm.js.opt
index 2b756f906..fc6b306a7 100644
--- a/test/wasm2js/conversions-modified.2asm.js.opt
+++ b/test/wasm2js/conversions-modified.2asm.js.opt
@@ -142,23 +142,17 @@ function asmFunc(global, env, buffer) {
}
function legalstub$7($0) {
- var $1 = 0, $2 = 0, $3_1 = 0, $4_1 = 0;
- $2 = $7($0);
- $3_1 = i64toi32_i32$HIGH_BITS;
- $4_1 = 32;
- $1 = $4_1 & 31;
- setTempRet0((32 >>> 0 <= $4_1 >>> 0 ? $3_1 >>> $1 : ((1 << $1) - 1 & $3_1) << 32 - $1 | $2 >>> $1) | 0);
- return $2;
+ var $1 = 0;
+ $1 = $7($0);
+ setTempRet0(i64toi32_i32$HIGH_BITS | 0);
+ return $1;
}
function legalstub$9($0) {
- var $1 = 0, $2 = 0, $3_1 = 0, $4_1 = 0;
- $2 = $9($0);
- $3_1 = i64toi32_i32$HIGH_BITS;
- $4_1 = 32;
- $1 = $4_1 & 31;
- setTempRet0((32 >>> 0 <= $4_1 >>> 0 ? $3_1 >>> $1 : ((1 << $1) - 1 & $3_1) << 32 - $1 | $2 >>> $1) | 0);
- return $2;
+ var $1 = 0;
+ $1 = $9($0);
+ setTempRet0(i64toi32_i32$HIGH_BITS | 0);
+ return $1;
}
function legalstub$12($0, $1) {
diff --git a/test/wasm2js/float-ops.2asm.js.opt b/test/wasm2js/float-ops.2asm.js.opt
index 416f144d2..cc8f90643 100644
--- a/test/wasm2js/float-ops.2asm.js.opt
+++ b/test/wasm2js/float-ops.2asm.js.opt
@@ -246,12 +246,12 @@ function asmFunc(global, env, buffer) {
function $47($0) {
$0 = Math_fround($0);
- return !((Math_fround(Math_abs($0)) >= Math_fround(1.0) ? ($0 > Math_fround(0.0) ? ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround($0 / Math_fround(4294967296.0)))), Math_fround(4294967296.0))) >>> 0 : ~~Math_fround(Math_ceil(Math_fround(Math_fround($0 - Math_fround(~~$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0) : 0) | ~~$0 >>> 0) | 0;
+ return !(~~$0 >>> 0 | (Math_fround(Math_abs($0)) >= Math_fround(1.0) ? ($0 > Math_fround(0.0) ? ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround($0 / Math_fround(4294967296.0)))), Math_fround(4294967296.0))) >>> 0 : ~~Math_fround(Math_ceil(Math_fround(Math_fround($0 - Math_fround(~~$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0) : 0)) | 0;
}
function $48($0) {
$0 = +$0;
- return !((Math_abs($0) >= 1.0 ? ($0 > 0.0 ? ~~Math_min(Math_floor($0 / 4294967296.0), 4294967295.0) >>> 0 : ~~Math_ceil(($0 - +(~~$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0) : 0) | ~~$0 >>> 0) | 0;
+ return !(~~$0 >>> 0 | (Math_abs($0) >= 1.0 ? ($0 > 0.0 ? ~~Math_min(Math_floor($0 / 4294967296.0), 4294967295.0) >>> 0 : ~~Math_ceil(($0 - +(~~$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0) : 0)) | 0;
}
function legalstub$43($0, $1_1) {
diff --git a/test/wasm2js/get-set-local.2asm.js.opt b/test/wasm2js/get-set-local.2asm.js.opt
index 134da55b0..40a422604 100644
--- a/test/wasm2js/get-set-local.2asm.js.opt
+++ b/test/wasm2js/get-set-local.2asm.js.opt
@@ -21,11 +21,7 @@ function asmFunc(global, env, buffer) {
var nan = global.NaN;
var infinity = global.Infinity;
function legalstub$1($0, $1, $2) {
- var $3 = 0;
- $3 = $1;
- $1 = $2;
- $2 = $3 | 0;
- return !$1 & ($0 | 0) == ($2 | 0);
+ return !$2 & ($0 | 0) == ($1 | 0);
}
var FUNCTION_TABLE = [];
diff --git a/test/wasm2js/i64-add-sub.2asm.js.opt b/test/wasm2js/i64-add-sub.2asm.js.opt
index 3f4ba759a..9809a42e8 100644
--- a/test/wasm2js/i64-add-sub.2asm.js.opt
+++ b/test/wasm2js/i64-add-sub.2asm.js.opt
@@ -36,48 +36,11 @@ function asmFunc(global, env, buffer) {
}
function legalstub$1($0, $1_1, $2, $3, $4, $5) {
- var $6 = 0, $7 = 0;
- $7 = $0;
- $6 = 32;
- $0 = $6 & 31;
- if (32 >>> 0 <= $6 >>> 0) {
- $6 = $1_1 << $0;
- $0 = 0;
- } else {
- $6 = (1 << $0) - 1 & $1_1 >>> 32 - $0;
- $0 = $1_1 << $0;
- }
- $7 = $7 | $0;
- $1_1 = 32;
- $0 = $1_1 & 31;
- if (32 >>> 0 <= $1_1 >>> 0) {
- $1_1 = $3 << $0;
- $0 = 0;
- } else {
- $1_1 = (1 << $0) - 1 & $3 >>> 32 - $0;
- $0 = $3 << $0;
- }
- $3 = $0 | $2;
- $2 = $1_1;
- $1_1 = 32;
- $0 = $1_1 & 31;
- if (32 >>> 0 <= $1_1 >>> 0) {
- $1_1 = $5 << $0;
- $0 = 0;
- } else {
- $1_1 = (1 << $0) - 1 & $5 >>> 32 - $0;
- $0 = $5 << $0;
- }
- return $1($7, $6, $3, $2, $0 | $4, $1_1);
+ return $1($0, $1_1, $2, $3, $4, $5);
}
function legalstub$2($0, $1_1, $2, $3, $4, $5) {
- var $6 = 0;
- $6 = $0;
- $0 = $1_1;
- $1_1 = $3;
- $3 = $2;
- return ($4 | 0) == ($6 - $3 | 0) & ($5 | 0) == ($0 - (($6 >>> 0 < $3 >>> 0) + $1_1 | 0) | 0);
+ return ($4 | 0) == ($0 - $2 | 0) & ($5 | 0) == ($1_1 - (($0 >>> 0 < $2 >>> 0) + $3 | 0) | 0);
}
var FUNCTION_TABLE = [];
diff --git a/test/wasm2js/i64-ctz.2asm.js.opt b/test/wasm2js/i64-ctz.2asm.js.opt
index 691f5c8dd..50930e442 100644
--- a/test/wasm2js/i64-ctz.2asm.js.opt
+++ b/test/wasm2js/i64-ctz.2asm.js.opt
@@ -36,21 +36,18 @@ function asmFunc(global, env, buffer) {
}
function __wasm_ctz_i64($0, $1) {
- var $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0;
+ var $2 = 0, $3 = 0;
if ($0 | $1) {
- $4 = 63;
- $6 = $4;
$3 = $1 + -1 | 0;
- $2 = -1;
- $5 = $2 + $0 | 0;
- if ($5 >>> 0 < $2 >>> 0) {
+ $2 = $0 + -1 | 0;
+ if ($2 >>> 0 < -1 >>> 0) {
$3 = $3 + 1 | 0
}
- $2 = Math_clz32($0 ^ $5) + 32 | 0;
+ $2 = Math_clz32($0 ^ $2) + 32 | 0;
$0 = Math_clz32($1 ^ $3);
$0 = ($0 | 0) == (32 | 0) ? $2 : $0;
- $1 = $6 - $0 | 0;
- i64toi32_i32$HIGH_BITS = 0 - ($4 >>> 0 < $0 >>> 0) | 0;
+ $1 = 63 - $0 | 0;
+ i64toi32_i32$HIGH_BITS = 0 - (63 >>> 0 < $0 >>> 0) | 0;
return $1;
}
i64toi32_i32$HIGH_BITS = 0;
@@ -60,24 +57,23 @@ function asmFunc(global, env, buffer) {
function __wasm_popcnt_i64($0, $1) {
var $2 = 0, $3 = 0, $4 = 0, $5 = 0;
label$2 : while (1) {
- $3 = $4;
- $2 = $5;
+ $5 = $3;
+ $2 = $4;
if ($0 | $1) {
$2 = $0;
- $3 = 1;
- $0 = $2 - $3 & $2;
- $1 = $1 - ($2 >>> 0 < $3 >>> 0) & $1;
- $2 = 1 + $4 | 0;
- if ($2 >>> 0 < $3 >>> 0) {
- $5 = $5 + 1 | 0
+ $0 = $2 - 1 & $2;
+ $1 = $1 - ($2 >>> 0 < 1 >>> 0) & $1;
+ $2 = $3 + 1 | 0;
+ if ($2 >>> 0 < 1 >>> 0) {
+ $4 = $4 + 1 | 0
}
- $4 = $2;
+ $3 = $2;
continue;
}
break;
};
i64toi32_i32$HIGH_BITS = $2;
- return $3;
+ return $5;
}
var FUNCTION_TABLE = [];
diff --git a/test/wasm2js/i64-lowering.2asm.js.opt b/test/wasm2js/i64-lowering.2asm.js.opt
index e948447ce..eef1057f8 100644
--- a/test/wasm2js/i64-lowering.2asm.js.opt
+++ b/test/wasm2js/i64-lowering.2asm.js.opt
@@ -61,135 +61,35 @@ function asmFunc(global, env, buffer) {
}
function legalstub$3($0, $1, $2, $3_1) {
- var $4_1 = 0, $5_1 = 0;
- $5_1 = $0;
- $4_1 = 32;
- $0 = $4_1 & 31;
- if (32 >>> 0 <= $4_1 >>> 0) {
- $4_1 = $1 << $0;
- $0 = 0;
- } else {
- $4_1 = (1 << $0) - 1 & $1 >>> 32 - $0;
- $0 = $1 << $0;
- }
- $5_1 = $5_1 | $0;
- $1 = 32;
- $0 = $1 & 31;
- if (32 >>> 0 <= $1 >>> 0) {
- $1 = $3_1 << $0;
- $0 = 0;
- } else {
- $1 = (1 << $0) - 1 & $3_1 >>> 32 - $0;
- $0 = $3_1 << $0;
- }
- return $3($5_1, $4_1, $0 | $2, $1);
+ return $3($0, $1, $2, $3_1);
}
function legalstub$4($0, $1, $2, $3_1) {
- var $4_1 = 0, $5_1 = 0;
- $5_1 = $0;
- $4_1 = 32;
- $0 = $4_1 & 31;
- if (32 >>> 0 <= $4_1 >>> 0) {
- $4_1 = $1 << $0;
- $0 = 0;
- } else {
- $4_1 = (1 << $0) - 1 & $1 >>> 32 - $0;
- $0 = $1 << $0;
- }
- $5_1 = $5_1 | $0;
- $1 = 32;
- $0 = $1 & 31;
- if (32 >>> 0 <= $1 >>> 0) {
- $1 = $3_1 << $0;
- $0 = 0;
- } else {
- $1 = (1 << $0) - 1 & $3_1 >>> 32 - $0;
- $0 = $3_1 << $0;
- }
- return $4($5_1, $4_1, $0 | $2, $1);
+ return $4($0, $1, $2, $3_1);
}
function legalstub$5($0, $1, $2, $3_1) {
- var $4_1 = 0, $5_1 = 0;
- $5_1 = $0;
- $4_1 = 32;
- $0 = $4_1 & 31;
- if (32 >>> 0 <= $4_1 >>> 0) {
- $4_1 = $1 << $0;
- $0 = 0;
- } else {
- $4_1 = (1 << $0) - 1 & $1 >>> 32 - $0;
- $0 = $1 << $0;
- }
- $5_1 = $5_1 | $0;
- $1 = 32;
- $0 = $1 & 31;
- if (32 >>> 0 <= $1 >>> 0) {
- $1 = $3_1 << $0;
- $0 = 0;
- } else {
- $1 = (1 << $0) - 1 & $3_1 >>> 32 - $0;
- $0 = $3_1 << $0;
- }
- return $5($5_1, $4_1, $0 | $2, $1);
+ return $5($0, $1, $2, $3_1);
}
function legalstub$6($0, $1, $2, $3_1) {
- var $4_1 = 0, $5_1 = 0;
- $5_1 = $0;
- $4_1 = 32;
- $0 = $4_1 & 31;
- if (32 >>> 0 <= $4_1 >>> 0) {
- $4_1 = $1 << $0;
- $0 = 0;
- } else {
- $4_1 = (1 << $0) - 1 & $1 >>> 32 - $0;
- $0 = $1 << $0;
- }
- $5_1 = $5_1 | $0;
- $1 = 32;
- $0 = $1 & 31;
- if (32 >>> 0 <= $1 >>> 0) {
- $1 = $3_1 << $0;
- $0 = 0;
- } else {
- $1 = (1 << $0) - 1 & $3_1 >>> 32 - $0;
- $0 = $3_1 << $0;
- }
- return $6($5_1, $4_1, $0 | $2, $1);
+ return $6($0, $1, $2, $3_1);
}
function legalstub$7($0, $1, $2, $3_1) {
- var $4_1 = 0;
- $4_1 = $0;
- $0 = $1;
- $1 = $3_1;
- return ($0 | 0) == ($1 | 0) & $4_1 >>> 0 >= $2 >>> 0 | $0 >>> 0 > $1 >>> 0;
+ return ($1 | 0) == ($3_1 | 0) & $0 >>> 0 >= $2 >>> 0 | $1 >>> 0 > $3_1 >>> 0;
}
function legalstub$8($0, $1, $2, $3_1) {
- var $4_1 = 0;
- $4_1 = $0;
- $0 = $1;
- $1 = $3_1;
- return ($0 | 0) == ($1 | 0) & $4_1 >>> 0 > $2 >>> 0 | $0 >>> 0 > $1 >>> 0;
+ return ($1 | 0) == ($3_1 | 0) & $0 >>> 0 > $2 >>> 0 | $1 >>> 0 > $3_1 >>> 0;
}
function legalstub$9($0, $1, $2, $3_1) {
- var $4_1 = 0;
- $4_1 = $0;
- $0 = $1;
- $1 = $3_1;
- return ($0 | 0) == ($1 | 0) & $4_1 >>> 0 <= $2 >>> 0 | $0 >>> 0 < $1 >>> 0;
+ return ($1 | 0) == ($3_1 | 0) & $0 >>> 0 <= $2 >>> 0 | $1 >>> 0 < $3_1 >>> 0;
}
function legalstub$10($0, $1, $2, $3_1) {
- var $4_1 = 0;
- $4_1 = $0;
- $0 = $1;
- $1 = $3_1;
- return ($0 | 0) == ($1 | 0) & $4_1 >>> 0 < $2 >>> 0 | $0 >>> 0 < $1 >>> 0;
+ return ($1 | 0) == ($3_1 | 0) & $0 >>> 0 < $2 >>> 0 | $1 >>> 0 < $3_1 >>> 0;
}
var FUNCTION_TABLE = [];
diff --git a/test/wasm2js/i64-shifts.2asm.js.opt b/test/wasm2js/i64-shifts.2asm.js.opt
index a6606ec41..0cb2501e7 100644
--- a/test/wasm2js/i64-shifts.2asm.js.opt
+++ b/test/wasm2js/i64-shifts.2asm.js.opt
@@ -57,69 +57,11 @@ function asmFunc(global, env, buffer) {
}
function legalstub$1($0, $1_1, $2_1, $3, $4, $5) {
- var $6 = 0, $7 = 0;
- $7 = $0;
- $6 = 32;
- $0 = $6 & 31;
- if (32 >>> 0 <= $6 >>> 0) {
- $6 = $1_1 << $0;
- $0 = 0;
- } else {
- $6 = (1 << $0) - 1 & $1_1 >>> 32 - $0;
- $0 = $1_1 << $0;
- }
- $7 = $7 | $0;
- $1_1 = 32;
- $0 = $1_1 & 31;
- if (32 >>> 0 <= $1_1 >>> 0) {
- $0 = 0
- } else {
- $0 = $3 << $0
- }
- $2_1 = $0 | $2_1;
- $1_1 = 32;
- $0 = $1_1 & 31;
- if (32 >>> 0 <= $1_1 >>> 0) {
- $1_1 = $5 << $0;
- $0 = 0;
- } else {
- $1_1 = (1 << $0) - 1 & $5 >>> 32 - $0;
- $0 = $5 << $0;
- }
- return $1($7, $6, $2_1, $0 | $4, $1_1);
+ return $1($0, $1_1, $2_1, $4, $5);
}
function legalstub$2($0, $1_1, $2_1, $3, $4, $5) {
- var $6 = 0, $7 = 0;
- $7 = $0;
- $6 = 32;
- $0 = $6 & 31;
- if (32 >>> 0 <= $6 >>> 0) {
- $6 = $1_1 << $0;
- $0 = 0;
- } else {
- $6 = (1 << $0) - 1 & $1_1 >>> 32 - $0;
- $0 = $1_1 << $0;
- }
- $7 = $7 | $0;
- $1_1 = 32;
- $0 = $1_1 & 31;
- if (32 >>> 0 <= $1_1 >>> 0) {
- $0 = 0
- } else {
- $0 = $3 << $0
- }
- $2_1 = $0 | $2_1;
- $1_1 = 32;
- $0 = $1_1 & 31;
- if (32 >>> 0 <= $1_1 >>> 0) {
- $1_1 = $5 << $0;
- $0 = 0;
- } else {
- $1_1 = (1 << $0) - 1 & $5 >>> 32 - $0;
- $0 = $5 << $0;
- }
- return $2($7, $6, $2_1, $0 | $4, $1_1);
+ return $2($0, $1_1, $2_1, $4, $5);
}
var FUNCTION_TABLE = [];
diff --git a/test/wasm2js/reinterpret.2asm.js.opt b/test/wasm2js/reinterpret.2asm.js.opt
index 4c9856ca0..58c2057b6 100644
--- a/test/wasm2js/reinterpret.2asm.js.opt
+++ b/test/wasm2js/reinterpret.2asm.js.opt
@@ -67,18 +67,7 @@ function asmFunc(global, env, buffer) {
}
function legalstub$2($0, $1_1) {
- var $2_1 = 0, $3 = 0;
- $3 = $0;
- $2_1 = 32;
- $0 = $2_1 & 31;
- if (32 >>> 0 <= $2_1 >>> 0) {
- $2_1 = $1_1 << $0;
- $0 = 0;
- } else {
- $2_1 = (1 << $0) - 1 & $1_1 >>> 32 - $0;
- $0 = $1_1 << $0;
- }
- return $2($3 | $0, $2_1);
+ return $2($0, $1_1);
}
var FUNCTION_TABLE = [];
diff --git a/test/wasm2js/stack-modified.2asm.js.opt b/test/wasm2js/stack-modified.2asm.js.opt
index baabfe868..c5190792d 100644
--- a/test/wasm2js/stack-modified.2asm.js.opt
+++ b/test/wasm2js/stack-modified.2asm.js.opt
@@ -45,55 +45,25 @@ function asmFunc(global, env, buffer) {
}
function legalstub$0($0_1, $1) {
- var $2 = 0, $3 = 0;
- $3 = $0_1;
- $2 = 32;
- $0_1 = $2 & 31;
- if (32 >>> 0 <= $2 >>> 0) {
- $2 = $1 << $0_1;
- $0_1 = 0;
- } else {
- $2 = (1 << $0_1) - 1 & $1 >>> 32 - $0_1;
- $0_1 = $1 << $0_1;
- }
- $0_1 = $0($3 | $0_1, $2);
- $1 = i64toi32_i32$HIGH_BITS;
- $3 = 32;
- $2 = $3 & 31;
- setTempRet0((32 >>> 0 <= $3 >>> 0 ? $1 >>> $2 : ((1 << $2) - 1 & $1) << 32 - $2 | $0_1 >>> $2) | 0);
+ $0_1 = $0($0_1, $1);
+ setTempRet0(i64toi32_i32$HIGH_BITS | 0);
return $0_1;
}
function _ZN17compiler_builtins3int3mul3Mul3mul17h070e9a1c69faec5bE($0_1, $1, $2, $3) {
- var $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $10 = 0;
- $6 = $2 >>> 16;
- $10 = $0_1;
- $7 = $0_1 >>> 16;
- $5 = Math_imul($6, $7);
- $4 = $2 & 65535;
- $8 = $0_1 & 65535;
- $9 = Math_imul($4, $8);
- $7 = ($9 >>> 16) + Math_imul($4, $7) | 0;
- $6 = ($7 & 65535) + Math_imul($6, $8) | 0;
- $8 = $5;
- $5 = 32;
- $4 = $5 & 31;
- $5 = $8 + Math_imul(32 >>> 0 <= $5 >>> 0 ? $1 >>> $4 : ((1 << $4) - 1 & $1) << 32 - $4 | $0_1 >>> $4, $2) | 0;
- $1 = $2;
- $2 = 32;
- $0_1 = $2 & 31;
- $1 = (($5 + Math_imul($10, 32 >>> 0 <= $2 >>> 0 ? $3 >>> $0_1 : ((1 << $0_1) - 1 & $3) << 32 - $0_1 | $1 >>> $0_1) | 0) + ($7 >>> 16) | 0) + ($6 >>> 16) | 0;
- $0_1 = 32 & 31;
- if (32 >>> 0 <= $2 >>> 0) {
- $2 = $1 << $0_1;
- $0_1 = 0;
- } else {
- $2 = (1 << $0_1) - 1 & $1 >>> 32 - $0_1;
- $0_1 = $1 << $0_1;
- }
- $0_1 = $0_1 | ($9 & 65535 | $6 << 16);
- i64toi32_i32$HIGH_BITS = $2;
- return $0_1;
+ var $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0;
+ $4 = $2 >>> 16;
+ $5 = $0_1 >>> 16;
+ $9 = Math_imul($4, $5);
+ $6 = $2 & 65535;
+ $7 = $0_1 & 65535;
+ $8 = Math_imul($6, $7);
+ $5 = ($8 >>> 16) + Math_imul($5, $6) | 0;
+ $4 = ($5 & 65535) + Math_imul($4, $7) | 0;
+ $0_1 = (((Math_imul($1, $2) + $9 | 0) + Math_imul($0_1, $3) | 0) + ($5 >>> 16) | 0) + ($4 >>> 16) | 0;
+ $1 = $8 & 65535 | $4 << 16;
+ i64toi32_i32$HIGH_BITS = $0_1;
+ return $1;
}
var FUNCTION_TABLE = [];
diff --git a/test/wasm2js/unaligned.2asm.js.opt b/test/wasm2js/unaligned.2asm.js.opt
index bbca2c8bf..c765fbc46 100644
--- a/test/wasm2js/unaligned.2asm.js.opt
+++ b/test/wasm2js/unaligned.2asm.js.opt
@@ -104,13 +104,10 @@ function asmFunc(global, env, buffer) {
}
function legalstub$1() {
- var $0_1 = 0, $1_1 = 0, $2_1 = 0, $3_1 = 0;
- $1_1 = $1();
- $2_1 = i64toi32_i32$HIGH_BITS;
- $3_1 = 32;
- $0_1 = $3_1 & 31;
- setTempRet0((32 >>> 0 <= $3_1 >>> 0 ? $2_1 >>> $0_1 : ((1 << $0_1) - 1 & $2_1) << 32 - $0_1 | $1_1 >>> $0_1) | 0);
- return $1_1;
+ var $0_1 = 0;
+ $0_1 = $1();
+ setTempRet0(i64toi32_i32$HIGH_BITS | 0);
+ return $0_1;
}
var FUNCTION_TABLE = [];
diff --git a/test/wasm2js/unary-ops.2asm.js.opt b/test/wasm2js/unary-ops.2asm.js.opt
index 7dcc1c85c..836400f0e 100644
--- a/test/wasm2js/unary-ops.2asm.js.opt
+++ b/test/wasm2js/unary-ops.2asm.js.opt
@@ -57,11 +57,7 @@ function asmFunc(global, env, buffer) {
}
function legalstub$3($0, $1_1, $2) {
- var $3 = 0;
- $3 = $1_1;
- $1_1 = $2;
- $2 = $3 | 0;
- return !$1_1 & ($0 | 0) == ($2 | 0);
+ return !$2 & ($0 | 0) == ($1_1 | 0);
}
function legalstub$4($0, $1_1, $2) {
@@ -73,28 +69,7 @@ function asmFunc(global, env, buffer) {
}
function legalstub$8($0, $1_1, $2, $3) {
- var $4 = 0, $5 = 0;
- $5 = $0;
- $4 = 32;
- $0 = $4 & 31;
- if (32 >>> 0 <= $4 >>> 0) {
- $4 = $1_1 << $0;
- $0 = 0;
- } else {
- $4 = (1 << $0) - 1 & $1_1 >>> 32 - $0;
- $0 = $1_1 << $0;
- }
- $5 = $5 | $0;
- $1_1 = 32;
- $0 = $1_1 & 31;
- if (32 >>> 0 <= $1_1 >>> 0) {
- $1_1 = $3 << $0;
- $0 = 0;
- } else {
- $1_1 = (1 << $0) - 1 & $3 >>> 32 - $0;
- $0 = $3 << $0;
- }
- return $8($5, $4, $0 | $2, $1_1);
+ return $8($0, $1_1, $2, $3);
}
function legalstub$9($0, $1_1, $2, $3) {
@@ -102,21 +77,18 @@ function asmFunc(global, env, buffer) {
}
function __wasm_ctz_i64($0, $1_1) {
- var $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6_1 = 0;
+ var $2 = 0, $3 = 0;
if ($0 | $1_1) {
- $4 = 63;
- $6_1 = $4;
$3 = $1_1 + -1 | 0;
- $2 = -1;
- $5 = $2 + $0 | 0;
- if ($5 >>> 0 < $2 >>> 0) {
+ $2 = $0 + -1 | 0;
+ if ($2 >>> 0 < -1 >>> 0) {
$3 = $3 + 1 | 0
}
- $2 = Math_clz32($0 ^ $5) + 32 | 0;
+ $2 = Math_clz32($0 ^ $2) + 32 | 0;
$0 = Math_clz32($1_1 ^ $3);
$0 = ($0 | 0) == (32 | 0) ? $2 : $0;
- $1_1 = $6_1 - $0 | 0;
- i64toi32_i32$HIGH_BITS = 0 - ($4 >>> 0 < $0 >>> 0) | 0;
+ $1_1 = 63 - $0 | 0;
+ i64toi32_i32$HIGH_BITS = 0 - (63 >>> 0 < $0 >>> 0) | 0;
return $1_1;
}
i64toi32_i32$HIGH_BITS = 0;
@@ -140,24 +112,23 @@ function asmFunc(global, env, buffer) {
function __wasm_popcnt_i64($0, $1_1) {
var $2 = 0, $3 = 0, $4 = 0, $5 = 0;
label$2 : while (1) {
- $3 = $4;
- $2 = $5;
+ $5 = $3;
+ $2 = $4;
if ($0 | $1_1) {
$2 = $0;
- $3 = 1;
- $0 = $2 - $3 & $2;
- $1_1 = $1_1 - ($2 >>> 0 < $3 >>> 0) & $1_1;
- $2 = 1 + $4 | 0;
- if ($2 >>> 0 < $3 >>> 0) {
- $5 = $5 + 1 | 0
+ $0 = $2 - 1 & $2;
+ $1_1 = $1_1 - ($2 >>> 0 < 1 >>> 0) & $1_1;
+ $2 = $3 + 1 | 0;
+ if ($2 >>> 0 < 1 >>> 0) {
+ $4 = $4 + 1 | 0
}
- $4 = $2;
+ $3 = $2;
continue;
}
break;
};
i64toi32_i32$HIGH_BITS = $2;
- return $3;
+ return $5;
}
var FUNCTION_TABLE = [];