summaryrefslogtreecommitdiff
path: root/test/wasm2js
diff options
context:
space:
mode:
Diffstat (limited to 'test/wasm2js')
-rw-r--r--test/wasm2js/conversions-modified.2asm.js.opt30
-rw-r--r--test/wasm2js/emscripten.2asm.js9
-rw-r--r--test/wasm2js/emscripten.2asm.js.opt12
-rw-r--r--test/wasm2js/emscripten.wast8
-rw-r--r--test/wasm2js/float-ops.2asm.js.opt26
5 files changed, 29 insertions, 56 deletions
diff --git a/test/wasm2js/conversions-modified.2asm.js.opt b/test/wasm2js/conversions-modified.2asm.js.opt
index 1f1fd7ac5..2a28ceeba 100644
--- a/test/wasm2js/conversions-modified.2asm.js.opt
+++ b/test/wasm2js/conversions-modified.2asm.js.opt
@@ -76,36 +76,14 @@ function asmFunc(global, env, buffer) {
function $7($0) {
$0 = Math_fround($0);
- var $1 = 0, $2 = 0;
- $2 = ~~$0 >>> 0;
- if (Math_fround(Math_abs($0)) >= Math_fround(1.0)) {
- if ($0 > Math_fround(0.0)) {
- $1 = ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround($0 / Math_fround(4294967296.0)))), Math_fround(4294967296.0))) >>> 0
- } else {
- $1 = ~~Math_fround(Math_ceil(Math_fround(Math_fround($0 - Math_fround(~~$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0
- }
- } else {
- $1 = 0
- }
- i64toi32_i32$HIGH_BITS = $1;
- return $2 | 0;
+ i64toi32_i32$HIGH_BITS = Math_fround(Math_abs($0)) >= Math_fround(1.0) ? ($0 > Math_fround(0.0) ? ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround($0 / Math_fround(4294967296.0)))), Math_fround(4294967296.0))) >>> 0 : ~~Math_fround(Math_ceil(Math_fround(Math_fround($0 - Math_fround(~~$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0) : 0;
+ return ~~$0 >>> 0;
}
function $9($0) {
$0 = +$0;
- var $1 = 0, $2 = 0;
- $2 = ~~$0 >>> 0;
- if (Math_abs($0) >= 1.0) {
- if ($0 > 0.0) {
- $1 = ~~Math_min(Math_floor($0 / 4294967296.0), 4294967295.0) >>> 0
- } else {
- $1 = ~~Math_ceil(($0 - +(~~$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0
- }
- } else {
- $1 = 0
- }
- i64toi32_i32$HIGH_BITS = $1;
- return $2 | 0;
+ i64toi32_i32$HIGH_BITS = Math_abs($0) >= 1.0 ? ($0 > 0.0 ? ~~Math_min(Math_floor($0 / 4294967296.0), 4294967295.0) >>> 0 : ~~Math_ceil(($0 - +(~~$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0) : 0;
+ return ~~$0 >>> 0;
}
function $11($0) {
diff --git a/test/wasm2js/emscripten.2asm.js b/test/wasm2js/emscripten.2asm.js
index 79da32b8f..664eb654a 100644
--- a/test/wasm2js/emscripten.2asm.js
+++ b/test/wasm2js/emscripten.2asm.js
@@ -80,6 +80,12 @@ function asmFunc(global, env, buffer) {
return x - -5 | 0 | 0;
}
+ function select(x) {
+ x = x | 0;
+ var wasm2js_i32$0 = 0, wasm2js_i32$1 = 0, wasm2js_i32$2 = 0;
+ return (wasm2js_i32$0 = x, wasm2js_i32$1 = HEAP32[16 >> 2] | 0, wasm2js_i32$2 = x, wasm2js_i32$2 ? wasm2js_i32$0 : wasm2js_i32$1) | 0;
+ }
+
// EMSCRIPTEN_END_FUNCS;
FUNCTION_TABLE[1] = foo;
FUNCTION_TABLE[2] = bar;
@@ -89,7 +95,8 @@ function asmFunc(global, env, buffer) {
"other": other,
"__growWasmMemory": __growWasmMemory,
"exported": exported,
- "sub_zero": sub_zero
+ "sub_zero": sub_zero,
+ "select": select
};
}
diff --git a/test/wasm2js/emscripten.2asm.js.opt b/test/wasm2js/emscripten.2asm.js.opt
index ae1c9c53d..4426d7400 100644
--- a/test/wasm2js/emscripten.2asm.js.opt
+++ b/test/wasm2js/emscripten.2asm.js.opt
@@ -41,10 +41,6 @@ function asmFunc(global, env, buffer) {
}
function bar() {
- HEAPU8[128 | 0];
- HEAP8[128 | 0];
- HEAPU16[128 >> 1];
- HEAP16[128 >> 1];
HEAP32[16 >> 2] = 3;
HEAPF32[16 >> 2] = 7;
HEAPF64[16 >> 3] = 11;
@@ -66,6 +62,11 @@ function asmFunc(global, env, buffer) {
return $0 + 5 | 0;
}
+ function select($0) {
+ $0 = $0 | 0;
+ return ($0 ? $0 : HEAP32[16 >> 2]) | 0;
+ }
+
// EMSCRIPTEN_END_FUNCS;
FUNCTION_TABLE[1] = foo;
FUNCTION_TABLE[2] = bar;
@@ -75,7 +76,8 @@ function asmFunc(global, env, buffer) {
"other": other,
"__growWasmMemory": __growWasmMemory,
"exported": internal,
- "sub_zero": sub_zero
+ "sub_zero": sub_zero,
+ "select": select
};
}
diff --git a/test/wasm2js/emscripten.wast b/test/wasm2js/emscripten.wast
index 8f797f8fc..5731eacff 100644
--- a/test/wasm2js/emscripten.wast
+++ b/test/wasm2js/emscripten.wast
@@ -13,6 +13,7 @@
(export "__growWasmMemory" (func $__growWasmMemory))
(export "exported" (func $exported))
(export "sub-zero" (func $sub-zero))
+ (export "select" (func $select))
(func $main
(drop (call $syscall$6 (i32.const 1) (i32.const 2)))
(drop (call $syscall$54 (i32.const 3) (i32.const 4)))
@@ -90,5 +91,12 @@
(func $sub-zero (param $x i32) (result i32)
(i32.sub (local.get $x) (i32.const -5))
)
+ (func $select (param $x i32) (result i32)
+ (select
+ (local.get $x)
+ (i32.load (i32.const 16)) ;; we can ignore this implicit trap, no side effects
+ (local.get $x)
+ )
+ )
)
diff --git a/test/wasm2js/float-ops.2asm.js.opt b/test/wasm2js/float-ops.2asm.js.opt
index 4ef79e58a..130fe6bce 100644
--- a/test/wasm2js/float-ops.2asm.js.opt
+++ b/test/wasm2js/float-ops.2asm.js.opt
@@ -247,34 +247,12 @@ function asmFunc(global, env, buffer) {
function $47($0) {
$0 = Math_fround($0);
- var $1_1 = 0, $2_1 = 0;
- $2_1 = ~~$0 >>> 0;
- if (Math_fround(Math_abs($0)) >= Math_fround(1.0)) {
- if ($0 > Math_fround(0.0)) {
- $1_1 = ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround($0 / Math_fround(4294967296.0)))), Math_fround(4294967296.0))) >>> 0
- } else {
- $1_1 = ~~Math_fround(Math_ceil(Math_fround(Math_fround($0 - Math_fround(~~$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0
- }
- } else {
- $1_1 = 0
- }
- return !($2_1 | $1_1) | 0;
+ return !(~~$0 >>> 0 | (Math_fround(Math_abs($0)) >= Math_fround(1.0) ? ($0 > Math_fround(0.0) ? ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround($0 / Math_fround(4294967296.0)))), Math_fround(4294967296.0))) >>> 0 : ~~Math_fround(Math_ceil(Math_fround(Math_fround($0 - Math_fround(~~$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0) : 0)) | 0;
}
function $48($0) {
$0 = +$0;
- var $1_1 = 0, $2_1 = 0;
- $2_1 = ~~$0 >>> 0;
- if (Math_abs($0) >= 1.0) {
- if ($0 > 0.0) {
- $1_1 = ~~Math_min(Math_floor($0 / 4294967296.0), 4294967295.0) >>> 0
- } else {
- $1_1 = ~~Math_ceil(($0 - +(~~$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0
- }
- } else {
- $1_1 = 0
- }
- return !($2_1 | $1_1) | 0;
+ return !(~~$0 >>> 0 | (Math_abs($0) >= 1.0 ? ($0 > 0.0 ? ~~Math_min(Math_floor($0 / 4294967296.0), 4294967295.0) >>> 0 : ~~Math_ceil(($0 - +(~~$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0) : 0)) | 0;
}
function legalstub$43($0, $1_1) {