summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-05-19 16:14:00 -0500
committerAlon Zakai <alonzakai@gmail.com>2018-05-19 14:14:00 -0700
commitd0ce93f8d7a08017618839498a9b920bbb132267 (patch)
tree752e836fcd09e37c6e7963622ac5d35aa2021d18 /test
parentcb64ec3879db3422ac4afd3119938f8dfe7b7b05 (diff)
downloadbinaryen-d0ce93f8d7a08017618839498a9b920bbb132267.tar.gz
binaryen-d0ce93f8d7a08017618839498a9b920bbb132267.tar.bz2
binaryen-d0ce93f8d7a08017618839498a9b920bbb132267.zip
wasm2asm: Finish f32/f64 operations (#1554)
Diffstat (limited to 'test')
-rw-r--r--test/binaryen.js/emit_asmjs.js.txt36
-rw-r--r--test/passes/remove-copysign.txt40
-rw-r--r--test/passes/remove-copysign.wast7
-rw-r--r--test/passes/remove-non-js-ops.txt368
-rw-r--r--test/passes/remove-non-js-ops.wast27
-rw-r--r--test/wasm2asm.asserts.js44
-rw-r--r--test/wasm2asm.traps.js44
-rw-r--r--test/wasm2asm/address.2asm.js36
-rw-r--r--test/wasm2asm/br_table_temp.2asm.js487
-rw-r--r--test/wasm2asm/conversions-modified.2asm.js130
-rw-r--r--test/wasm2asm/empty_imported_table.2asm.js36
-rw-r--r--test/wasm2asm/empty_table.2asm.js36
-rw-r--r--test/wasm2asm/f32.2asm.js139
-rw-r--r--test/wasm2asm/f32_cmp.2asm.js66
-rw-r--r--test/wasm2asm/f64.2asm.js166
-rw-r--r--test/wasm2asm/f64_cmp.2asm.js66
-rw-r--r--test/wasm2asm/float-ops.2asm.js132
-rw-r--r--test/wasm2asm/float_misc.2asm.js281
-rw-r--r--test/wasm2asm/forward.2asm.js48
-rw-r--r--test/wasm2asm/get-set-local.2asm.js43
-rw-r--r--test/wasm2asm/grow_memory.2asm.js36
-rw-r--r--test/wasm2asm/hello_world.2asm.js36
-rw-r--r--test/wasm2asm/i32.2asm.js20
-rw-r--r--test/wasm2asm/i64-add-sub.2asm.js60
-rw-r--r--test/wasm2asm/i64-lowering.2asm.js140
-rw-r--r--test/wasm2asm/i64-rotate.2asm.js68
-rw-r--r--test/wasm2asm/i64-shifts.2asm.js64
-rw-r--r--test/wasm2asm/reinterpret.2asm.js47
-rw-r--r--test/wasm2asm/unary-ops.2asm.js74
29 files changed, 1668 insertions, 1109 deletions
diff --git a/test/binaryen.js/emit_asmjs.js.txt b/test/binaryen.js/emit_asmjs.js.txt
index d329b7116..0da5537a8 100644
--- a/test/binaryen.js/emit_asmjs.js.txt
+++ b/test/binaryen.js/emit_asmjs.js.txt
@@ -23,42 +23,6 @@ function asmFunc(global, env, buffer) {
return $0 | 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;
- 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);
- };
- return $2 | 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 {
main: main
};
diff --git a/test/passes/remove-copysign.txt b/test/passes/remove-copysign.txt
deleted file mode 100644
index b411f083b..000000000
--- a/test/passes/remove-copysign.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-(module
- (type $0 (func (param f64 f64) (result f64)))
- (type $1 (func (param f32 f32) (result f32)))
- (func $copysign64 (; 0 ;) (type $0) (param $0 f64) (param $1 f64) (result f64)
- (f64.reinterpret/i64
- (i64.or
- (i64.and
- (i64.reinterpret/f64
- (get_local $0)
- )
- (i64.const 9223372036854775807)
- )
- (i64.and
- (i64.reinterpret/f64
- (get_local $1)
- )
- (i64.const -9223372036854775808)
- )
- )
- )
- )
- (func $copysign32 (; 1 ;) (type $1) (param $0 f32) (param $1 f32) (result f32)
- (f32.reinterpret/i32
- (i32.or
- (i32.and
- (i32.reinterpret/f32
- (get_local $0)
- )
- (i32.const 2147483647)
- )
- (i32.and
- (i32.reinterpret/f32
- (get_local $1)
- )
- (i32.const -2147483648)
- )
- )
- )
- )
-)
diff --git a/test/passes/remove-copysign.wast b/test/passes/remove-copysign.wast
deleted file mode 100644
index d64a30965..000000000
--- a/test/passes/remove-copysign.wast
+++ /dev/null
@@ -1,7 +0,0 @@
-(module
- (func $copysign64 (param $0 f64) (param $1 f64) (result f64)
- (f64.copysign (get_local $0) (get_local $1)))
- (func $copysign32 (param $0 f32) (param $1 f32) (result f32)
- (f32.copysign (get_local $0) (get_local $1)))
-)
-
diff --git a/test/passes/remove-non-js-ops.txt b/test/passes/remove-non-js-ops.txt
new file mode 100644
index 000000000..d326b51ea
--- /dev/null
+++ b/test/passes/remove-non-js-ops.txt
@@ -0,0 +1,368 @@
+(module
+ (type $0 (func (param f64 f64) (result f64)))
+ (type $1 (func (param f32 f32) (result f32)))
+ (type $2 (func (param i32 i32) (result i32)))
+ (type $3 (func (param f64) (result f64)))
+ (type $4 (func (param f32) (result f32)))
+ (type $5 (func (param i32) (result i32)))
+ (func $copysign64 (; 0 ;) (type $0) (param $0 f64) (param $1 f64) (result f64)
+ (f64.reinterpret/i64
+ (i64.or
+ (i64.and
+ (i64.reinterpret/f64
+ (get_local $0)
+ )
+ (i64.const 9223372036854775807)
+ )
+ (i64.and
+ (i64.reinterpret/f64
+ (get_local $1)
+ )
+ (i64.const -9223372036854775808)
+ )
+ )
+ )
+ )
+ (func $copysign32 (; 1 ;) (type $1) (param $0 f32) (param $1 f32) (result f32)
+ (f32.reinterpret/i32
+ (i32.or
+ (i32.and
+ (i32.reinterpret/f32
+ (get_local $0)
+ )
+ (i32.const 2147483647)
+ )
+ (i32.and
+ (i32.reinterpret/f32
+ (get_local $1)
+ )
+ (i32.const -2147483648)
+ )
+ )
+ )
+ )
+ (func $rotl32 (; 2 ;) (type $2) (param $0 i32) (param $1 i32) (result i32)
+ (call $__wasm_rotl_i32
+ (get_local $0)
+ (get_local $1)
+ )
+ )
+ (func $rotr32 (; 3 ;) (type $2) (param $0 i32) (param $1 i32) (result i32)
+ (call $__wasm_rotr_i32
+ (get_local $0)
+ (get_local $1)
+ )
+ )
+ (func $nearest64 (; 4 ;) (type $3) (param $0 f64) (result f64)
+ (call $__wasm_nearest_f64
+ (get_local $0)
+ )
+ )
+ (func $nearest32 (; 5 ;) (type $4) (param $0 f32) (result f32)
+ (call $__wasm_nearest_f32
+ (get_local $0)
+ )
+ )
+ (func $trunc64 (; 6 ;) (type $3) (param $0 f64) (result f64)
+ (call $__wasm_trunc_f64
+ (get_local $0)
+ )
+ )
+ (func $trunc32 (; 7 ;) (type $4) (param $0 f32) (result f32)
+ (call $__wasm_trunc_f32
+ (get_local $0)
+ )
+ )
+ (func $popcnt32 (; 8 ;) (type $5) (param $0 i32) (result i32)
+ (call $__wasm_popcnt_i32
+ (get_local $0)
+ )
+ )
+ (func $ctz32 (; 9 ;) (type $5) (param $0 i32) (result i32)
+ (call $__wasm_ctz_i32
+ (get_local $0)
+ )
+ )
+ (func $__wasm_nearest_f32 (; 10 ;) (param $0 f32) (result f32)
+ (local $1 f32)
+ (local $2 f32)
+ (local $3 f32)
+ (local $4 f32)
+ (local $5 f32)
+ (set_local $1
+ (f32.ceil
+ (get_local $0)
+ )
+ )
+ (set_local $2
+ (f32.floor
+ (get_local $0)
+ )
+ )
+ (set_local $3
+ (f32.sub
+ (get_local $0)
+ (get_local $2)
+ )
+ )
+ (if (result f32)
+ (f32.lt
+ (get_local $3)
+ (f32.const 0.5)
+ )
+ (get_local $2)
+ (if (result f32)
+ (f32.gt
+ (get_local $3)
+ (f32.const 0.5)
+ )
+ (get_local $1)
+ (block (result f32)
+ (set_local $4
+ (f32.div
+ (get_local $2)
+ (f32.const 2)
+ )
+ )
+ (if (result f32)
+ (f32.eq
+ (f32.sub
+ (get_local $4)
+ (f32.floor
+ (get_local $4)
+ )
+ )
+ (f32.const 0)
+ )
+ (get_local $2)
+ (get_local $1)
+ )
+ )
+ )
+ )
+ )
+ (func $__wasm_nearest_f64 (; 11 ;) (param $0 f64) (result f64)
+ (local $1 f64)
+ (local $2 f64)
+ (local $3 f64)
+ (local $4 f64)
+ (local $5 f64)
+ (set_local $1
+ (f64.ceil
+ (get_local $0)
+ )
+ )
+ (set_local $2
+ (f64.floor
+ (get_local $0)
+ )
+ )
+ (set_local $3
+ (f64.sub
+ (get_local $0)
+ (get_local $2)
+ )
+ )
+ (if (result f64)
+ (f64.lt
+ (get_local $3)
+ (f64.const 0.5)
+ )
+ (get_local $2)
+ (if (result f64)
+ (f64.gt
+ (get_local $3)
+ (f64.const 0.5)
+ )
+ (get_local $1)
+ (block (result f64)
+ (set_local $4
+ (f64.div
+ (get_local $2)
+ (f64.const 2)
+ )
+ )
+ (if (result f64)
+ (f64.eq
+ (f64.sub
+ (get_local $4)
+ (f64.floor
+ (get_local $4)
+ )
+ )
+ (f64.const 0)
+ )
+ (get_local $2)
+ (get_local $1)
+ )
+ )
+ )
+ )
+ )
+ (func $__wasm_trunc_f32 (; 12 ;) (param $0 f32) (result f32)
+ (if (result f32)
+ (f32.lt
+ (get_local $0)
+ (f32.const 0)
+ )
+ (f32.ceil
+ (get_local $0)
+ )
+ (f32.floor
+ (get_local $0)
+ )
+ )
+ )
+ (func $__wasm_trunc_f64 (; 13 ;) (param $0 f64) (result f64)
+ (if (result f64)
+ (f64.lt
+ (get_local $0)
+ (f64.const 0)
+ )
+ (f64.ceil
+ (get_local $0)
+ )
+ (f64.floor
+ (get_local $0)
+ )
+ )
+ )
+ (func $__wasm_ctz_i32 (; 14 ;) (param $x i32) (result i32)
+ (if (result i32)
+ (i32.eqz
+ (get_local $x)
+ )
+ (i32.const 32)
+ (i32.sub
+ (i32.const 31)
+ (i32.clz
+ (i32.xor
+ (get_local $x)
+ (i32.sub
+ (get_local $x)
+ (i32.const 1)
+ )
+ )
+ )
+ )
+ )
+ )
+ (func $__wasm_popcnt_i32 (; 15 ;) (param $x i32) (result i32)
+ (local $count i32)
+ (set_local $count
+ (i32.const 0)
+ )
+ (block $b (result i32)
+ (loop $l
+ (drop
+ (br_if $b
+ (get_local $count)
+ (i32.eqz
+ (get_local $x)
+ )
+ )
+ )
+ (set_local $x
+ (i32.and
+ (get_local $x)
+ (i32.sub
+ (get_local $x)
+ (i32.const 1)
+ )
+ )
+ )
+ (set_local $count
+ (i32.add
+ (get_local $count)
+ (i32.const 1)
+ )
+ )
+ (br $l)
+ )
+ )
+ )
+ (func $__wasm_rotl_i32 (; 16 ;) (param $x i32) (param $k i32) (result i32)
+ (i32.or
+ (i32.shl
+ (i32.and
+ (i32.shr_u
+ (i32.const -1)
+ (i32.and
+ (get_local $k)
+ (i32.const 31)
+ )
+ )
+ (get_local $x)
+ )
+ (i32.and
+ (get_local $k)
+ (i32.const 31)
+ )
+ )
+ (i32.shr_u
+ (i32.and
+ (i32.shl
+ (i32.const -1)
+ (i32.sub
+ (i32.const 32)
+ (i32.and
+ (get_local $k)
+ (i32.const 31)
+ )
+ )
+ )
+ (get_local $x)
+ )
+ (i32.sub
+ (i32.const 32)
+ (i32.and
+ (get_local $k)
+ (i32.const 31)
+ )
+ )
+ )
+ )
+ )
+ (func $__wasm_rotr_i32 (; 17 ;) (param $x i32) (param $k i32) (result i32)
+ (i32.or
+ (i32.shr_u
+ (i32.and
+ (i32.shl
+ (i32.const -1)
+ (i32.and
+ (get_local $k)
+ (i32.const 31)
+ )
+ )
+ (get_local $x)
+ )
+ (i32.and
+ (get_local $k)
+ (i32.const 31)
+ )
+ )
+ (i32.shl
+ (i32.and
+ (i32.shr_u
+ (i32.const -1)
+ (i32.sub
+ (i32.const 32)
+ (i32.and
+ (get_local $k)
+ (i32.const 31)
+ )
+ )
+ )
+ (get_local $x)
+ )
+ (i32.sub
+ (i32.const 32)
+ (i32.and
+ (get_local $k)
+ (i32.const 31)
+ )
+ )
+ )
+ )
+ )
+)
diff --git a/test/passes/remove-non-js-ops.wast b/test/passes/remove-non-js-ops.wast
new file mode 100644
index 000000000..884fe367d
--- /dev/null
+++ b/test/passes/remove-non-js-ops.wast
@@ -0,0 +1,27 @@
+(module
+ (func $copysign64 (param $0 f64) (param $1 f64) (result f64)
+ (f64.copysign (get_local $0) (get_local $1)))
+ (func $copysign32 (param $0 f32) (param $1 f32) (result f32)
+ (f32.copysign (get_local $0) (get_local $1)))
+
+ (func $rotl32 (param $0 i32) (param $1 i32) (result i32)
+ (i32.rotl (get_local $0) (get_local $1)))
+ (func $rotr32 (param $0 i32) (param $1 i32) (result i32)
+ (i32.rotr (get_local $0) (get_local $1)))
+
+ (func $nearest64 (param $0 f64) (result f64)
+ (f64.nearest (get_local $0)))
+ (func $nearest32 (param $0 f32) (result f32)
+ (f32.nearest (get_local $0)))
+
+ (func $trunc64 (param $0 f64) (result f64)
+ (f64.trunc (get_local $0)))
+ (func $trunc32 (param $0 f32) (result f32)
+ (f32.trunc (get_local $0)))
+
+ (func $popcnt32 (param $0 i32) (result i32)
+ (i32.popcnt (get_local $0)))
+ (func $ctz32 (param $0 i32) (result i32)
+ (i32.ctz (get_local $0)))
+)
+
diff --git a/test/wasm2asm.asserts.js b/test/wasm2asm.asserts.js
index a79b4dc7a..72d2e893c 100644
--- a/test/wasm2asm.asserts.js
+++ b/test/wasm2asm.asserts.js
@@ -34,42 +34,6 @@ function asmFunc(global, env, buffer) {
return (x | 0) / (y | 0) | 0 | 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;
- 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);
- };
- return $2 | 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;
- }
-
function __wasm_fetch_high_bits() {
return i64toi32_i32$HIGH_BITS | 0;
}
@@ -116,11 +80,11 @@ var asmModule = asmFunc({
var i = new Int32Array(2);
var f = new Float64Array(i.buffer);
f[0] = a;
- var ai1 = f[0];
- var ai2 = f[1];
+ var ai1 = i[0];
+ var ai2 = i[1];
f[0] = b;
- var bi1 = f[0];
- var bi2 = f[1];
+ var bi1 = i[0];
+ var bi2 = i[1];
return (isNaN(a) && isNaN(b)) || (ai1 == bi1 && ai2 == bi2);
}
diff --git a/test/wasm2asm.traps.js b/test/wasm2asm.traps.js
index cc16410f1..3c393454e 100644
--- a/test/wasm2asm.traps.js
+++ b/test/wasm2asm.traps.js
@@ -34,42 +34,6 @@ function asmFunc(global, env, buffer) {
return (x | 0) / (y | 0) | 0 | 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;
- 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);
- };
- return $2 | 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;
- }
-
function __wasm_fetch_high_bits() {
return i64toi32_i32$HIGH_BITS | 0;
}
@@ -116,11 +80,11 @@ var asmModule = asmFunc({
var i = new Int32Array(2);
var f = new Float64Array(i.buffer);
f[0] = a;
- var ai1 = f[0];
- var ai2 = f[1];
+ var ai1 = i[0];
+ var ai2 = i[1];
f[0] = b;
- var bi1 = f[0];
- var bi2 = f[1];
+ var bi1 = i[0];
+ var bi2 = i[1];
return (isNaN(a) && isNaN(b)) || (ai1 == bi1 && ai2 == bi2);
}
diff --git a/test/wasm2asm/address.2asm.js b/test/wasm2asm/address.2asm.js
index 1cc7ba73f..823fbfbee 100644
--- a/test/wasm2asm/address.2asm.js
+++ b/test/wasm2asm/address.2asm.js
@@ -42,42 +42,6 @@ function asmFunc(global, env, buffer) {
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;
- 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);
- };
- return $2 | 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: $0,
bad: $1
diff --git a/test/wasm2asm/br_table_temp.2asm.js b/test/wasm2asm/br_table_temp.2asm.js
index 3755d7034..db022539f 100644
--- a/test/wasm2asm/br_table_temp.2asm.js
+++ b/test/wasm2asm/br_table_temp.2asm.js
@@ -39,9 +39,9 @@ function asmFunc(global, env, buffer) {
}
function $5() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 1;
+ $1 = 1;
switch (0 | 0) {
case 0:
break block;
@@ -49,40 +49,32 @@ function asmFunc(global, env, buffer) {
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $6() {
- var i64toi32_i32$1 = 0, i64toi32_i32$0 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0;
+ var i64toi32_i32$0 = 0, $1 = 0, $1$hi = 0;
block : {
- $i64toi32_block_1 : {
- $i64toi32_block_0 : {
- i64toi32_i32$0 = 0;
- $2 = 2;
- $4 = $2;
- $5 = $2;
- switch (0 | 0) {
- case 0:
- break $i64toi32_block_0;
- default:
- break $i64toi32_block_1;
- };
- };
- i64toi32_i32$1 = $4;
- $3 = i64toi32_i32$1;
+ i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ $1 = 2;
+ $1$hi = i64toi32_i32$0;
+ switch (0 | 0) {
+ case 0:
+ break block;
+ default:
break block;
};
- i64toi32_i32$1 = $5;
- $3 = i64toi32_i32$1;
- break block;
};
- return $3 | 0;
+ i64toi32_i32$0 = $1$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return $1 | 0;
}
function $7() {
- var $0 = Math_fround(0);
+ var $1 = Math_fround(0);
block : {
- $0 = Math_fround(3.0);
+ $1 = Math_fround(3.0);
switch (0 | 0) {
case 0:
break block;
@@ -90,13 +82,13 @@ function asmFunc(global, env, buffer) {
break block;
};
};
- return Math_fround($0);
+ return Math_fround($1);
}
function $8() {
- var $0 = 0.0;
+ var $1 = 0.0;
block : {
- $0 = 4.0;
+ $1 = 4.0;
switch (0 | 0) {
case 0:
break block;
@@ -104,7 +96,7 @@ function asmFunc(global, env, buffer) {
break block;
};
};
- return +$0;
+ return +$1;
}
function $9($0) {
@@ -114,15 +106,15 @@ function asmFunc(global, env, buffer) {
function $10($0) {
$0 = $0 | 0;
- var $1 = 0;
+ var $3 = 0;
block : {
- $1 = 33;
+ $3 = 33;
switch ($0 | 0) {
default:
break block;
};
};
- return $1 | 0;
+ return $3 | 0;
}
function $11($0) {
@@ -143,12 +135,12 @@ function asmFunc(global, env, buffer) {
function $12($0) {
$0 = $0 | 0;
- var $1 = 0, $2 = 0, $3 = 0;
+ var $2 = 0, $3 = 0, $4 = 0;
block : {
block1 : {
- $1 = 33;
- $2 = $1;
- $3 = $1;
+ $2 = 33;
+ $3 = $2;
+ $4 = $2;
switch ($0 | 0) {
case 0:
break block1;
@@ -156,9 +148,9 @@ function asmFunc(global, env, buffer) {
break block;
};
};
- $2 = 32;
+ $3 = 32;
};
- return $2 | 0;
+ return $3 | 0;
}
function $13($0) {
@@ -194,18 +186,18 @@ function asmFunc(global, env, buffer) {
function $14($0) {
$0 = $0 | 0;
- var $1 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0;
+ var $1 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0;
block : {
block6 : {
block7 : {
block8 : {
block9 : {
- $2 = 200;
- $3 = $2;
- $4 = $2;
- $5 = $2;
- $6 = $2;
- $7 = $2;
+ $3 = 200;
+ $4 = $3;
+ $5 = $3;
+ $6 = $3;
+ $7 = $3;
+ $8 = $3;
switch ($0 | 0) {
case 0:
break block6;
@@ -219,19 +211,19 @@ function asmFunc(global, env, buffer) {
break block;
};
};
- $1 = $7;
+ $1 = $8;
return $1 + 10 | 0 | 0;
};
- $1 = $6;
+ $1 = $7;
return $1 + 11 | 0 | 0;
};
- $1 = $5;
+ $1 = $6;
return $1 + 12 | 0 | 0;
};
- $1 = $4;
+ $1 = $5;
return $1 + 13 | 0 | 0;
};
- $1 = $3;
+ $1 = $4;
return $1 + 14 | 0 | 0;
}
@@ -49512,10 +49504,10 @@ function asmFunc(global, env, buffer) {
}
function $19() {
- var $0 = 0;
+ var $1 = 0;
block : {
dummy();
- $0 = 2;
+ $1 = 2;
switch (0 | 0) {
case 0:
break block;
@@ -49525,14 +49517,14 @@ function asmFunc(global, env, buffer) {
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $20() {
- var $0 = 0, $1 = 0;
+ var $1 = 0, $2 = 0, $4 = 0;
fake_return_waka123 : {
loop_in : do {
- $0 = 3;
+ $1 = 3;
switch (0 | 0) {
case 0:
break fake_return_waka123;
@@ -49542,15 +49534,15 @@ function asmFunc(global, env, buffer) {
break loop_in;
} while (1);
};
- return $0 | 0;
+ return $1 | 0;
}
function $21() {
- var $0 = 0, $1 = 0;
+ var $1 = 0, $2 = 0, $4 = 0;
fake_return_waka123 : {
loop_in : do {
dummy();
- $0 = 4;
+ $1 = 4;
switch (4294967295 | 0) {
case 0:
break fake_return_waka123;
@@ -49562,15 +49554,15 @@ function asmFunc(global, env, buffer) {
break loop_in;
} while (1);
};
- return $0 | 0;
+ return $1 | 0;
}
function $22() {
- var $0 = 0;
+ var $1 = 0;
fake_return_waka123 : {
loop_in : do {
dummy();
- $0 = 5;
+ $1 = 5;
switch (1 | 0) {
case 0:
break fake_return_waka123;
@@ -49582,7 +49574,7 @@ function asmFunc(global, env, buffer) {
break loop_in;
} while (1);
};
- return $0 | 0;
+ return $1 | 0;
}
function $23() {
@@ -49599,21 +49591,21 @@ function asmFunc(global, env, buffer) {
}
function $25() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 8;
+ $1 = 8;
switch (0 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $26() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 9;
+ $1 = 9;
switch (0 | 0) {
case 0:
break block;
@@ -49621,7 +49613,7 @@ function asmFunc(global, env, buffer) {
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $27() {
@@ -49629,85 +49621,85 @@ function asmFunc(global, env, buffer) {
}
function $28() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 10;
+ $1 = 10;
switch (0 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $29() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 11;
+ $1 = 11;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $30() {
- var i64toi32_i32$0 = 0, $1 = 0, $2 = 0;
+ var i64toi32_i32$0 = 0, $1 = 0, $1$hi = 0;
block : {
- $i64toi32_block_0 : {
- i64toi32_i32$0 = 0;
- $1 = 7;
- switch (0 | 0) {
- default:
- break $i64toi32_block_0;
- };
+ i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ $1 = 7;
+ $1$hi = i64toi32_i32$0;
+ switch (0 | 0) {
+ default:
+ break block;
};
- $2 = $1;
- break block;
};
- return $2 | 0;
+ i64toi32_i32$0 = $1$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return $1 | 0;
}
function $31() {
- var $0 = 0, $1 = 0;
+ var $1 = 0, $2 = 0;
if_ : {
- $0 = 2;
+ $1 = 2;
switch (0 | 0) {
default:
break if_;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $32($0, $1) {
$0 = $0 | 0;
$1 = $1 | 0;
- var $2 = 0, $3 = 0;
+ var $4 = 0, $6 = 0;
block : {
if ($0) {
- $2 = 3;
+ $4 = 3;
switch (0 | 0) {
default:
break block;
};
- } else $3 = $1;
- $2 = $3;
+ } else $6 = $1;
+ $4 = $6;
};
- return $2 | 0;
+ return $4 | 0;
}
function $33($0, $1) {
$0 = $0 | 0;
$1 = $1 | 0;
- var $2 = 0, $3 = 0, $4 = 0, $5 = 0;
+ var $4 = 0, $5 = 0, $6 = 0, $7 = 0;
block : {
if_ : {
- if ($0) $5 = $1; else {
- $2 = 4;
- $3 = $2;
- $4 = $2;
+ if ($0) $7 = $1; else {
+ $4 = 4;
+ $5 = $4;
+ $6 = $4;
switch (0 | 0) {
case 0:
break block;
@@ -49715,52 +49707,52 @@ function asmFunc(global, env, buffer) {
break if_;
};
}
- $4 = $5;
+ $6 = $7;
};
- $3 = $4;
+ $5 = $6;
};
- return $3 | 0;
+ return $5 | 0;
}
function $34($0, $1) {
$0 = $0 | 0;
$1 = $1 | 0;
- var $2 = 0, $3 = 0, $4 = 0;
+ var $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0;
block : {
- $2 = 5;
+ $3 = 5;
switch (0 | 0) {
default:
break block;
};
};
- return $2 | 0;
+ return $3 | 0;
}
function $35($0, $1) {
$0 = $0 | 0;
$1 = $1 | 0;
- var $2 = 0, $3 = 0, $4 = 0;
+ var $2 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0;
block : {
$2 = $0;
- $3 = 6;
+ $4 = 6;
switch (1 | 0) {
default:
break block;
};
};
- return $3 | 0;
+ return $4 | 0;
}
function $36() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 7;
+ $1 = 7;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function f($0, $1, $2) {
@@ -49771,194 +49763,194 @@ function asmFunc(global, env, buffer) {
}
function $38() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 12;
+ $1 = 12;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $39() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 13;
+ $1 = 13;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $40() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 14;
+ $1 = 14;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $41() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 20;
+ $1 = 20;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $42() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 21;
+ $1 = 21;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $43() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 22;
+ $1 = 22;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $44() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 23;
+ $1 = 23;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $45() {
- var $0 = 0;
+ var $2 = 0;
block : {
- $0 = 17;
+ $2 = 17;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $2 | 0;
}
function $46() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 2;
+ $1 = 2;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $47() {
- var i64toi32_i32$0 = 0, $1 = 0, $2 = 0;
+ var i64toi32_i32$0 = 0, $1 = 0, $1$hi = 0;
block : {
- $i64toi32_block_0 : {
- i64toi32_i32$0 = 0;
- $1 = 30;
- switch (1 | 0) {
- default:
- break $i64toi32_block_0;
- };
+ i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ $1 = 30;
+ $1$hi = i64toi32_i32$0;
+ switch (1 | 0) {
+ default:
+ break block;
};
- $2 = $1;
- break block;
};
- return $2 | 0;
+ i64toi32_i32$0 = $1$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return $1 | 0;
}
function $48() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 30;
+ $1 = 30;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $49() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 31;
+ $1 = 31;
switch (1 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $50() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 32;
+ $1 = 32;
switch (0 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $51() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 33;
+ $1 = 33;
switch (0 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $52() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 3;
+ $1 = 3;
switch (0 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $53() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 3;
+ $1 = 3;
switch (0 | 0) {
case 0:
break block;
@@ -49966,42 +49958,42 @@ function asmFunc(global, env, buffer) {
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $54() {
- var i64toi32_i32$1 = 0, $1 = 0, $2 = 0;
+ var i64toi32_i32$0 = 0, $1 = 0, $1$hi = 0;
block : {
- $i64toi32_block_0 : {
- i64toi32_i32$1 = 0;
- $1 = 45;
- switch (0 | 0) {
- default:
- break $i64toi32_block_0;
- };
+ i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ $1 = 45;
+ $1$hi = i64toi32_i32$0;
+ switch (0 | 0) {
+ default:
+ break block;
};
- $2 = $1;
- break block;
};
- return $2 | 0;
+ i64toi32_i32$0 = $1$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return $1 | 0;
}
function $55() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 44;
+ $1 = 44;
switch (0 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $56() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 43;
+ $1 = 43;
switch (0 | 0) {
case 0:
break block;
@@ -50009,55 +50001,55 @@ function asmFunc(global, env, buffer) {
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $57() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 42;
+ $1 = 42;
switch (0 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $58() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 41;
+ $1 = 41;
switch (0 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $59() {
- var $0 = 0;
+ var $1 = 0;
block : {
- $0 = 40;
+ $1 = 40;
switch (0 | 0) {
default:
break block;
};
};
- return $0 | 0;
+ return $1 | 0;
}
function $60($0) {
$0 = $0 | 0;
- var $1 = 0, $2 = 0, $3 = 0, $4 = 0;
+ var $2 = 0, $3 = 0, $4 = 0, $5 = 0;
block : {
block11 : {
block12 : {
- $1 = 16;
- $2 = $1;
- $3 = $1;
- $4 = $1;
+ $2 = 16;
+ $3 = $2;
+ $4 = $2;
+ $5 = $2;
switch ($0 | 0) {
case 0:
break block12;
@@ -50067,23 +50059,23 @@ function asmFunc(global, env, buffer) {
break block;
};
};
- $3 = 2 + $4 | 0;
+ $4 = 2 + $5 | 0;
};
- $2 = 1 + $3 | 0;
+ $3 = 1 + $4 | 0;
};
- return $2 | 0;
+ return $3 | 0;
}
function $61($0) {
$0 = $0 | 0;
- var $1 = 0, $2 = 0, $3 = 0, $4 = 0;
+ var $2 = 0, $3 = 0, $4 = 0, $5 = 0;
block : {
block13 : {
block14 : {
- $1 = 8;
- $2 = $1;
- $3 = $1;
- $4 = $1;
+ $2 = 8;
+ $3 = $2;
+ $4 = $2;
+ $5 = $2;
switch ($0 | 0) {
case 0:
break block;
@@ -50093,23 +50085,23 @@ function asmFunc(global, env, buffer) {
break block14;
};
};
- $3 = 16;
+ $4 = 16;
};
- $2 = 1 + $3 | 0;
+ $3 = 1 + $4 | 0;
};
- return $2 | 0;
+ return $3 | 0;
}
function $62($0) {
$0 = $0 | 0;
- var $1 = 0, $2 = 0, $3 = 0, $4 = 0;
+ var $2 = 0, $3 = 0, $4 = 0, $5 = 0;
block : {
block15 : {
block16 : {
- $1 = 8;
- $2 = $1;
- $3 = $1;
- $4 = $1;
+ $2 = 8;
+ $3 = $2;
+ $4 = $2;
+ $5 = $2;
switch ($0 | 0) {
case 0:
break block16;
@@ -50119,21 +50111,21 @@ function asmFunc(global, env, buffer) {
break block;
};
};
- $3 = 16;
+ $4 = 16;
};
- $2 = 1 + $3 | 0;
+ $3 = 1 + $4 | 0;
};
- return $2 | 0;
+ return $3 | 0;
}
function $63($0) {
$0 = $0 | 0;
- var $1 = 0, $2 = 0, $3 = 0;
+ var $4 = 0, $2 = 0, $3 = 0;
block : {
block17 : {
$2 = 8;
$3 = $2;
- $1 = $2;
+ $4 = $2;
switch ($0 | 0) {
case 0:
break block17;
@@ -50143,21 +50135,21 @@ function asmFunc(global, env, buffer) {
break block17;
};
};
- $3 = 1 + $1 | 0;
+ $3 = 1 + $4 | 0;
};
return $3 | 0;
}
function $64($0) {
$0 = $0 | 0;
- var $1 = 0, $2 = 0, $3 = 0, $4 = 0;
+ var $2 = 0, $3 = 0, $4 = 0, $5 = 0;
block : {
block18 : {
block19 : {
- $1 = 8;
- $2 = $1;
- $3 = $1;
- $4 = $1;
+ $2 = 8;
+ $3 = $2;
+ $4 = $2;
+ $5 = $2;
switch ($0 | 0) {
case 0:
break block19;
@@ -50167,21 +50159,21 @@ function asmFunc(global, env, buffer) {
break block;
};
};
- $3 = 16;
+ $4 = 16;
};
- $2 = 1 + $3 | 0;
+ $3 = 1 + $4 | 0;
};
- return $2 | 0;
+ return $3 | 0;
}
function $65($0) {
$0 = $0 | 0;
- var $1 = 0, $2 = 0, $3 = 0;
+ var $4 = 0, $2 = 0, $3 = 0;
block : {
block20 : {
$2 = 8;
$3 = $2;
- $1 = $2;
+ $4 = $2;
switch ($0 | 0) {
case 0:
break block20;
@@ -50191,45 +50183,16 @@ function asmFunc(global, env, buffer) {
break block20;
};
};
- $3 = 1 + $1 | 0;
+ $3 = 1 + $4 | 0;
};
return $3 | 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;
- 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);
- };
- return $2 | 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;
+ var $9 = 0;
+ if ((x | 0) == (0 | 0)) $9 = 32; else $9 = 31 - Math_clz32(x ^ (x - 1 | 0) | 0) | 0;
+ return $9 | 0;
}
var FUNCTION_TABLE_iiii = [f];
diff --git a/test/wasm2asm/conversions-modified.2asm.js b/test/wasm2asm/conversions-modified.2asm.js
index 89c52e3a5..b4613c407 100644
--- a/test/wasm2asm/conversions-modified.2asm.js
+++ b/test/wasm2asm/conversions-modified.2asm.js
@@ -20,18 +20,24 @@ function asmFunc(global, env, buffer) {
var i64toi32_i32$HIGH_BITS = 0;
function $0(x) {
x = x | 0;
- var i64toi32_i32$1 = 0, i64toi32_i32$0 = 0;
+ var i64toi32_i32$1 = 0, i64toi32_i32$0 = 0, wasm2asm_i32$0 = 0;
i64toi32_i32$1 = x;
i64toi32_i32$0 = i64toi32_i32$1 >> 31 | 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
i64toi32_i32$1 = i64toi32_i32$1;
i64toi32_i32$HIGH_BITS = i64toi32_i32$0;
return i64toi32_i32$1 | 0;
+ return wasm2asm_i32$0 | 0;
}
function $1(x) {
x = x | 0;
- i64toi32_i32$HIGH_BITS = 0;
+ var i64toi32_i32$0 = 0, wasm2asm_i32$0 = 0;
+ i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ i64toi32_i32$HIGH_BITS = i64toi32_i32$0;
return x | 0;
+ return wasm2asm_i32$0 | 0;
}
function $2(x, x$hi) {
@@ -62,54 +68,66 @@ function asmFunc(global, env, buffer) {
function $7(x) {
x = Math_fround(x);
- var i64toi32_i32$0 = Math_fround(0), $2 = 0, $3 = 0, i64toi32_i32$2 = 0;
+ var i64toi32_i32$0 = Math_fround(0), i64toi32_i32$1 = 0, $4 = 0, $5 = 0, i64toi32_i32$2 = 0, wasm2asm_i32$0 = 0;
i64toi32_i32$0 = x;
if (Math_fround(Math_abs(i64toi32_i32$0)) >= Math_fround(1.0)) {
- if (i64toi32_i32$0 > Math_fround(0.0)) $2 = ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround(i64toi32_i32$0 / Math_fround(4294967296.0)))), Math_fround(Math_fround(4294967296.0) - Math_fround(1.0)))) >>> 0; else $2 = ~~Math_fround(Math_ceil(Math_fround(Math_fround(i64toi32_i32$0 - Math_fround(~~i64toi32_i32$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0;
- $3 = $2;
- } else $3 = 0;
+ if (i64toi32_i32$0 > Math_fround(0.0)) $4 = ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround(i64toi32_i32$0 / Math_fround(4294967296.0)))), Math_fround(Math_fround(4294967296.0) - Math_fround(1.0)))) >>> 0; else $4 = ~~Math_fround(Math_ceil(Math_fround(Math_fround(i64toi32_i32$0 - Math_fround(~~i64toi32_i32$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0;
+ $5 = $4;
+ } else $5 = 0;
+ i64toi32_i32$1 = $5;
+ i64toi32_i32$1 = i64toi32_i32$1;
i64toi32_i32$2 = ~~i64toi32_i32$0 >>> 0;
- i64toi32_i32$HIGH_BITS = $3;
+ i64toi32_i32$HIGH_BITS = i64toi32_i32$1;
return i64toi32_i32$2 | 0;
+ return wasm2asm_i32$0 | 0;
}
function $8(x) {
x = Math_fround(x);
- var i64toi32_i32$0 = Math_fround(0), $2 = 0, $3 = 0, i64toi32_i32$2 = 0;
+ var i64toi32_i32$0 = Math_fround(0), i64toi32_i32$1 = 0, $4 = 0, $5 = 0, i64toi32_i32$2 = 0, wasm2asm_i32$0 = 0;
i64toi32_i32$0 = x;
if (Math_fround(Math_abs(i64toi32_i32$0)) >= Math_fround(1.0)) {
- if (i64toi32_i32$0 > Math_fround(0.0)) $2 = ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround(i64toi32_i32$0 / Math_fround(4294967296.0)))), Math_fround(Math_fround(4294967296.0) - Math_fround(1.0)))) >>> 0; else $2 = ~~Math_fround(Math_ceil(Math_fround(Math_fround(i64toi32_i32$0 - Math_fround(~~i64toi32_i32$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0;
- $3 = $2;
- } else $3 = 0;
+ if (i64toi32_i32$0 > Math_fround(0.0)) $4 = ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround(i64toi32_i32$0 / Math_fround(4294967296.0)))), Math_fround(Math_fround(4294967296.0) - Math_fround(1.0)))) >>> 0; else $4 = ~~Math_fround(Math_ceil(Math_fround(Math_fround(i64toi32_i32$0 - Math_fround(~~i64toi32_i32$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0;
+ $5 = $4;
+ } else $5 = 0;
+ i64toi32_i32$1 = $5;
+ i64toi32_i32$1 = i64toi32_i32$1;
i64toi32_i32$2 = ~~i64toi32_i32$0 >>> 0;
- i64toi32_i32$HIGH_BITS = $3;
+ i64toi32_i32$HIGH_BITS = i64toi32_i32$1;
return i64toi32_i32$2 | 0;
+ return wasm2asm_i32$0 | 0;
}
function $9(x) {
x = +x;
- var i64toi32_i32$0 = 0.0, $2 = 0, $3 = 0, i64toi32_i32$2 = 0;
+ var i64toi32_i32$0 = 0.0, i64toi32_i32$1 = 0, $4 = 0, $5 = 0, i64toi32_i32$2 = 0, wasm2asm_i32$0 = 0;
i64toi32_i32$0 = x;
if (Math_abs(i64toi32_i32$0) >= 1.0) {
- if (i64toi32_i32$0 > 0.0) $2 = ~~Math_min(Math_floor(i64toi32_i32$0 / 4294967296.0), 4294967296.0 - 1.0) >>> 0; else $2 = ~~Math_ceil((i64toi32_i32$0 - +(~~i64toi32_i32$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0;
- $3 = $2;
- } else $3 = 0;
+ if (i64toi32_i32$0 > 0.0) $4 = ~~Math_min(Math_floor(i64toi32_i32$0 / 4294967296.0), 4294967296.0 - 1.0) >>> 0; else $4 = ~~Math_ceil((i64toi32_i32$0 - +(~~i64toi32_i32$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0;
+ $5 = $4;
+ } else $5 = 0;
+ i64toi32_i32$1 = $5;
+ i64toi32_i32$1 = i64toi32_i32$1;
i64toi32_i32$2 = ~~i64toi32_i32$0 >>> 0;
- i64toi32_i32$HIGH_BITS = $3;
+ i64toi32_i32$HIGH_BITS = i64toi32_i32$1;
return i64toi32_i32$2 | 0;
+ return wasm2asm_i32$0 | 0;
}
function $10(x) {
x = +x;
- var i64toi32_i32$0 = 0.0, $2 = 0, $3 = 0, i64toi32_i32$2 = 0;
+ var i64toi32_i32$0 = 0.0, i64toi32_i32$1 = 0, $4 = 0, $5 = 0, i64toi32_i32$2 = 0, wasm2asm_i32$0 = 0;
i64toi32_i32$0 = x;
if (Math_abs(i64toi32_i32$0) >= 1.0) {
- if (i64toi32_i32$0 > 0.0) $2 = ~~Math_min(Math_floor(i64toi32_i32$0 / 4294967296.0), 4294967296.0 - 1.0) >>> 0; else $2 = ~~Math_ceil((i64toi32_i32$0 - +(~~i64toi32_i32$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0;
- $3 = $2;
- } else $3 = 0;
+ if (i64toi32_i32$0 > 0.0) $4 = ~~Math_min(Math_floor(i64toi32_i32$0 / 4294967296.0), 4294967296.0 - 1.0) >>> 0; else $4 = ~~Math_ceil((i64toi32_i32$0 - +(~~i64toi32_i32$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0;
+ $5 = $4;
+ } else $5 = 0;
+ i64toi32_i32$1 = $5;
+ i64toi32_i32$1 = i64toi32_i32$1;
i64toi32_i32$2 = ~~i64toi32_i32$0 >>> 0;
- i64toi32_i32$HIGH_BITS = $3;
+ i64toi32_i32$HIGH_BITS = i64toi32_i32$1;
return i64toi32_i32$2 | 0;
+ return wasm2asm_i32$0 | 0;
}
function $11(x) {
@@ -120,7 +138,10 @@ function asmFunc(global, env, buffer) {
function $12(x, x$hi) {
x = x | 0;
x$hi = x$hi | 0;
- return Math_fround(Math_fround(+(x >>> 0) + 4294967296.0 * +(x$hi | 0)));
+ var i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = x$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return Math_fround(Math_fround(+(x >>> 0) + 4294967296.0 * +(i64toi32_i32$0 | 0)));
}
function $13(x) {
@@ -131,7 +152,10 @@ function asmFunc(global, env, buffer) {
function $14(x, x$hi) {
x = x | 0;
x$hi = x$hi | 0;
- return +(+(x >>> 0) + 4294967296.0 * +(x$hi | 0));
+ var i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = x$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return +(+(x >>> 0) + 4294967296.0 * +(i64toi32_i32$0 | 0));
}
function $15(x) {
@@ -142,7 +166,10 @@ function asmFunc(global, env, buffer) {
function $16(x, x$hi) {
x = x | 0;
x$hi = x$hi | 0;
- return Math_fround(Math_fround(+(x >>> 0) + 4294967296.0 * +(x$hi >>> 0)));
+ var i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = x$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return Math_fround(Math_fround(+(x >>> 0) + 4294967296.0 * +(i64toi32_i32$0 >>> 0)));
}
function $17(x) {
@@ -153,7 +180,10 @@ function asmFunc(global, env, buffer) {
function $18(x, x$hi) {
x = x | 0;
x$hi = x$hi | 0;
- return +(+(x >>> 0) + 4294967296.0 * +(x$hi >>> 0));
+ var i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = x$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return +(+(x >>> 0) + 4294967296.0 * +(i64toi32_i32$0 >>> 0));
}
function $19(x) {
@@ -174,8 +204,11 @@ function asmFunc(global, env, buffer) {
function $22(x, x$hi) {
x = x | 0;
x$hi = x$hi | 0;
+ var i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = x$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
HEAP32[0 >> 2] = x;
- HEAP32[(0 + 4 | 0) >> 2] = x$hi;
+ HEAP32[(0 + 4 | 0) >> 2] = i64toi32_i32$0;
return +(+HEAPF64[0 >> 3]);
}
@@ -186,47 +219,14 @@ function asmFunc(global, env, buffer) {
function $24(x) {
x = +x;
- var i64toi32_i32$1 = 0;
+ var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, wasm2asm_i32$0 = 0;
HEAPF64[0 >> 3] = x;
+ i64toi32_i32$0 = HEAP32[(0 + 4 | 0) >> 2] | 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
i64toi32_i32$1 = HEAP32[0 >> 2] | 0;
- i64toi32_i32$HIGH_BITS = HEAP32[(0 + 4 | 0) >> 2] | 0;
+ i64toi32_i32$HIGH_BITS = i64toi32_i32$0;
return i64toi32_i32$1 | 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;
- 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);
- };
- return $2 | 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 wasm2asm_i32$0 | 0;
}
return {
diff --git a/test/wasm2asm/empty_imported_table.2asm.js b/test/wasm2asm/empty_imported_table.2asm.js
index 8512534fc..8273dd6fb 100644
--- a/test/wasm2asm/empty_imported_table.2asm.js
+++ b/test/wasm2asm/empty_imported_table.2asm.js
@@ -19,42 +19,6 @@ function asmFunc(global, env, buffer) {
var Math_sqrt = global.Math.sqrt;
var import$table$0 = env.table;
var i64toi32_i32$HIGH_BITS = 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;
- 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);
- };
- return $2 | 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 {
};
diff --git a/test/wasm2asm/empty_table.2asm.js b/test/wasm2asm/empty_table.2asm.js
index af11b1a6a..c2fa012e9 100644
--- a/test/wasm2asm/empty_table.2asm.js
+++ b/test/wasm2asm/empty_table.2asm.js
@@ -18,42 +18,6 @@ function asmFunc(global, env, buffer) {
var Math_ceil = global.Math.ceil;
var Math_sqrt = global.Math.sqrt;
var i64toi32_i32$HIGH_BITS = 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;
- 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);
- };
- return $2 | 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 {
};
diff --git a/test/wasm2asm/f32.2asm.js b/test/wasm2asm/f32.2asm.js
new file mode 100644
index 000000000..478c8c881
--- /dev/null
+++ b/test/wasm2asm/f32.2asm.js
@@ -0,0 +1,139 @@
+function asmFunc(global, env, buffer) {
+ "use asm";
+ var HEAP8 = new global.Int8Array(buffer);
+ var HEAP16 = new global.Int16Array(buffer);
+ var HEAP32 = new global.Int32Array(buffer);
+ var HEAPU8 = new global.Uint8Array(buffer);
+ var HEAPU16 = new global.Uint16Array(buffer);
+ var HEAPU32 = new global.Uint32Array(buffer);
+ var HEAPF32 = new global.Float32Array(buffer);
+ var HEAPF64 = new global.Float64Array(buffer);
+ var Math_imul = global.Math.imul;
+ var Math_fround = global.Math.fround;
+ var Math_abs = global.Math.abs;
+ var Math_clz32 = global.Math.clz32;
+ var Math_min = global.Math.min;
+ var Math_max = global.Math.max;
+ var Math_floor = global.Math.floor;
+ var Math_ceil = global.Math.ceil;
+ var Math_sqrt = global.Math.sqrt;
+ var i64toi32_i32$HIGH_BITS = 0;
+ function $0(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround(Math_fround(x + y));
+ }
+
+ function $1(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround(Math_fround(x - y));
+ }
+
+ function $2(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround(Math_fround(x * y));
+ }
+
+ function $3(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround(Math_fround(x / y));
+ }
+
+ function $4(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(Math_sqrt(x)));
+ }
+
+ function $5(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround(Math_fround(Math_min(x, y)));
+ }
+
+ function $6(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround(Math_fround(Math_max(x, y)));
+ }
+
+ function $7(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(Math_ceil(x)));
+ }
+
+ function $8(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(Math_floor(x)));
+ }
+
+ function $9(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(__wasm_trunc_f32(Math_fround(x))));
+ }
+
+ function $10(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(__wasm_nearest_f32(Math_fround(x))));
+ }
+
+ function $11(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(Math_abs(x)));
+ }
+
+ function $12(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(-x));
+ }
+
+ function $13(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround((HEAP32[0] = (HEAPF32[0] = x, HEAP32[0]) & 2147483647 | 0 | ((HEAPF32[0] = y, HEAP32[0]) & 2147483648 | 0) | 0, HEAPF32[0]));
+ }
+
+ function __wasm_nearest_f32($0) {
+ $0 = Math_fround($0);
+ var $2 = Math_fround(0), $1 = Math_fround(0), $3 = Math_fround(0), $34 = Math_fround(0), $32 = Math_fround(0), $4 = Math_fround(0), $28 = Math_fround(0);
+ $1 = Math_fround(Math_ceil($0));
+ $2 = Math_fround(Math_floor($0));
+ $3 = Math_fround($0 - $2);
+ if ($3 < Math_fround(.5)) $34 = $2; else {
+ if ($3 > Math_fround(.5)) $32 = $1; else {
+ $4 = Math_fround($2 / Math_fround(2.0));
+ if (Math_fround($4 - Math_fround(Math_floor($4))) == Math_fround(0.0)) $28 = $2; else $28 = $1;
+ $32 = $28;
+ }
+ $34 = $32;
+ }
+ return Math_fround($34);
+ }
+
+ function __wasm_trunc_f32($0) {
+ $0 = Math_fround($0);
+ var $7 = Math_fround(0);
+ if ($0 < Math_fround(0.0)) $7 = Math_fround(Math_ceil($0)); else $7 = Math_fround(Math_floor($0));
+ return Math_fround($7);
+ }
+
+ return {
+ add: $0,
+ sub: $1,
+ mul: $2,
+ div: $3,
+ sqrt: $4,
+ min: $5,
+ max: $6,
+ ceil: $7,
+ floor: $8,
+ trunc: $9,
+ nearest: $10,
+ abs: $11,
+ neg: $12,
+ copysign: $13
+ };
+}
+
diff --git a/test/wasm2asm/f32_cmp.2asm.js b/test/wasm2asm/f32_cmp.2asm.js
new file mode 100644
index 000000000..18592cda9
--- /dev/null
+++ b/test/wasm2asm/f32_cmp.2asm.js
@@ -0,0 +1,66 @@
+function asmFunc(global, env, buffer) {
+ "use asm";
+ var HEAP8 = new global.Int8Array(buffer);
+ var HEAP16 = new global.Int16Array(buffer);
+ var HEAP32 = new global.Int32Array(buffer);
+ var HEAPU8 = new global.Uint8Array(buffer);
+ var HEAPU16 = new global.Uint16Array(buffer);
+ var HEAPU32 = new global.Uint32Array(buffer);
+ var HEAPF32 = new global.Float32Array(buffer);
+ var HEAPF64 = new global.Float64Array(buffer);
+ var Math_imul = global.Math.imul;
+ var Math_fround = global.Math.fround;
+ var Math_abs = global.Math.abs;
+ var Math_clz32 = global.Math.clz32;
+ var Math_min = global.Math.min;
+ var Math_max = global.Math.max;
+ var Math_floor = global.Math.floor;
+ var Math_ceil = global.Math.ceil;
+ var Math_sqrt = global.Math.sqrt;
+ var i64toi32_i32$HIGH_BITS = 0;
+ function $0(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return x == y | 0;
+ }
+
+ function $1(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return x != y | 0;
+ }
+
+ function $2(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return x < y | 0;
+ }
+
+ function $3(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return x <= y | 0;
+ }
+
+ function $4(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return x > y | 0;
+ }
+
+ function $5(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return x >= y | 0;
+ }
+
+ return {
+ eq: $0,
+ ne: $1,
+ lt: $2,
+ le: $3,
+ gt: $4,
+ ge: $5
+ };
+}
+
diff --git a/test/wasm2asm/f64.2asm.js b/test/wasm2asm/f64.2asm.js
new file mode 100644
index 000000000..5b6358f27
--- /dev/null
+++ b/test/wasm2asm/f64.2asm.js
@@ -0,0 +1,166 @@
+function asmFunc(global, env, buffer) {
+ "use asm";
+ var HEAP8 = new global.Int8Array(buffer);
+ var HEAP16 = new global.Int16Array(buffer);
+ var HEAP32 = new global.Int32Array(buffer);
+ var HEAPU8 = new global.Uint8Array(buffer);
+ var HEAPU16 = new global.Uint16Array(buffer);
+ var HEAPU32 = new global.Uint32Array(buffer);
+ var HEAPF32 = new global.Float32Array(buffer);
+ var HEAPF64 = new global.Float64Array(buffer);
+ var Math_imul = global.Math.imul;
+ var Math_fround = global.Math.fround;
+ var Math_abs = global.Math.abs;
+ var Math_clz32 = global.Math.clz32;
+ var Math_min = global.Math.min;
+ var Math_max = global.Math.max;
+ var Math_floor = global.Math.floor;
+ var Math_ceil = global.Math.ceil;
+ var Math_sqrt = global.Math.sqrt;
+ var i64toi32_i32$HIGH_BITS = 0;
+ function $0(x, y) {
+ x = +x;
+ y = +y;
+ return +(x + y);
+ }
+
+ function $1(x, y) {
+ x = +x;
+ y = +y;
+ return +(x - y);
+ }
+
+ function $2(x, y) {
+ x = +x;
+ y = +y;
+ return +(x * y);
+ }
+
+ function $3(x, y) {
+ x = +x;
+ y = +y;
+ return +(x / y);
+ }
+
+ function $4(x) {
+ x = +x;
+ return +Math_sqrt(x);
+ }
+
+ function $5(x, y) {
+ x = +x;
+ y = +y;
+ return +Math_min(x, y);
+ }
+
+ function $6(x, y) {
+ x = +x;
+ y = +y;
+ return +Math_max(x, y);
+ }
+
+ function $7(x) {
+ x = +x;
+ return +Math_ceil(x);
+ }
+
+ function $8(x) {
+ x = +x;
+ return +Math_floor(x);
+ }
+
+ function $9(x) {
+ x = +x;
+ return +(+__wasm_trunc_f64(+x));
+ }
+
+ function $10(x) {
+ x = +x;
+ return +(+__wasm_nearest_f64(+x));
+ }
+
+ function $11(x) {
+ x = +x;
+ return +Math_abs(x);
+ }
+
+ function $12(x) {
+ x = +x;
+ return +-x;
+ }
+
+ function $13(x, y) {
+ x = +x;
+ y = +y;
+ var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0, $4 = 0, $4$hi = 0, $7 = 0, $7$hi = 0;
+ HEAPF64[0 >> 3] = x;
+ i64toi32_i32$0 = HEAP32[(0 + 4 | 0) >> 2] | 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ i64toi32_i32$2 = HEAP32[0 >> 2] | 0;
+ i64toi32_i32$1 = 2147483647;
+ i64toi32_i32$3 = 4294967295;
+ i64toi32_i32$1 = i64toi32_i32$0 & i64toi32_i32$1 | 0;
+ $4 = i64toi32_i32$2 & i64toi32_i32$3 | 0;
+ $4$hi = i64toi32_i32$1;
+ HEAPF64[0 >> 3] = y;
+ i64toi32_i32$1 = HEAP32[(0 + 4 | 0) >> 2] | 0;
+ i64toi32_i32$1 = i64toi32_i32$1;
+ i64toi32_i32$0 = HEAP32[0 >> 2] | 0;
+ i64toi32_i32$2 = 2147483648;
+ i64toi32_i32$3 = 0;
+ i64toi32_i32$2 = i64toi32_i32$1 & i64toi32_i32$2 | 0;
+ $7 = i64toi32_i32$0 & i64toi32_i32$3 | 0;
+ $7$hi = i64toi32_i32$2;
+ i64toi32_i32$2 = $4$hi;
+ i64toi32_i32$1 = $4;
+ i64toi32_i32$0 = $7$hi;
+ i64toi32_i32$3 = $7;
+ i64toi32_i32$0 = i64toi32_i32$2 | i64toi32_i32$0 | 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ HEAP32[0 >> 2] = i64toi32_i32$1 | i64toi32_i32$3 | 0;
+ HEAP32[(0 + 4 | 0) >> 2] = i64toi32_i32$0;
+ return +(+HEAPF64[0 >> 3]);
+ }
+
+ function __wasm_nearest_f64($0) {
+ $0 = +$0;
+ var $2 = 0.0, $1 = 0.0, $3 = 0.0, $34 = 0.0, $32 = 0.0, $4 = 0.0, $28 = 0.0;
+ $1 = Math_ceil($0);
+ $2 = Math_floor($0);
+ $3 = $0 - $2;
+ if ($3 < .5) $34 = $2; else {
+ if ($3 > .5) $32 = $1; else {
+ $4 = $2 / 2.0;
+ if ($4 - Math_floor($4) == 0.0) $28 = $2; else $28 = $1;
+ $32 = $28;
+ }
+ $34 = $32;
+ }
+ return +$34;
+ }
+
+ function __wasm_trunc_f64($0) {
+ $0 = +$0;
+ var $7 = 0.0;
+ if ($0 < 0.0) $7 = Math_ceil($0); else $7 = Math_floor($0);
+ return +$7;
+ }
+
+ return {
+ add: $0,
+ sub: $1,
+ mul: $2,
+ div: $3,
+ sqrt: $4,
+ min: $5,
+ max: $6,
+ ceil: $7,
+ floor: $8,
+ trunc: $9,
+ nearest: $10,
+ abs: $11,
+ neg: $12,
+ copysign: $13
+ };
+}
+
diff --git a/test/wasm2asm/f64_cmp.2asm.js b/test/wasm2asm/f64_cmp.2asm.js
new file mode 100644
index 000000000..7f2df56ff
--- /dev/null
+++ b/test/wasm2asm/f64_cmp.2asm.js
@@ -0,0 +1,66 @@
+function asmFunc(global, env, buffer) {
+ "use asm";
+ var HEAP8 = new global.Int8Array(buffer);
+ var HEAP16 = new global.Int16Array(buffer);
+ var HEAP32 = new global.Int32Array(buffer);
+ var HEAPU8 = new global.Uint8Array(buffer);
+ var HEAPU16 = new global.Uint16Array(buffer);
+ var HEAPU32 = new global.Uint32Array(buffer);
+ var HEAPF32 = new global.Float32Array(buffer);
+ var HEAPF64 = new global.Float64Array(buffer);
+ var Math_imul = global.Math.imul;
+ var Math_fround = global.Math.fround;
+ var Math_abs = global.Math.abs;
+ var Math_clz32 = global.Math.clz32;
+ var Math_min = global.Math.min;
+ var Math_max = global.Math.max;
+ var Math_floor = global.Math.floor;
+ var Math_ceil = global.Math.ceil;
+ var Math_sqrt = global.Math.sqrt;
+ var i64toi32_i32$HIGH_BITS = 0;
+ function $0(x, y) {
+ x = +x;
+ y = +y;
+ return x == y | 0;
+ }
+
+ function $1(x, y) {
+ x = +x;
+ y = +y;
+ return x != y | 0;
+ }
+
+ function $2(x, y) {
+ x = +x;
+ y = +y;
+ return x < y | 0;
+ }
+
+ function $3(x, y) {
+ x = +x;
+ y = +y;
+ return x <= y | 0;
+ }
+
+ function $4(x, y) {
+ x = +x;
+ y = +y;
+ return x > y | 0;
+ }
+
+ function $5(x, y) {
+ x = +x;
+ y = +y;
+ return x >= y | 0;
+ }
+
+ return {
+ eq: $0,
+ ne: $1,
+ lt: $2,
+ le: $3,
+ gt: $4,
+ ge: $5
+ };
+}
+
diff --git a/test/wasm2asm/float-ops.2asm.js b/test/wasm2asm/float-ops.2asm.js
index 4d34766db..9c6ec3460 100644
--- a/test/wasm2asm/float-ops.2asm.js
+++ b/test/wasm2asm/float-ops.2asm.js
@@ -209,22 +209,32 @@ function asmFunc(global, env, buffer) {
function copysign64($0, $1) {
$0 = +$0;
$1 = +$1;
- var i64toi32_i32$0 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0, i64toi32_i32$1 = 0;
+ var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0, $4 = 0, $4$hi = 0, $7 = 0, $7$hi = 0;
HEAPF64[0 >> 3] = $0;
i64toi32_i32$0 = HEAP32[(0 + 4 | 0) >> 2] | 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
i64toi32_i32$2 = HEAP32[0 >> 2] | 0;
i64toi32_i32$1 = 2147483647;
i64toi32_i32$3 = 4294967295;
i64toi32_i32$1 = i64toi32_i32$0 & i64toi32_i32$1 | 0;
- i64toi32_i32$3 = i64toi32_i32$2 & i64toi32_i32$3 | 0;
+ $4 = i64toi32_i32$2 & i64toi32_i32$3 | 0;
+ $4$hi = i64toi32_i32$1;
HEAPF64[0 >> 3] = $1;
- i64toi32_i32$2 = HEAP32[(0 + 4 | 0) >> 2] | 0;
- i64toi32_i32$3 = HEAP32[0 >> 2] | 0;
- i64toi32_i32$0 = 2147483648;
- i64toi32_i32$0 = i64toi32_i32$2 & i64toi32_i32$0 | 0;
- i64toi32_i32$2 = i64toi32_i32$3 & 0 | 0;
- i64toi32_i32$0 = i64toi32_i32$1 | i64toi32_i32$0 | 0;
- HEAP32[0 >> 2] = i64toi32_i32$3 | i64toi32_i32$2 | 0;
+ i64toi32_i32$1 = HEAP32[(0 + 4 | 0) >> 2] | 0;
+ i64toi32_i32$1 = i64toi32_i32$1;
+ i64toi32_i32$0 = HEAP32[0 >> 2] | 0;
+ i64toi32_i32$2 = 2147483648;
+ i64toi32_i32$3 = 0;
+ i64toi32_i32$2 = i64toi32_i32$1 & i64toi32_i32$2 | 0;
+ $7 = i64toi32_i32$0 & i64toi32_i32$3 | 0;
+ $7$hi = i64toi32_i32$2;
+ i64toi32_i32$2 = $4$hi;
+ i64toi32_i32$1 = $4;
+ i64toi32_i32$0 = $7$hi;
+ i64toi32_i32$3 = $7;
+ i64toi32_i32$0 = i64toi32_i32$2 | i64toi32_i32$0 | 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ HEAP32[0 >> 2] = i64toi32_i32$1 | i64toi32_i32$3 | 0;
HEAP32[(0 + 4 | 0) >> 2] = i64toi32_i32$0;
return +(+HEAPF64[0 >> 3]);
}
@@ -278,105 +288,89 @@ function asmFunc(global, env, buffer) {
function $43($0, $0$hi) {
$0 = $0 | 0;
$0$hi = $0$hi | 0;
- return Math_fround(Math_fround(+($0 >>> 0) + 4294967296.0 * +($0$hi | 0)));
+ var i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return Math_fround(Math_fround(+($0 >>> 0) + 4294967296.0 * +(i64toi32_i32$0 | 0)));
}
function $44($0, $0$hi) {
$0 = $0 | 0;
$0$hi = $0$hi | 0;
- return +(+($0 >>> 0) + 4294967296.0 * +($0$hi | 0));
+ var i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return +(+($0 >>> 0) + 4294967296.0 * +(i64toi32_i32$0 | 0));
}
function $45($0, $0$hi) {
$0 = $0 | 0;
$0$hi = $0$hi | 0;
- return Math_fround(Math_fround(+($0 >>> 0) + 4294967296.0 * +($0$hi >>> 0)));
+ var i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return Math_fround(Math_fround(+($0 >>> 0) + 4294967296.0 * +(i64toi32_i32$0 >>> 0)));
}
function $46($0, $0$hi) {
$0 = $0 | 0;
$0$hi = $0$hi | 0;
- return +(+($0 >>> 0) + 4294967296.0 * +($0$hi >>> 0));
+ var i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return +(+($0 >>> 0) + 4294967296.0 * +(i64toi32_i32$0 >>> 0));
}
function $47($0) {
$0 = Math_fround($0);
- var i64toi32_i32$0 = Math_fround(0), $2 = 0, $3 = 0;
+ var i64toi32_i32$0 = Math_fround(0), i64toi32_i32$1 = 0, $3 = 0, $4 = 0;
i64toi32_i32$0 = $0;
if (Math_fround(Math_abs(i64toi32_i32$0)) >= Math_fround(1.0)) {
- if (i64toi32_i32$0 > Math_fround(0.0)) $2 = ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround(i64toi32_i32$0 / Math_fround(4294967296.0)))), Math_fround(Math_fround(4294967296.0) - Math_fround(1.0)))) >>> 0; else $2 = ~~Math_fround(Math_ceil(Math_fround(Math_fround(i64toi32_i32$0 - Math_fround(~~i64toi32_i32$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0;
- $3 = $2;
- } else $3 = 0;
- return (~~i64toi32_i32$0 >>> 0 | 0) == (0 | 0) & ($3 | 0) == (0 | 0) | 0 | 0;
+ if (i64toi32_i32$0 > Math_fround(0.0)) $3 = ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround(i64toi32_i32$0 / Math_fround(4294967296.0)))), Math_fround(Math_fround(4294967296.0) - Math_fround(1.0)))) >>> 0; else $3 = ~~Math_fround(Math_ceil(Math_fround(Math_fround(i64toi32_i32$0 - Math_fround(~~i64toi32_i32$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0;
+ $4 = $3;
+ } else $4 = 0;
+ i64toi32_i32$1 = $4;
+ i64toi32_i32$1 = i64toi32_i32$1;
+ return (~~i64toi32_i32$0 >>> 0 | 0) == (0 | 0) & (i64toi32_i32$1 | 0) == (0 | 0) | 0 | 0;
}
function $48($0) {
$0 = +$0;
- var i64toi32_i32$0 = 0.0, $2 = 0, $3 = 0;
+ var i64toi32_i32$0 = 0.0, i64toi32_i32$1 = 0, $3 = 0, $4 = 0;
i64toi32_i32$0 = $0;
if (Math_abs(i64toi32_i32$0) >= 1.0) {
- if (i64toi32_i32$0 > 0.0) $2 = ~~Math_min(Math_floor(i64toi32_i32$0 / 4294967296.0), 4294967296.0 - 1.0) >>> 0; else $2 = ~~Math_ceil((i64toi32_i32$0 - +(~~i64toi32_i32$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0;
- $3 = $2;
- } else $3 = 0;
- return (~~i64toi32_i32$0 >>> 0 | 0) == (0 | 0) & ($3 | 0) == (0 | 0) | 0 | 0;
+ if (i64toi32_i32$0 > 0.0) $3 = ~~Math_min(Math_floor(i64toi32_i32$0 / 4294967296.0), 4294967296.0 - 1.0) >>> 0; else $3 = ~~Math_ceil((i64toi32_i32$0 - +(~~i64toi32_i32$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0;
+ $4 = $3;
+ } else $4 = 0;
+ i64toi32_i32$1 = $4;
+ i64toi32_i32$1 = i64toi32_i32$1;
+ return (~~i64toi32_i32$0 >>> 0 | 0) == (0 | 0) & (i64toi32_i32$1 | 0) == (0 | 0) | 0 | 0;
}
function $49($0) {
$0 = Math_fround($0);
- var i64toi32_i32$0 = Math_fround(0), $2 = 0, $3 = 0;
+ var i64toi32_i32$0 = Math_fround(0), i64toi32_i32$1 = 0, $3 = 0, $4 = 0;
i64toi32_i32$0 = $0;
if (Math_fround(Math_abs(i64toi32_i32$0)) >= Math_fround(1.0)) {
- if (i64toi32_i32$0 > Math_fround(0.0)) $2 = ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround(i64toi32_i32$0 / Math_fround(4294967296.0)))), Math_fround(Math_fround(4294967296.0) - Math_fround(1.0)))) >>> 0; else $2 = ~~Math_fround(Math_ceil(Math_fround(Math_fround(i64toi32_i32$0 - Math_fround(~~i64toi32_i32$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0;
- $3 = $2;
- } else $3 = 0;
- return (~~i64toi32_i32$0 >>> 0 | 0) == (0 | 0) & ($3 | 0) == (0 | 0) | 0 | 0;
+ if (i64toi32_i32$0 > Math_fround(0.0)) $3 = ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround(i64toi32_i32$0 / Math_fround(4294967296.0)))), Math_fround(Math_fround(4294967296.0) - Math_fround(1.0)))) >>> 0; else $3 = ~~Math_fround(Math_ceil(Math_fround(Math_fround(i64toi32_i32$0 - Math_fround(~~i64toi32_i32$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0;
+ $4 = $3;
+ } else $4 = 0;
+ i64toi32_i32$1 = $4;
+ i64toi32_i32$1 = i64toi32_i32$1;
+ return (~~i64toi32_i32$0 >>> 0 | 0) == (0 | 0) & (i64toi32_i32$1 | 0) == (0 | 0) | 0 | 0;
}
function $50($0) {
$0 = +$0;
- var i64toi32_i32$0 = 0.0, $2 = 0, $3 = 0;
+ var i64toi32_i32$0 = 0.0, i64toi32_i32$1 = 0, $3 = 0, $4 = 0;
i64toi32_i32$0 = $0;
if (Math_abs(i64toi32_i32$0) >= 1.0) {
- if (i64toi32_i32$0 > 0.0) $2 = ~~Math_min(Math_floor(i64toi32_i32$0 / 4294967296.0), 4294967296.0 - 1.0) >>> 0; else $2 = ~~Math_ceil((i64toi32_i32$0 - +(~~i64toi32_i32$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0;
- $3 = $2;
- } else $3 = 0;
- return (~~i64toi32_i32$0 >>> 0 | 0) == (0 | 0) & ($3 | 0) == (0 | 0) | 0 | 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;
- 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);
- };
- return $2 | 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;
+ if (i64toi32_i32$0 > 0.0) $3 = ~~Math_min(Math_floor(i64toi32_i32$0 / 4294967296.0), 4294967296.0 - 1.0) >>> 0; else $3 = ~~Math_ceil((i64toi32_i32$0 - +(~~i64toi32_i32$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0;
+ $4 = $3;
+ } else $4 = 0;
+ i64toi32_i32$1 = $4;
+ i64toi32_i32$1 = i64toi32_i32$1;
+ return (~~i64toi32_i32$0 >>> 0 | 0) == (0 | 0) & (i64toi32_i32$1 | 0) == (0 | 0) | 0 | 0;
}
return {
diff --git a/test/wasm2asm/float_misc.2asm.js b/test/wasm2asm/float_misc.2asm.js
new file mode 100644
index 000000000..71ba6e79b
--- /dev/null
+++ b/test/wasm2asm/float_misc.2asm.js
@@ -0,0 +1,281 @@
+function asmFunc(global, env, buffer) {
+ "use asm";
+ var HEAP8 = new global.Int8Array(buffer);
+ var HEAP16 = new global.Int16Array(buffer);
+ var HEAP32 = new global.Int32Array(buffer);
+ var HEAPU8 = new global.Uint8Array(buffer);
+ var HEAPU16 = new global.Uint16Array(buffer);
+ var HEAPU32 = new global.Uint32Array(buffer);
+ var HEAPF32 = new global.Float32Array(buffer);
+ var HEAPF64 = new global.Float64Array(buffer);
+ var Math_imul = global.Math.imul;
+ var Math_fround = global.Math.fround;
+ var Math_abs = global.Math.abs;
+ var Math_clz32 = global.Math.clz32;
+ var Math_min = global.Math.min;
+ var Math_max = global.Math.max;
+ var Math_floor = global.Math.floor;
+ var Math_ceil = global.Math.ceil;
+ var Math_sqrt = global.Math.sqrt;
+ var i64toi32_i32$HIGH_BITS = 0;
+ function $0(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround(Math_fround(x + y));
+ }
+
+ function $1(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround(Math_fround(x - y));
+ }
+
+ function $2(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround(Math_fround(x * y));
+ }
+
+ function $3(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround(Math_fround(x / y));
+ }
+
+ function $4(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(Math_sqrt(x)));
+ }
+
+ function $5(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(Math_abs(x)));
+ }
+
+ function $6(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(-x));
+ }
+
+ function $7(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround((HEAP32[0] = (HEAPF32[0] = x, HEAP32[0]) & 2147483647 | 0 | ((HEAPF32[0] = y, HEAP32[0]) & 2147483648 | 0) | 0, HEAPF32[0]));
+ }
+
+ function $8(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(Math_ceil(x)));
+ }
+
+ function $9(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(Math_floor(x)));
+ }
+
+ function $10(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(__wasm_trunc_f32(Math_fround(x))));
+ }
+
+ function $11(x) {
+ x = Math_fround(x);
+ return Math_fround(Math_fround(__wasm_nearest_f32(Math_fround(x))));
+ }
+
+ function $12(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround(Math_fround(Math_min(x, y)));
+ }
+
+ function $13(x, y) {
+ x = Math_fround(x);
+ y = Math_fround(y);
+ return Math_fround(Math_fround(Math_max(x, y)));
+ }
+
+ function $14(x, y) {
+ x = +x;
+ y = +y;
+ return +(x + y);
+ }
+
+ function $15(x, y) {
+ x = +x;
+ y = +y;
+ return +(x - y);
+ }
+
+ function $16(x, y) {
+ x = +x;
+ y = +y;
+ return +(x * y);
+ }
+
+ function $17(x, y) {
+ x = +x;
+ y = +y;
+ return +(x / y);
+ }
+
+ function $18(x) {
+ x = +x;
+ return +Math_sqrt(x);
+ }
+
+ function $19(x) {
+ x = +x;
+ return +Math_abs(x);
+ }
+
+ function $20(x) {
+ x = +x;
+ return +-x;
+ }
+
+ function $21(x, y) {
+ x = +x;
+ y = +y;
+ var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0, $4 = 0, $4$hi = 0, $7 = 0, $7$hi = 0;
+ HEAPF64[0 >> 3] = x;
+ i64toi32_i32$0 = HEAP32[(0 + 4 | 0) >> 2] | 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ i64toi32_i32$2 = HEAP32[0 >> 2] | 0;
+ i64toi32_i32$1 = 2147483647;
+ i64toi32_i32$3 = 4294967295;
+ i64toi32_i32$1 = i64toi32_i32$0 & i64toi32_i32$1 | 0;
+ $4 = i64toi32_i32$2 & i64toi32_i32$3 | 0;
+ $4$hi = i64toi32_i32$1;
+ HEAPF64[0 >> 3] = y;
+ i64toi32_i32$1 = HEAP32[(0 + 4 | 0) >> 2] | 0;
+ i64toi32_i32$1 = i64toi32_i32$1;
+ i64toi32_i32$0 = HEAP32[0 >> 2] | 0;
+ i64toi32_i32$2 = 2147483648;
+ i64toi32_i32$3 = 0;
+ i64toi32_i32$2 = i64toi32_i32$1 & i64toi32_i32$2 | 0;
+ $7 = i64toi32_i32$0 & i64toi32_i32$3 | 0;
+ $7$hi = i64toi32_i32$2;
+ i64toi32_i32$2 = $4$hi;
+ i64toi32_i32$1 = $4;
+ i64toi32_i32$0 = $7$hi;
+ i64toi32_i32$3 = $7;
+ i64toi32_i32$0 = i64toi32_i32$2 | i64toi32_i32$0 | 0;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ HEAP32[0 >> 2] = i64toi32_i32$1 | i64toi32_i32$3 | 0;
+ HEAP32[(0 + 4 | 0) >> 2] = i64toi32_i32$0;
+ return +(+HEAPF64[0 >> 3]);
+ }
+
+ function $22(x) {
+ x = +x;
+ return +Math_ceil(x);
+ }
+
+ function $23(x) {
+ x = +x;
+ return +Math_floor(x);
+ }
+
+ function $24(x) {
+ x = +x;
+ return +(+__wasm_trunc_f64(+x));
+ }
+
+ function $25(x) {
+ x = +x;
+ return +(+__wasm_nearest_f64(+x));
+ }
+
+ function $26(x, y) {
+ x = +x;
+ y = +y;
+ return +Math_min(x, y);
+ }
+
+ function $27(x, y) {
+ x = +x;
+ y = +y;
+ return +Math_max(x, y);
+ }
+
+ function __wasm_nearest_f32($0) {
+ $0 = Math_fround($0);
+ var $2 = Math_fround(0), $1 = Math_fround(0), $3 = Math_fround(0), $34 = Math_fround(0), $32 = Math_fround(0), $4 = Math_fround(0), $28 = Math_fround(0);
+ $1 = Math_fround(Math_ceil($0));
+ $2 = Math_fround(Math_floor($0));
+ $3 = Math_fround($0 - $2);
+ if ($3 < Math_fround(.5)) $34 = $2; else {
+ if ($3 > Math_fround(.5)) $32 = $1; else {
+ $4 = Math_fround($2 / Math_fround(2.0));
+ if (Math_fround($4 - Math_fround(Math_floor($4))) == Math_fround(0.0)) $28 = $2; else $28 = $1;
+ $32 = $28;
+ }
+ $34 = $32;
+ }
+ return Math_fround($34);
+ }
+
+ function __wasm_nearest_f64($0) {
+ $0 = +$0;
+ var $2 = 0.0, $1 = 0.0, $3 = 0.0, $34 = 0.0, $32 = 0.0, $4 = 0.0, $28 = 0.0;
+ $1 = Math_ceil($0);
+ $2 = Math_floor($0);
+ $3 = $0 - $2;
+ if ($3 < .5) $34 = $2; else {
+ if ($3 > .5) $32 = $1; else {
+ $4 = $2 / 2.0;
+ if ($4 - Math_floor($4) == 0.0) $28 = $2; else $28 = $1;
+ $32 = $28;
+ }
+ $34 = $32;
+ }
+ return +$34;
+ }
+
+ function __wasm_trunc_f32($0) {
+ $0 = Math_fround($0);
+ var $7 = Math_fround(0);
+ if ($0 < Math_fround(0.0)) $7 = Math_fround(Math_ceil($0)); else $7 = Math_fround(Math_floor($0));
+ return Math_fround($7);
+ }
+
+ function __wasm_trunc_f64($0) {
+ $0 = +$0;
+ var $7 = 0.0;
+ if ($0 < 0.0) $7 = Math_ceil($0); else $7 = Math_floor($0);
+ return +$7;
+ }
+
+ return {
+ f32_add: $0,
+ f32_sub: $1,
+ f32_mul: $2,
+ f32_div: $3,
+ f32_sqrt: $4,
+ f32_abs: $5,
+ f32_neg: $6,
+ f32_copysign: $7,
+ f32_ceil: $8,
+ f32_floor: $9,
+ f32_trunc: $10,
+ f32_nearest: $11,
+ f32_min: $12,
+ f32_max: $13,
+ f64_add: $14,
+ f64_sub: $15,
+ f64_mul: $16,
+ f64_div: $17,
+ f64_sqrt: $18,
+ f64_abs: $19,
+ f64_neg: $20,
+ f64_copysign: $21,
+ f64_ceil: $22,
+ f64_floor: $23,
+ f64_trunc: $24,
+ f64_nearest: $25,
+ f64_min: $26,
+ f64_max: $27
+ };
+}
+
diff --git a/test/wasm2asm/forward.2asm.js b/test/wasm2asm/forward.2asm.js
index c5b382f88..2af658af2 100644
--- a/test/wasm2asm/forward.2asm.js
+++ b/test/wasm2asm/forward.2asm.js
@@ -20,52 +20,16 @@ function asmFunc(global, env, buffer) {
var i64toi32_i32$HIGH_BITS = 0;
function even(n) {
n = n | 0;
- var $1 = 0;
- if ((n | 0) == (0 | 0)) $1 = 1; else $1 = odd(n - 1 | 0 | 0) | 0;
- return $1 | 0;
+ var $6 = 0;
+ if ((n | 0) == (0 | 0)) $6 = 1; else $6 = odd(n - 1 | 0 | 0) | 0;
+ return $6 | 0;
}
function odd(n) {
n = n | 0;
- var $1 = 0;
- if ((n | 0) == (0 | 0)) $1 = 0; else $1 = even(n - 1 | 0 | 0) | 0;
- return $1 | 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;
- 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);
- };
- return $2 | 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;
+ var $6 = 0;
+ if ((n | 0) == (0 | 0)) $6 = 0; else $6 = even(n - 1 | 0 | 0) | 0;
+ return $6 | 0;
}
return {
diff --git a/test/wasm2asm/get-set-local.2asm.js b/test/wasm2asm/get-set-local.2asm.js
index f02fa2cdf..fb424d8b9 100644
--- a/test/wasm2asm/get-set-local.2asm.js
+++ b/test/wasm2asm/get-set-local.2asm.js
@@ -26,49 +26,18 @@ function asmFunc(global, env, buffer) {
$0 = $0 | 0;
r = r | 0;
r$hi = r$hi | 0;
- var i64toi32_i32$0 = 0;
+ var i64toi32_i32$0 = 0, $9$hi = 0;
i64toi32_i32$0 = r$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
i64toi32_i32$0 = 0;
i64toi32_i32$0 = i64toi32_i32$0;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ $9$hi = i64toi32_i32$0;
+ i64toi32_i32$0 = r$hi;
+ i64toi32_i32$0 = $9$hi;
return ($0 | 0) == (r | 0) & (i64toi32_i32$0 | 0) == (r$hi | 0) | 0 | 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;
- 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);
- };
- return $2 | 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 {
check_extend_ui32: $1
};
diff --git a/test/wasm2asm/grow_memory.2asm.js b/test/wasm2asm/grow_memory.2asm.js
index 48865ce48..f850d7eaa 100644
--- a/test/wasm2asm/grow_memory.2asm.js
+++ b/test/wasm2asm/grow_memory.2asm.js
@@ -27,42 +27,6 @@ function asmFunc(global, env, buffer) {
return __wasm_current_memory() | 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;
- 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);
- };
- return $2 | 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;
- }
-
function __wasm_grow_memory(pagesToAdd) {
pagesToAdd = pagesToAdd | 0;
var oldPages = __wasm_current_memory() | 0;
diff --git a/test/wasm2asm/hello_world.2asm.js b/test/wasm2asm/hello_world.2asm.js
index f511df931..dbef84f65 100644
--- a/test/wasm2asm/hello_world.2asm.js
+++ b/test/wasm2asm/hello_world.2asm.js
@@ -24,42 +24,6 @@ function asmFunc(global, env, buffer) {
return x + y | 0 | 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;
- 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);
- };
- return $2 | 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 {
add: add
};
diff --git a/test/wasm2asm/i32.2asm.js b/test/wasm2asm/i32.2asm.js
index 6fab2d7f6..7c319ba5e 100644
--- a/test/wasm2asm/i32.2asm.js
+++ b/test/wasm2asm/i32.2asm.js
@@ -99,13 +99,13 @@ function asmFunc(global, env, buffer) {
function $13(x, y) {
x = x | 0;
y = y | 0;
- return __wasm_rotl_i32(x, y) | 0 | 0;
+ return __wasm_rotl_i32(x | 0, y | 0) | 0 | 0;
}
function $14(x, y) {
x = x | 0;
y = y | 0;
- return __wasm_rotr_i32(x, y) | 0 | 0;
+ return __wasm_rotr_i32(x | 0, y | 0) | 0 | 0;
}
function $15(x) {
@@ -115,12 +115,12 @@ function asmFunc(global, env, buffer) {
function $16(x) {
x = x | 0;
- return __wasm_ctz_i32(x) | 0 | 0;
+ return __wasm_ctz_i32(x | 0) | 0 | 0;
}
function $17(x) {
x = x | 0;
- return __wasm_popcnt_i32(x) | 0 | 0;
+ return __wasm_popcnt_i32(x | 0) | 0 | 0;
}
function $18(x) {
@@ -190,18 +190,18 @@ function asmFunc(global, env, buffer) {
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;
+ var $9 = 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) {
x = x | 0;
- var count = 0, $2 = 0;
+ var count = 0, $5 = 0;
count = 0;
b : {
l : do {
- $2 = count;
+ $5 = count;
if ((x | 0) == (0 | 0)) break b;
x = x & (x - 1 | 0) | 0;
count = count + 1 | 0;
@@ -209,7 +209,7 @@ function asmFunc(global, env, buffer) {
break l;
} while (1);
};
- return $2 | 0;
+ return $5 | 0;
}
function __wasm_rotl_i32(x, k) {
diff --git a/test/wasm2asm/i64-add-sub.2asm.js b/test/wasm2asm/i64-add-sub.2asm.js
index 550c08a67..096a94346 100644
--- a/test/wasm2asm/i64-add-sub.2asm.js
+++ b/test/wasm2asm/i64-add-sub.2asm.js
@@ -29,15 +29,20 @@ function asmFunc(global, env, buffer) {
$1$hi = $1$hi | 0;
r = r | 0;
r$hi = r$hi | 0;
- var i64toi32_i32$3 = 0, i64toi32_i32$2 = 0, i64toi32_i32$4 = 0, i64toi32_i32$5 = 0;
- i64toi32_i32$2 = $0;
+ var i64toi32_i32$0 = 0, i64toi32_i32$5 = 0, i64toi32_i32$3 = 0, i64toi32_i32$4 = 0, $5$hi = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = $1$hi;
+ i64toi32_i32$0 = $0$hi;
i64toi32_i32$3 = $1;
- i64toi32_i32$4 = i64toi32_i32$2 + i64toi32_i32$3 | 0;
- i64toi32_i32$5 = $0$hi + $1$hi | 0;
+ i64toi32_i32$4 = $0 + i64toi32_i32$3 | 0;
+ i64toi32_i32$5 = i64toi32_i32$0 + $1$hi | 0;
if (i64toi32_i32$4 >>> 0 < i64toi32_i32$3 >>> 0) i64toi32_i32$5 = i64toi32_i32$5 + 1 | 0;
- i64toi32_i32$2 = r$hi;
+ $5$hi = i64toi32_i32$5;
+ i64toi32_i32$5 = r$hi;
+ i64toi32_i32$5 = $5$hi;
+ i64toi32_i32$0 = i64toi32_i32$4;
i64toi32_i32$3 = r;
- return (i64toi32_i32$4 | 0) == (i64toi32_i32$3 | 0) & (i64toi32_i32$5 | 0) == (i64toi32_i32$2 | 0) | 0 | 0;
+ return (i64toi32_i32$0 | 0) == (i64toi32_i32$3 | 0) & (i64toi32_i32$5 | 0) == (r$hi | 0) | 0 | 0;
}
function $2($0, $0$hi, $1, $1$hi, r, r$hi) {
@@ -47,54 +52,23 @@ function asmFunc(global, env, buffer) {
$1$hi = $1$hi | 0;
r = r | 0;
r$hi = r$hi | 0;
- var i64toi32_i32$2 = 0, i64toi32_i32$3 = 0, i64toi32_i32$0 = 0, i64toi32_i32$5 = 0;
+ var i64toi32_i32$0 = 0, i64toi32_i32$5 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0, $5$hi = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = $1$hi;
i64toi32_i32$0 = $0$hi;
i64toi32_i32$2 = $0;
i64toi32_i32$3 = $1;
i64toi32_i32$5 = (i64toi32_i32$2 >>> 0 < i64toi32_i32$3 >>> 0) + $1$hi | 0;
i64toi32_i32$5 = i64toi32_i32$0 - i64toi32_i32$5 | 0;
+ $5$hi = i64toi32_i32$5;
+ i64toi32_i32$5 = r$hi;
+ i64toi32_i32$5 = $5$hi;
i64toi32_i32$0 = i64toi32_i32$2 - i64toi32_i32$3 | 0;
i64toi32_i32$2 = r$hi;
i64toi32_i32$3 = r;
return (i64toi32_i32$0 | 0) == (i64toi32_i32$3 | 0) & (i64toi32_i32$5 | 0) == (i64toi32_i32$2 | 0) | 0 | 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;
- 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);
- };
- return $2 | 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 {
check_add_i64: $1,
check_sub_i64: $2
diff --git a/test/wasm2asm/i64-lowering.2asm.js b/test/wasm2asm/i64-lowering.2asm.js
index 03fe8b2e6..a497ed060 100644
--- a/test/wasm2asm/i64-lowering.2asm.js
+++ b/test/wasm2asm/i64-lowering.2asm.js
@@ -27,7 +27,11 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
$1 = $1 | 0;
$1$hi = $1$hi | 0;
- return ($0 | 0) == ($1 | 0) & ($0$hi | 0) == ($1$hi | 0) | 0 | 0;
+ var i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = $1$hi;
+ i64toi32_i32$0 = $0$hi;
+ return ($0 | 0) == ($1 | 0) & (i64toi32_i32$0 | 0) == ($1$hi | 0) | 0 | 0;
}
function $2($0, $0$hi, $1, $1$hi) {
@@ -35,7 +39,11 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
$1 = $1 | 0;
$1$hi = $1$hi | 0;
- return ($0 | 0) != ($1 | 0) | ($0$hi | 0) != ($1$hi | 0) | 0 | 0;
+ var i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = $1$hi;
+ i64toi32_i32$0 = $0$hi;
+ return ($0 | 0) != ($1 | 0) | (i64toi32_i32$0 | 0) != ($1$hi | 0) | 0 | 0;
}
function $3($0, $0$hi, $1, $1$hi) {
@@ -43,19 +51,21 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
$1 = $1 | 0;
$1$hi = $1$hi | 0;
- var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, $6 = 0, $7 = 0, $8 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0;
+ var i64toi32_i32$0 = 0, $8 = 0, $9 = 0, $10 = 0, i64toi32_i32$2 = 0, i64toi32_i32$1 = 0, i64toi32_i32$3 = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = $1$hi;
i64toi32_i32$0 = $0$hi;
i64toi32_i32$2 = $0;
i64toi32_i32$1 = $1$hi;
i64toi32_i32$3 = $1;
- if ((i64toi32_i32$0 | 0) > (i64toi32_i32$1 | 0)) $6 = 1; else {
+ if ((i64toi32_i32$0 | 0) > ($1$hi | 0)) $8 = 1; else {
if ((i64toi32_i32$0 | 0) >= (i64toi32_i32$1 | 0)) {
- if (i64toi32_i32$2 >>> 0 < i64toi32_i32$3 >>> 0) $7 = 0; else $7 = 1;
- $8 = $7;
- } else $8 = 0;
- $6 = $8;
+ if (i64toi32_i32$2 >>> 0 < i64toi32_i32$3 >>> 0) $9 = 0; else $9 = 1;
+ $10 = $9;
+ } else $10 = 0;
+ $8 = $10;
}
- return $6 | 0;
+ return $8 | 0;
}
function $4($0, $0$hi, $1, $1$hi) {
@@ -63,19 +73,21 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
$1 = $1 | 0;
$1$hi = $1$hi | 0;
- var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, $6 = 0, $7 = 0, $8 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0;
+ var i64toi32_i32$0 = 0, $8 = 0, $9 = 0, $10 = 0, i64toi32_i32$2 = 0, i64toi32_i32$1 = 0, i64toi32_i32$3 = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = $1$hi;
i64toi32_i32$0 = $0$hi;
i64toi32_i32$2 = $0;
i64toi32_i32$1 = $1$hi;
i64toi32_i32$3 = $1;
- if ((i64toi32_i32$0 | 0) > (i64toi32_i32$1 | 0)) $6 = 1; else {
+ if ((i64toi32_i32$0 | 0) > ($1$hi | 0)) $8 = 1; else {
if ((i64toi32_i32$0 | 0) >= (i64toi32_i32$1 | 0)) {
- if (i64toi32_i32$2 >>> 0 <= i64toi32_i32$3 >>> 0) $7 = 0; else $7 = 1;
- $8 = $7;
- } else $8 = 0;
- $6 = $8;
+ if (i64toi32_i32$2 >>> 0 <= i64toi32_i32$3 >>> 0) $9 = 0; else $9 = 1;
+ $10 = $9;
+ } else $10 = 0;
+ $8 = $10;
}
- return $6 | 0;
+ return $8 | 0;
}
function $5($0, $0$hi, $1, $1$hi) {
@@ -83,19 +95,21 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
$1 = $1 | 0;
$1$hi = $1$hi | 0;
- var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, $6 = 0, $7 = 0, $8 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0;
+ var i64toi32_i32$0 = 0, $8 = 0, $9 = 0, $10 = 0, i64toi32_i32$2 = 0, i64toi32_i32$1 = 0, i64toi32_i32$3 = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = $1$hi;
i64toi32_i32$0 = $0$hi;
i64toi32_i32$2 = $0;
i64toi32_i32$1 = $1$hi;
i64toi32_i32$3 = $1;
- if ((i64toi32_i32$0 | 0) < (i64toi32_i32$1 | 0)) $6 = 1; else {
+ if ((i64toi32_i32$0 | 0) < ($1$hi | 0)) $8 = 1; else {
if ((i64toi32_i32$0 | 0) <= (i64toi32_i32$1 | 0)) {
- if (i64toi32_i32$2 >>> 0 > i64toi32_i32$3 >>> 0) $7 = 0; else $7 = 1;
- $8 = $7;
- } else $8 = 0;
- $6 = $8;
+ if (i64toi32_i32$2 >>> 0 > i64toi32_i32$3 >>> 0) $9 = 0; else $9 = 1;
+ $10 = $9;
+ } else $10 = 0;
+ $8 = $10;
}
- return $6 | 0;
+ return $8 | 0;
}
function $6($0, $0$hi, $1, $1$hi) {
@@ -103,19 +117,21 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
$1 = $1 | 0;
$1$hi = $1$hi | 0;
- var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, $6 = 0, $7 = 0, $8 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0;
+ var i64toi32_i32$0 = 0, $8 = 0, $9 = 0, $10 = 0, i64toi32_i32$2 = 0, i64toi32_i32$1 = 0, i64toi32_i32$3 = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = $1$hi;
i64toi32_i32$0 = $0$hi;
i64toi32_i32$2 = $0;
i64toi32_i32$1 = $1$hi;
i64toi32_i32$3 = $1;
- if ((i64toi32_i32$0 | 0) < (i64toi32_i32$1 | 0)) $6 = 1; else {
+ if ((i64toi32_i32$0 | 0) < ($1$hi | 0)) $8 = 1; else {
if ((i64toi32_i32$0 | 0) <= (i64toi32_i32$1 | 0)) {
- if (i64toi32_i32$2 >>> 0 >= i64toi32_i32$3 >>> 0) $7 = 0; else $7 = 1;
- $8 = $7;
- } else $8 = 0;
- $6 = $8;
+ if (i64toi32_i32$2 >>> 0 >= i64toi32_i32$3 >>> 0) $9 = 0; else $9 = 1;
+ $10 = $9;
+ } else $10 = 0;
+ $8 = $10;
}
- return $6 | 0;
+ return $8 | 0;
}
function $7($0, $0$hi, $1, $1$hi) {
@@ -123,10 +139,11 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
$1 = $1 | 0;
$1$hi = $1$hi | 0;
- var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0;
+ var i64toi32_i32$0 = 0;
i64toi32_i32$0 = $0$hi;
- i64toi32_i32$1 = $1$hi;
- return i64toi32_i32$0 >>> 0 > i64toi32_i32$1 >>> 0 | ((i64toi32_i32$0 | 0) == (i64toi32_i32$1 | 0) & $0 >>> 0 >= $1 >>> 0 | 0) | 0 | 0;
+ i64toi32_i32$0 = $1$hi;
+ i64toi32_i32$0 = $0$hi;
+ return i64toi32_i32$0 >>> 0 > $1$hi >>> 0 | ((i64toi32_i32$0 | 0) == ($1$hi | 0) & $0 >>> 0 >= $1 >>> 0 | 0) | 0 | 0;
}
function $8($0, $0$hi, $1, $1$hi) {
@@ -134,10 +151,11 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
$1 = $1 | 0;
$1$hi = $1$hi | 0;
- var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0;
+ var i64toi32_i32$0 = 0;
i64toi32_i32$0 = $0$hi;
- i64toi32_i32$1 = $1$hi;
- return i64toi32_i32$0 >>> 0 > i64toi32_i32$1 >>> 0 | ((i64toi32_i32$0 | 0) == (i64toi32_i32$1 | 0) & $0 >>> 0 > $1 >>> 0 | 0) | 0 | 0;
+ i64toi32_i32$0 = $1$hi;
+ i64toi32_i32$0 = $0$hi;
+ return i64toi32_i32$0 >>> 0 > $1$hi >>> 0 | ((i64toi32_i32$0 | 0) == ($1$hi | 0) & $0 >>> 0 > $1 >>> 0 | 0) | 0 | 0;
}
function $9($0, $0$hi, $1, $1$hi) {
@@ -145,10 +163,11 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
$1 = $1 | 0;
$1$hi = $1$hi | 0;
- var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0;
+ var i64toi32_i32$0 = 0;
i64toi32_i32$0 = $0$hi;
- i64toi32_i32$1 = $1$hi;
- return i64toi32_i32$0 >>> 0 < i64toi32_i32$1 >>> 0 | ((i64toi32_i32$0 | 0) == (i64toi32_i32$1 | 0) & $0 >>> 0 <= $1 >>> 0 | 0) | 0 | 0;
+ i64toi32_i32$0 = $1$hi;
+ i64toi32_i32$0 = $0$hi;
+ return i64toi32_i32$0 >>> 0 < $1$hi >>> 0 | ((i64toi32_i32$0 | 0) == ($1$hi | 0) & $0 >>> 0 <= $1 >>> 0 | 0) | 0 | 0;
}
function $10($0, $0$hi, $1, $1$hi) {
@@ -156,46 +175,11 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
$1 = $1 | 0;
$1$hi = $1$hi | 0;
- var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0;
+ var i64toi32_i32$0 = 0;
i64toi32_i32$0 = $0$hi;
- i64toi32_i32$1 = $1$hi;
- return i64toi32_i32$0 >>> 0 < i64toi32_i32$1 >>> 0 | ((i64toi32_i32$0 | 0) == (i64toi32_i32$1 | 0) & $0 >>> 0 < $1 >>> 0 | 0) | 0 | 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;
- 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);
- };
- return $2 | 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;
+ i64toi32_i32$0 = $1$hi;
+ i64toi32_i32$0 = $0$hi;
+ return i64toi32_i32$0 >>> 0 < $1$hi >>> 0 | ((i64toi32_i32$0 | 0) == ($1$hi | 0) & $0 >>> 0 < $1 >>> 0 | 0) | 0 | 0;
}
return {
diff --git a/test/wasm2asm/i64-rotate.2asm.js b/test/wasm2asm/i64-rotate.2asm.js
index 2d30f3f40..860ad7fbb 100644
--- a/test/wasm2asm/i64-rotate.2asm.js
+++ b/test/wasm2asm/i64-rotate.2asm.js
@@ -29,14 +29,20 @@ function asmFunc(global, env, buffer) {
$1$hi = $1$hi | 0;
$2 = $2 | 0;
$2$hi = $2$hi | 0;
- var i64toi32_i32$0 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0;
+ var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, i64toi32_i32$3 = 0, i64toi32_i32$4 = 0, $5$hi = 0;
i64toi32_i32$0 = $0$hi;
- i64toi32_i32$2 = $0;
+ i64toi32_i32$0 = $1$hi;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$1 = $1$hi;
i64toi32_i32$3 = $1;
- i64toi32_i32$0 = __wasm_rotl_i64(i64toi32_i32$2 | 0, i64toi32_i32$0 | 0, i64toi32_i32$3 & 63 | 0 | 0) | 0;
- i64toi32_i32$2 = $2$hi;
+ i64toi32_i32$4 = __wasm_rotl_i64($0 | 0, i64toi32_i32$0 | 0, i64toi32_i32$3 & 63 | 0 | 0) | 0;
+ i64toi32_i32$1 = i64toi32_i32$HIGH_BITS;
+ $5$hi = i64toi32_i32$1;
+ i64toi32_i32$1 = $2$hi;
+ i64toi32_i32$1 = $5$hi;
+ i64toi32_i32$0 = i64toi32_i32$4;
i64toi32_i32$3 = $2;
- return (i64toi32_i32$0 | 0) == (i64toi32_i32$3 | 0) & (i64toi32_i32$HIGH_BITS | 0) == (i64toi32_i32$2 | 0) | 0 | 0;
+ return (i64toi32_i32$0 | 0) == (i64toi32_i32$3 | 0) & (i64toi32_i32$1 | 0) == ($2$hi | 0) | 0 | 0;
}
function $2($0, $0$hi, $1, $1$hi, $2, $2$hi) {
@@ -46,50 +52,20 @@ function asmFunc(global, env, buffer) {
$1$hi = $1$hi | 0;
$2 = $2 | 0;
$2$hi = $2$hi | 0;
- var i64toi32_i32$0 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0;
+ var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, i64toi32_i32$3 = 0, i64toi32_i32$4 = 0, $5$hi = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = $1$hi;
i64toi32_i32$0 = $0$hi;
- i64toi32_i32$2 = $0;
+ i64toi32_i32$1 = $1$hi;
i64toi32_i32$3 = $1;
- i64toi32_i32$0 = __wasm_rotr_i64(i64toi32_i32$2 | 0, i64toi32_i32$0 | 0, i64toi32_i32$3 & 63 | 0 | 0) | 0;
- i64toi32_i32$2 = $2$hi;
+ i64toi32_i32$4 = __wasm_rotr_i64($0 | 0, i64toi32_i32$0 | 0, i64toi32_i32$3 & 63 | 0 | 0) | 0;
+ i64toi32_i32$1 = i64toi32_i32$HIGH_BITS;
+ $5$hi = i64toi32_i32$1;
+ i64toi32_i32$1 = $2$hi;
+ i64toi32_i32$1 = $5$hi;
+ i64toi32_i32$0 = i64toi32_i32$4;
i64toi32_i32$3 = $2;
- return (i64toi32_i32$0 | 0) == (i64toi32_i32$3 | 0) & (i64toi32_i32$HIGH_BITS | 0) == (i64toi32_i32$2 | 0) | 0 | 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;
- 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);
- };
- return $2 | 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 (i64toi32_i32$0 | 0) == (i64toi32_i32$3 | 0) & (i64toi32_i32$1 | 0) == ($2$hi | 0) | 0 | 0;
}
function __wasm_rotl_i64($0, $1, $2) {
diff --git a/test/wasm2asm/i64-shifts.2asm.js b/test/wasm2asm/i64-shifts.2asm.js
index ec79804e5..b7375fc08 100644
--- a/test/wasm2asm/i64-shifts.2asm.js
+++ b/test/wasm2asm/i64-shifts.2asm.js
@@ -29,7 +29,9 @@ function asmFunc(global, env, buffer) {
$1$hi = $1$hi | 0;
$2 = $2 | 0;
$2$hi = $2$hi | 0;
- var i64toi32_i32$2 = 0, i64toi32_i32$4 = 0, i64toi32_i32$3 = 0, i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, $11 = 0;
+ var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, i64toi32_i32$2 = 0, i64toi32_i32$4 = 0, i64toi32_i32$3 = 0, $12 = 0, $5$hi = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = $1$hi;
i64toi32_i32$0 = $0$hi;
i64toi32_i32$2 = $0;
i64toi32_i32$1 = $1$hi;
@@ -37,12 +39,15 @@ function asmFunc(global, env, buffer) {
i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0;
if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) {
i64toi32_i32$1 = i64toi32_i32$2 << i64toi32_i32$4 | 0;
- $11 = 0;
+ $12 = 0;
} else {
i64toi32_i32$1 = ((1 << i64toi32_i32$4 | 0) - 1 | 0) & (i64toi32_i32$2 >>> (32 - i64toi32_i32$4 | 0) | 0) | 0 | (i64toi32_i32$0 << i64toi32_i32$4 | 0) | 0;
- $11 = i64toi32_i32$2 << i64toi32_i32$4 | 0;
+ $12 = i64toi32_i32$2 << i64toi32_i32$4 | 0;
}
- i64toi32_i32$0 = $11;
+ $5$hi = i64toi32_i32$1;
+ i64toi32_i32$1 = $2$hi;
+ i64toi32_i32$1 = $5$hi;
+ i64toi32_i32$0 = $12;
i64toi32_i32$2 = $2$hi;
i64toi32_i32$3 = $2;
return (i64toi32_i32$0 | 0) == (i64toi32_i32$3 | 0) & (i64toi32_i32$1 | 0) == (i64toi32_i32$2 | 0) | 0 | 0;
@@ -55,7 +60,9 @@ function asmFunc(global, env, buffer) {
$1$hi = $1$hi | 0;
$2 = $2 | 0;
$2$hi = $2$hi | 0;
- var i64toi32_i32$0 = 0, i64toi32_i32$4 = 0, i64toi32_i32$3 = 0, i64toi32_i32$2 = 0, i64toi32_i32$1 = 0, $11 = 0;
+ var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, i64toi32_i32$4 = 0, i64toi32_i32$3 = 0, i64toi32_i32$2 = 0, $12 = 0, $5$hi = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = $1$hi;
i64toi32_i32$0 = $0$hi;
i64toi32_i32$2 = $0;
i64toi32_i32$1 = $1$hi;
@@ -63,51 +70,18 @@ function asmFunc(global, env, buffer) {
i64toi32_i32$4 = i64toi32_i32$3 & 31 | 0;
if (32 >>> 0 <= (i64toi32_i32$3 & 63 | 0) >>> 0) {
i64toi32_i32$1 = i64toi32_i32$0 >> 31 | 0;
- $11 = i64toi32_i32$0 >> i64toi32_i32$4 | 0;
+ $12 = i64toi32_i32$0 >> i64toi32_i32$4 | 0;
} else {
i64toi32_i32$1 = i64toi32_i32$0 >> i64toi32_i32$4 | 0;
- $11 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$0 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0;
+ $12 = (((1 << i64toi32_i32$4 | 0) - 1 | 0) & i64toi32_i32$0 | 0) << (32 - i64toi32_i32$4 | 0) | 0 | (i64toi32_i32$2 >>> i64toi32_i32$4 | 0) | 0;
}
- i64toi32_i32$0 = $11;
+ $5$hi = i64toi32_i32$1;
+ i64toi32_i32$1 = $2$hi;
+ i64toi32_i32$1 = $5$hi;
+ i64toi32_i32$0 = $12;
i64toi32_i32$2 = $2$hi;
i64toi32_i32$3 = $2;
- return (i64toi32_i32$0 | 0) == (i64toi32_i32$3 | 0) & (i64toi32_i32$1 | 0) == (i64toi32_i32$2 | 0) | 0 | 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;
- 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);
- };
- return $2 | 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 (i64toi32_i32$0 | 0) == (i64toi32_i32$3 | 0) & (i64toi32_i32$1 | 0) == ($2$hi | 0) | 0 | 0;
}
return {
diff --git a/test/wasm2asm/reinterpret.2asm.js b/test/wasm2asm/reinterpret.2asm.js
index 2cbd597f6..6adf2b95d 100644
--- a/test/wasm2asm/reinterpret.2asm.js
+++ b/test/wasm2asm/reinterpret.2asm.js
@@ -30,46 +30,17 @@ function asmFunc(global, env, buffer) {
function $2($0, $0$hi) {
$0 = $0 | 0;
$0$hi = $0$hi | 0;
+ var i64toi32_i32$0 = 0, $3$hi = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
HEAP32[0 >> 2] = $0;
- HEAP32[(0 + 4 | 0) >> 2] = $0$hi;
+ HEAP32[(0 + 4 | 0) >> 2] = i64toi32_i32$0;
HEAPF64[0 >> 3] = +HEAPF64[0 >> 3];
- return (HEAP32[0 >> 2] | 0 | 0) == ($0 | 0) & (HEAP32[(0 + 4 | 0) >> 2] | 0 | 0) == ($0$hi | 0) | 0 | 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;
- 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);
- };
- return $2 | 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;
+ i64toi32_i32$0 = HEAP32[(0 + 4 | 0) >> 2] | 0;
+ $3$hi = i64toi32_i32$0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = $3$hi;
+ return (HEAP32[0 >> 2] | 0 | 0) == ($0 | 0) & (i64toi32_i32$0 | 0) == ($0$hi | 0) | 0 | 0;
}
return {
diff --git a/test/wasm2asm/unary-ops.2asm.js b/test/wasm2asm/unary-ops.2asm.js
index ccd55fbe6..ebc4d11e4 100644
--- a/test/wasm2asm/unary-ops.2asm.js
+++ b/test/wasm2asm/unary-ops.2asm.js
@@ -24,7 +24,7 @@ function asmFunc(global, env, buffer) {
function $1($0) {
$0 = $0 | 0;
- return __wasm_popcnt_i32($0) | 0 | 0;
+ return __wasm_popcnt_i32($0 | 0) | 0 | 0;
}
function $2($0, $0$hi, r, r$hi) {
@@ -32,28 +32,41 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
r = r | 0;
r$hi = r$hi | 0;
- var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0;
+ var i64toi32_i32$0 = 0, i64toi32_i32$2 = 0, i64toi32_i32$1 = 0, $3$hi = 0;
i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
i64toi32_i32$1 = $0;
+ i64toi32_i32$2 = 0;
+ $3$hi = i64toi32_i32$2;
+ i64toi32_i32$2 = r$hi;
+ i64toi32_i32$2 = $3$hi;
i64toi32_i32$1 = (__wasm_popcnt_i32(i64toi32_i32$0) | 0) + (__wasm_popcnt_i32(i64toi32_i32$1) | 0) | 0;
i64toi32_i32$0 = r$hi;
- return (i64toi32_i32$1 | 0) == (r | 0) & (0 | 0) == (i64toi32_i32$0 | 0) | 0 | 0;
+ return (i64toi32_i32$1 | 0) == (r | 0) & (i64toi32_i32$2 | 0) == (i64toi32_i32$0 | 0) | 0 | 0;
}
function $3($0, r, r$hi) {
$0 = $0 | 0;
r = r | 0;
r$hi = r$hi | 0;
- return ($0 | 0) == (r | 0) & (0 | 0) == (r$hi | 0) | 0 | 0;
+ var i64toi32_i32$0 = 0, $3$hi = 0;
+ i64toi32_i32$0 = 0;
+ $3$hi = i64toi32_i32$0;
+ i64toi32_i32$0 = r$hi;
+ i64toi32_i32$0 = $3$hi;
+ return ($0 | 0) == (r | 0) & (i64toi32_i32$0 | 0) == (r$hi | 0) | 0 | 0;
}
function $4($0, r, r$hi) {
$0 = $0 | 0;
r = r | 0;
r$hi = r$hi | 0;
- var i64toi32_i32$1 = 0, i64toi32_i32$0 = 0;
+ var i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, $3$hi = 0;
i64toi32_i32$1 = $0;
i64toi32_i32$0 = i64toi32_i32$1 >> 31 | 0;
+ $3$hi = i64toi32_i32$0;
+ i64toi32_i32$0 = r$hi;
+ i64toi32_i32$0 = $3$hi;
i64toi32_i32$1 = r$hi;
return ($0 | 0) == (r | 0) & (i64toi32_i32$0 | 0) == (i64toi32_i32$1 | 0) | 0 | 0;
}
@@ -61,7 +74,10 @@ function asmFunc(global, env, buffer) {
function $5($0, $0$hi) {
$0 = $0 | 0;
$0$hi = $0$hi | 0;
- return ($0 | $0$hi | 0 | 0) == (0 | 0) | 0;
+ var i64toi32_i32$0 = 0;
+ i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
+ return ($0 | i64toi32_i32$0 | 0 | 0) == (0 | 0) | 0;
}
function $6($0) {
@@ -71,7 +87,7 @@ function asmFunc(global, env, buffer) {
function $7($0) {
$0 = $0 | 0;
- return __wasm_ctz_i32($0) | 0 | 0;
+ return __wasm_ctz_i32($0 | 0) | 0 | 0;
}
function $8($0, $0$hi, r, r$hi) {
@@ -79,13 +95,17 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
r = r | 0;
r$hi = r$hi | 0;
- var i64toi32_i32$3 = 0, i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, $7 = 0, i64toi32_i32$2 = 0;
+ var i64toi32_i32$0 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0, i64toi32_i32$1 = 0, $9 = 0, $3$hi = 0;
i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
i64toi32_i32$1 = $0;
i64toi32_i32$3 = Math_clz32(i64toi32_i32$0);
i64toi32_i32$2 = 0;
- if ((i64toi32_i32$3 | 0) == (32 | 0)) $7 = Math_clz32(i64toi32_i32$1) + 32 | 0; else $7 = i64toi32_i32$3;
- i64toi32_i32$1 = $7;
+ if ((i64toi32_i32$3 | 0) == (32 | 0)) $9 = Math_clz32(i64toi32_i32$1) + 32 | 0; else $9 = i64toi32_i32$3;
+ $3$hi = i64toi32_i32$2;
+ i64toi32_i32$2 = r$hi;
+ i64toi32_i32$2 = $3$hi;
+ i64toi32_i32$1 = $9;
i64toi32_i32$0 = r$hi;
i64toi32_i32$3 = r;
return (i64toi32_i32$1 | 0) == (i64toi32_i32$3 | 0) & (i64toi32_i32$2 | 0) == (i64toi32_i32$0 | 0) | 0 | 0;
@@ -96,13 +116,17 @@ function asmFunc(global, env, buffer) {
$0$hi = $0$hi | 0;
r = r | 0;
r$hi = r$hi | 0;
- var i64toi32_i32$3 = 0, i64toi32_i32$0 = 0, i64toi32_i32$1 = 0, $7 = 0, i64toi32_i32$2 = 0;
+ var i64toi32_i32$0 = 0, i64toi32_i32$2 = 0, i64toi32_i32$3 = 0, i64toi32_i32$1 = 0, $9 = 0, $3$hi = 0;
i64toi32_i32$0 = $0$hi;
+ i64toi32_i32$0 = i64toi32_i32$0;
i64toi32_i32$1 = $0;
i64toi32_i32$3 = __wasm_ctz_i32(i64toi32_i32$1) | 0;
i64toi32_i32$2 = 0;
- if ((i64toi32_i32$3 | 0) == (32 | 0)) $7 = (__wasm_ctz_i32(i64toi32_i32$0) | 0) + 32 | 0; else $7 = i64toi32_i32$3;
- i64toi32_i32$1 = $7;
+ if ((i64toi32_i32$3 | 0) == (32 | 0)) $9 = (__wasm_ctz_i32(i64toi32_i32$0) | 0) + 32 | 0; else $9 = i64toi32_i32$3;
+ $3$hi = i64toi32_i32$2;
+ i64toi32_i32$2 = r$hi;
+ i64toi32_i32$2 = $3$hi;
+ i64toi32_i32$1 = $9;
i64toi32_i32$0 = r$hi;
i64toi32_i32$3 = r;
return (i64toi32_i32$1 | 0) == (i64toi32_i32$3 | 0) & (i64toi32_i32$2 | 0) == (i64toi32_i32$0 | 0) | 0 | 0;
@@ -110,18 +134,18 @@ function asmFunc(global, env, buffer) {
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;
+ var $9 = 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) {
x = x | 0;
- var count = 0, $2 = 0;
+ var count = 0, $5 = 0;
count = 0;
b : {
l : do {
- $2 = count;
+ $5 = count;
if ((x | 0) == (0 | 0)) break b;
x = x & (x - 1 | 0) | 0;
count = count + 1 | 0;
@@ -129,19 +153,7 @@ function asmFunc(global, env, buffer) {
break l;
} while (1);
};
- return $2 | 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 $5 | 0;
}
return {