summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/asm2wasm.h30
-rw-r--r--test/emcc_hello_world.fromasm964
-rw-r--r--test/emcc_hello_world.fromasm.imprecise955
-rw-r--r--test/emcc_hello_world.fromasm.imprecise.no-opts1314
-rw-r--r--test/emcc_hello_world.fromasm.no-opts1314
5 files changed, 158 insertions, 4419 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index 53fa78db4..6c3fcd8cf 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -881,19 +881,17 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
#endif
-#if 0 // enable asm2wasm i64 optimizations when browsers have consistent i64 support in wasm
if (udivmoddi4.is() && getTempRet0.is()) {
// generate a wasm-optimized __udivmoddi4 method, which we can do much more efficiently in wasm
// we can only do this if we know getTempRet0 as well since we use it to figure out which minified global is tempRet0
// (getTempRet0 might be an import, if this is a shared module, so we can't optimize that case)
- int tempRet0;
+ Name tempRet0;
{
Expression* curr = wasm.getFunction(getTempRet0)->body;
if (curr->is<Block>()) curr = curr->cast<Block>()->list[0];
- curr = curr->cast<Return>()->value;
- auto* load = curr->cast<Load>();
- auto* ptr = load->ptr->cast<Const>();
- tempRet0 = ptr->value.geti32() + load->offset;
+ if (curr->is<Return>()) curr = curr->cast<Return>()->value;
+ auto* get = curr->cast<GetGlobal>();
+ tempRet0 = get->name;
}
// udivmoddi4 receives xl, xh, yl, yl, r, and
// if r then *r = x % y
@@ -913,13 +911,13 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
return builder.makeSetLocal(
target,
builder.makeBinary(
- Or,
+ OrInt64,
builder.makeUnary(
ExtendUInt32,
builder.makeGetLocal(low, i32)
),
builder.makeBinary(
- Shl,
+ ShlInt64,
builder.makeUnary(
ExtendUInt32,
builder.makeGetLocal(high, i32)
@@ -938,10 +936,11 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
8, 0, 8,
builder.makeGetLocal(r, i32),
builder.makeBinary(
- RemU,
+ RemUInt64,
builder.makeGetLocal(x64, i64),
builder.makeGetLocal(y64, i64)
- )
+ ),
+ i64
)
)
);
@@ -949,20 +948,19 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
builder.makeSetLocal(
x64,
builder.makeBinary(
- DivU,
+ DivUInt64,
builder.makeGetLocal(x64, i64),
builder.makeGetLocal(y64, i64)
)
)
);
body->list.push_back(
- builder.makeStore(
- 4, 0, 4,
- builder.makeConst(Literal(int32_t(tempRet0))),
+ builder.makeSetGlobal(
+ tempRet0,
builder.makeUnary(
WrapInt64,
builder.makeBinary(
- ShrU,
+ ShrUInt64,
builder.makeGetLocal(x64, i64),
builder.makeConst(Literal(int64_t(32)))
)
@@ -975,9 +973,9 @@ void Asm2WasmBuilder::processAsm(Ref ast) {
builder.makeGetLocal(x64, i64)
)
);
+ body->finalize();
func->body = body;
}
-#endif
assert(WasmValidator().validate(wasm));
}
diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm
index 0a40314a8..ecf5b9b94 100644
--- a/test/emcc_hello_world.fromasm
+++ b/test/emcc_hello_world.fromasm
@@ -17599,953 +17599,61 @@
(get_local $0)
)
)
- (func $___udivmoddi4 (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32)
- (local $5 i32)
- (local $6 i32)
- (local $7 i32)
- (local $8 i32)
- (local $9 i32)
- (local $10 i32)
- (local $11 i32)
- (local $12 i32)
- (local $13 i32)
- (local $14 i32)
- (set_local $8
- (get_local $0)
- )
- (set_local $5
- (get_local $2)
- )
- (set_local $7
- (tee_local $14
- (get_local $3)
- )
- )
- (if
- (i32.eqz
- (tee_local $6
- (tee_local $9
- (get_local $1)
- )
- )
- )
- (block
- (set_local $2
- (i32.ne
- (get_local $4)
- (i32.const 0)
- )
- )
- (if
- (get_local $7)
- (block
- (if
- (i32.eqz
- (get_local $2)
- )
- (block
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.const 0)
- )
- )
- )
- (i32.store
- (get_local $4)
- (i32.and
- (get_local $0)
- (i32.const -1)
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.and
- (get_local $1)
- (i32.const 0)
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.const 0)
- )
- )
- (block
- (if
- (get_local $2)
- (block
- (i32.store
- (get_local $4)
- (call_import $i32u-rem
- (get_local $8)
- (get_local $5)
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.const 0)
- )
- )
- )
- (set_local $0
- (call_import $i32u-div
- (get_local $8)
- (get_local $5)
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (get_local $0)
- )
- )
- )
- )
- )
- (set_local $10
- (i32.eqz
- (get_local $7)
- )
- )
- (block $do-once$0
- (if
- (get_local $5)
- (block
- (if
- (i32.eqz
- (get_local $10)
- )
- (block
- (if
- (i32.le_u
- (tee_local $5
- (i32.sub
- (i32.clz
- (get_local $7)
- )
- (i32.clz
- (get_local $6)
- )
- )
- )
- (i32.const 31)
- )
- (block
- (set_local $12
- (tee_local $0
- (i32.add
- (get_local $5)
- (i32.const 1)
- )
- )
- )
- (set_local $11
- (i32.or
- (i32.and
- (i32.shr_u
- (get_local $8)
- (get_local $0)
- )
- (tee_local $9
- (i32.shr_s
- (i32.sub
- (get_local $5)
- (i32.const 31)
- )
- (i32.const 31)
- )
- )
- )
- (i32.shl
- (get_local $6)
- (tee_local $1
- (i32.sub
- (i32.const 31)
- (get_local $5)
- )
- )
- )
- )
- )
- (set_local $13
- (i32.and
- (i32.shr_u
- (get_local $6)
- (get_local $0)
- )
- (get_local $9)
- )
- )
- (set_local $10
- (i32.const 0)
- )
- (set_local $0
- (i32.shl
- (get_local $8)
- (get_local $1)
- )
- )
- (br $do-once$0)
- )
- )
- (if
- (i32.eqz
- (get_local $4)
- )
- (block
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.const 0)
- )
- )
- )
- (i32.store
- (get_local $4)
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $0)
- (i32.const -1)
- )
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.or
- (get_local $9)
- (i32.and
- (get_local $1)
- (i32.const 0)
- )
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.const 0)
- )
- )
- )
- (if
- (i32.ne
- (i32.and
- (tee_local $7
- (i32.sub
- (get_local $5)
- (i32.const 1)
- )
- )
- (get_local $5)
- )
- (i32.const 0)
- )
- (block
- (set_local $1
- (i32.sub
- (i32.const 64)
- (tee_local $0
- (i32.sub
- (i32.add
- (i32.clz
- (get_local $5)
- )
- (i32.const 33)
- )
- (i32.clz
- (get_local $6)
- )
- )
- )
- )
- )
- (set_local $5
- (i32.shr_s
- (tee_local $9
- (i32.sub
- (i32.const 32)
- (get_local $0)
- )
- )
- (i32.const 31)
- )
- )
- (set_local $10
- (i32.shr_s
- (tee_local $7
- (i32.sub
- (get_local $0)
- (i32.const 32)
- )
- )
- (i32.const 31)
- )
- )
- (set_local $12
- (get_local $0)
- )
- (set_local $11
- (i32.or
- (i32.and
- (i32.shr_s
- (i32.sub
- (get_local $9)
- (i32.const 1)
- )
- (i32.const 31)
- )
- (i32.shr_u
- (get_local $6)
- (get_local $7)
- )
- )
- (i32.and
- (i32.or
- (i32.shl
- (get_local $6)
- (get_local $9)
- )
- (i32.shr_u
- (get_local $8)
- (get_local $0)
- )
- )
- (get_local $10)
- )
- )
- )
- (set_local $13
- (i32.and
- (get_local $10)
- (i32.shr_u
- (get_local $6)
- (get_local $0)
- )
- )
- )
- (set_local $10
- (i32.and
- (i32.shl
- (get_local $8)
- (get_local $1)
- )
- (get_local $5)
- )
- )
- (set_local $0
- (i32.or
- (i32.and
- (i32.or
- (i32.shl
- (get_local $6)
- (get_local $1)
- )
- (i32.shr_u
- (get_local $8)
- (get_local $7)
- )
- )
- (get_local $5)
- )
- (i32.and
- (i32.shl
- (get_local $8)
- (get_local $9)
- )
- (i32.shr_s
- (i32.sub
- (get_local $0)
- (i32.const 33)
- )
- (i32.const 31)
- )
- )
- )
- )
- (br $do-once$0)
- )
- )
- (if
- (i32.ne
- (get_local $4)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $4)
- (i32.and
- (get_local $7)
- (get_local $8)
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.const 0)
- )
- )
- )
- (if
- (i32.eq
- (get_local $5)
- (i32.const 1)
- )
- (block
- (set_global $tempRet0
- (i32.or
- (get_local $9)
- (i32.and
- (get_local $1)
- (i32.const 0)
- )
- )
- )
- (return
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $0)
- (i32.const -1)
- )
- )
- )
- )
- (block
- (set_global $tempRet0
- (i32.or
- (i32.const 0)
- (i32.shr_u
- (get_local $6)
- (tee_local $0
- (i32.ctz
- (get_local $5)
- )
- )
- )
- )
- )
- (return
- (i32.or
- (i32.shl
- (get_local $6)
- (i32.sub
- (i32.const 32)
- (get_local $0)
- )
- )
- (i32.shr_u
- (get_local $8)
- (get_local $0)
- )
- )
- )
- )
- )
+ (func $___udivmoddi4 (param $xl i32) (param $xh i32) (param $yl i32) (param $yh i32) (param $r i32) (result i32)
+ (local $x64 i64)
+ (local $y64 i64)
+ (set_local $x64
+ (i64.or
+ (i64.extend_u/i32
+ (get_local $xl)
)
- (block
- (if
- (get_local $10)
- (block
- (if
- (i32.ne
- (get_local $4)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $4)
- (call_import $i32u-rem
- (get_local $6)
- (get_local $5)
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.const 0)
- )
- )
- )
- (set_local $0
- (call_import $i32u-div
- (get_local $6)
- (get_local $5)
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (get_local $0)
- )
- )
- )
- (if
- (i32.eqz
- (get_local $8)
- )
- (block
- (if
- (i32.ne
- (get_local $4)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $4)
- (i32.const 0)
- )
- (i32.store offset=4
- (get_local $4)
- (call_import $i32u-rem
- (get_local $6)
- (get_local $7)
- )
- )
- )
- )
- (set_local $0
- (call_import $i32u-div
- (get_local $6)
- (get_local $7)
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (get_local $0)
- )
- )
- )
- (if
- (i32.eqz
- (i32.and
- (tee_local $5
- (i32.sub
- (get_local $7)
- (i32.const 1)
- )
- )
- (get_local $7)
- )
- )
- (block
- (if
- (i32.ne
- (get_local $4)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $4)
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $0)
- (i32.const -1)
- )
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.or
- (i32.and
- (get_local $5)
- (get_local $6)
- )
- (i32.and
- (get_local $1)
- (i32.const 0)
- )
- )
- )
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.shr_u
- (get_local $6)
- (i32.ctz
- (get_local $7)
- )
- )
- )
- )
- )
- (if
- (i32.le_u
- (tee_local $5
- (i32.sub
- (i32.clz
- (get_local $7)
- )
- (i32.clz
- (get_local $6)
- )
- )
- )
- (i32.const 30)
- )
- (block
- (set_local $12
- (tee_local $0
- (i32.add
- (get_local $5)
- (i32.const 1)
- )
- )
- )
- (set_local $11
- (i32.or
- (i32.shl
- (get_local $6)
- (tee_local $1
- (i32.sub
- (i32.const 31)
- (get_local $5)
- )
- )
- )
- (i32.shr_u
- (get_local $8)
- (get_local $0)
- )
- )
- )
- (set_local $13
- (i32.shr_u
- (get_local $6)
- (get_local $0)
- )
- )
- (set_local $10
- (i32.const 0)
- )
- (set_local $0
- (i32.shl
- (get_local $8)
- (get_local $1)
- )
- )
- (br $do-once$0)
- )
- )
- (if
- (i32.eqz
- (get_local $4)
- )
- (block
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.const 0)
- )
- )
- )
- (i32.store
- (get_local $4)
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $0)
- (i32.const -1)
- )
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.or
- (get_local $9)
- (i32.and
- (get_local $1)
- (i32.const 0)
- )
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.const 0)
+ (i64.shl
+ (i64.extend_u/i32
+ (get_local $xh)
)
+ (i64.const 32)
)
)
)
- (set_local $0
- (if
- (get_local $12)
- (block
- (set_local $3
- (call $_i64Add
- (tee_local $1
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $2)
- (i32.const -1)
- )
- )
- )
- (tee_local $2
- (i32.or
- (get_local $14)
- (i32.and
- (get_local $3)
- (i32.const 0)
- )
- )
- )
- (i32.const -1)
- (i32.const -1)
- )
- )
- (set_local $8
- (get_global $tempRet0)
- )
- (set_local $9
- (get_local $0)
- )
- (set_local $0
- (i32.const 0)
- )
- (loop $while-in$3
- (block $while-out$2
- (set_local $6
- (i32.or
- (i32.shr_u
- (get_local $10)
- (i32.const 31)
- )
- (i32.shl
- (get_local $9)
- (i32.const 1)
- )
- )
- )
- (set_local $10
- (i32.or
- (get_local $0)
- (i32.shl
- (get_local $10)
- (i32.const 1)
- )
- )
- )
- (drop
- (call $_i64Subtract
- (get_local $3)
- (get_local $8)
- (tee_local $0
- (i32.or
- (i32.const 0)
- (i32.or
- (i32.shl
- (get_local $11)
- (i32.const 1)
- )
- (i32.shr_u
- (get_local $9)
- (i32.const 31)
- )
- )
- )
- )
- (tee_local $9
- (i32.or
- (i32.shr_u
- (get_local $11)
- (i32.const 31)
- )
- (i32.shl
- (get_local $13)
- (i32.const 1)
- )
- )
- )
- )
- )
- (set_local $7
- (i32.and
- (tee_local $14
- (i32.or
- (i32.shr_s
- (tee_local $5
- (get_global $tempRet0)
- )
- (i32.const 31)
- )
- (i32.shl
- (select
- (i32.const -1)
- (i32.const 0)
- (i32.lt_s
- (get_local $5)
- (i32.const 0)
- )
- )
- (i32.const 1)
- )
- )
- )
- (i32.const 1)
- )
- )
- (set_local $11
- (call $_i64Subtract
- (get_local $0)
- (get_local $9)
- (i32.and
- (get_local $14)
- (get_local $1)
- )
- (i32.and
- (i32.or
- (i32.shr_s
- (select
- (i32.const -1)
- (i32.const 0)
- (i32.lt_s
- (get_local $5)
- (i32.const 0)
- )
- )
- (i32.const 31)
- )
- (i32.shl
- (select
- (i32.const -1)
- (i32.const 0)
- (i32.lt_s
- (get_local $5)
- (i32.const 0)
- )
- )
- (i32.const 1)
- )
- )
- (get_local $2)
- )
- )
- )
- (set_local $13
- (get_global $tempRet0)
- )
- (if
- (tee_local $12
- (i32.sub
- (get_local $12)
- (i32.const 1)
- )
- )
- (block
- (set_local $9
- (get_local $6)
- )
- (set_local $0
- (get_local $7)
- )
- )
- (br $while-out$2)
- )
- (br $while-in$3)
- )
- )
- (set_local $1
- (i32.const 0)
- )
- (get_local $7)
+ (set_local $y64
+ (i64.or
+ (i64.extend_u/i32
+ (get_local $yl)
)
- (block
- (set_local $6
- (get_local $0)
- )
- (set_local $1
- (i32.const 0)
+ (i64.shl
+ (i64.extend_u/i32
+ (get_local $yh)
)
- (i32.const 0)
+ (i64.const 32)
)
)
)
- (set_local $3
- (i32.or
- (get_local $6)
- (tee_local $2
- (i32.const 0)
+ (if
+ (get_local $r)
+ (i64.store
+ (get_local $r)
+ (i64.rem_u
+ (get_local $x64)
+ (get_local $y64)
)
)
)
- (if
- (i32.ne
- (get_local $4)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $4)
- (i32.or
- (i32.const 0)
- (get_local $11)
- )
- )
- (i32.store offset=4
- (get_local $4)
- (get_local $13)
- )
+ (set_local $x64
+ (i64.div_u
+ (get_local $x64)
+ (get_local $y64)
)
)
(set_global $tempRet0
- (i32.or
- (i32.or
- (i32.or
- (i32.shr_u
- (i32.or
- (i32.const 0)
- (get_local $10)
- )
- (i32.const 31)
- )
- (i32.shl
- (get_local $3)
- (i32.const 1)
- )
- )
- (i32.and
- (i32.or
- (i32.shl
- (get_local $2)
- (i32.const 1)
- )
- (i32.shr_u
- (get_local $10)
- (i32.const 31)
- )
- )
- (i32.const 0)
- )
+ (i32.wrap/i64
+ (i64.shr_u
+ (get_local $x64)
+ (i64.const 32)
)
- (get_local $1)
)
)
- (i32.or
- (i32.and
- (i32.or
- (i32.shl
- (get_local $10)
- (i32.const 1)
- )
- (i32.const 0)
- )
- (i32.const -2)
- )
- (get_local $0)
+ (i32.wrap/i64
+ (get_local $x64)
)
)
(func $dynCall_ii (param $0 i32) (param $1 i32) (result i32)
diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise
index c13902e50..815fee11e 100644
--- a/test/emcc_hello_world.fromasm.imprecise
+++ b/test/emcc_hello_world.fromasm.imprecise
@@ -17592,944 +17592,61 @@
(get_local $0)
)
)
- (func $___udivmoddi4 (param $0 i32) (param $1 i32) (param $2 i32) (param $3 i32) (param $4 i32) (result i32)
- (local $5 i32)
- (local $6 i32)
- (local $7 i32)
- (local $8 i32)
- (local $9 i32)
- (local $10 i32)
- (local $11 i32)
- (local $12 i32)
- (local $13 i32)
- (local $14 i32)
- (set_local $8
- (get_local $0)
- )
- (set_local $5
- (get_local $2)
- )
- (set_local $7
- (tee_local $14
- (get_local $3)
- )
- )
- (if
- (i32.eqz
- (tee_local $6
- (tee_local $9
- (get_local $1)
- )
- )
- )
- (block
- (set_local $2
- (i32.ne
- (get_local $4)
- (i32.const 0)
- )
+ (func $___udivmoddi4 (param $xl i32) (param $xh i32) (param $yl i32) (param $yh i32) (param $r i32) (result i32)
+ (local $x64 i64)
+ (local $y64 i64)
+ (set_local $x64
+ (i64.or
+ (i64.extend_u/i32
+ (get_local $xl)
)
- (if
- (get_local $7)
- (block
- (if
- (i32.eqz
- (get_local $2)
- )
- (block
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.const 0)
- )
- )
- )
- (i32.store
- (get_local $4)
- (i32.and
- (get_local $0)
- (i32.const -1)
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.and
- (get_local $1)
- (i32.const 0)
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.const 0)
- )
- )
- (block
- (if
- (get_local $2)
- (block
- (i32.store
- (get_local $4)
- (i32.rem_u
- (get_local $8)
- (get_local $5)
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.const 0)
- )
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.div_u
- (get_local $8)
- (get_local $5)
- )
- )
+ (i64.shl
+ (i64.extend_u/i32
+ (get_local $xh)
)
+ (i64.const 32)
)
)
)
- (set_local $10
- (i32.eqz
- (get_local $7)
- )
- )
- (block $do-once$0
- (if
- (get_local $5)
- (block
- (if
- (i32.eqz
- (get_local $10)
- )
- (block
- (if
- (i32.le_u
- (tee_local $5
- (i32.sub
- (i32.clz
- (get_local $7)
- )
- (i32.clz
- (get_local $6)
- )
- )
- )
- (i32.const 31)
- )
- (block
- (set_local $12
- (tee_local $0
- (i32.add
- (get_local $5)
- (i32.const 1)
- )
- )
- )
- (set_local $11
- (i32.or
- (i32.and
- (i32.shr_u
- (get_local $8)
- (get_local $0)
- )
- (tee_local $9
- (i32.shr_s
- (i32.sub
- (get_local $5)
- (i32.const 31)
- )
- (i32.const 31)
- )
- )
- )
- (i32.shl
- (get_local $6)
- (tee_local $1
- (i32.sub
- (i32.const 31)
- (get_local $5)
- )
- )
- )
- )
- )
- (set_local $13
- (i32.and
- (i32.shr_u
- (get_local $6)
- (get_local $0)
- )
- (get_local $9)
- )
- )
- (set_local $10
- (i32.const 0)
- )
- (set_local $0
- (i32.shl
- (get_local $8)
- (get_local $1)
- )
- )
- (br $do-once$0)
- )
- )
- (if
- (i32.eqz
- (get_local $4)
- )
- (block
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.const 0)
- )
- )
- )
- (i32.store
- (get_local $4)
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $0)
- (i32.const -1)
- )
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.or
- (get_local $9)
- (i32.and
- (get_local $1)
- (i32.const 0)
- )
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.const 0)
- )
- )
- )
- (if
- (i32.ne
- (i32.and
- (tee_local $7
- (i32.sub
- (get_local $5)
- (i32.const 1)
- )
- )
- (get_local $5)
- )
- (i32.const 0)
- )
- (block
- (set_local $1
- (i32.sub
- (i32.const 64)
- (tee_local $0
- (i32.sub
- (i32.add
- (i32.clz
- (get_local $5)
- )
- (i32.const 33)
- )
- (i32.clz
- (get_local $6)
- )
- )
- )
- )
- )
- (set_local $5
- (i32.shr_s
- (tee_local $9
- (i32.sub
- (i32.const 32)
- (get_local $0)
- )
- )
- (i32.const 31)
- )
- )
- (set_local $10
- (i32.shr_s
- (tee_local $7
- (i32.sub
- (get_local $0)
- (i32.const 32)
- )
- )
- (i32.const 31)
- )
- )
- (set_local $12
- (get_local $0)
- )
- (set_local $11
- (i32.or
- (i32.and
- (i32.shr_s
- (i32.sub
- (get_local $9)
- (i32.const 1)
- )
- (i32.const 31)
- )
- (i32.shr_u
- (get_local $6)
- (get_local $7)
- )
- )
- (i32.and
- (i32.or
- (i32.shl
- (get_local $6)
- (get_local $9)
- )
- (i32.shr_u
- (get_local $8)
- (get_local $0)
- )
- )
- (get_local $10)
- )
- )
- )
- (set_local $13
- (i32.and
- (get_local $10)
- (i32.shr_u
- (get_local $6)
- (get_local $0)
- )
- )
- )
- (set_local $10
- (i32.and
- (i32.shl
- (get_local $8)
- (get_local $1)
- )
- (get_local $5)
- )
- )
- (set_local $0
- (i32.or
- (i32.and
- (i32.or
- (i32.shl
- (get_local $6)
- (get_local $1)
- )
- (i32.shr_u
- (get_local $8)
- (get_local $7)
- )
- )
- (get_local $5)
- )
- (i32.and
- (i32.shl
- (get_local $8)
- (get_local $9)
- )
- (i32.shr_s
- (i32.sub
- (get_local $0)
- (i32.const 33)
- )
- (i32.const 31)
- )
- )
- )
- )
- (br $do-once$0)
- )
- )
- (if
- (i32.ne
- (get_local $4)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $4)
- (i32.and
- (get_local $7)
- (get_local $8)
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.const 0)
- )
- )
- )
- (if
- (i32.eq
- (get_local $5)
- (i32.const 1)
- )
- (block
- (set_global $tempRet0
- (i32.or
- (get_local $9)
- (i32.and
- (get_local $1)
- (i32.const 0)
- )
- )
- )
- (return
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $0)
- (i32.const -1)
- )
- )
- )
- )
- (block
- (set_global $tempRet0
- (i32.or
- (i32.const 0)
- (i32.shr_u
- (get_local $6)
- (tee_local $0
- (i32.ctz
- (get_local $5)
- )
- )
- )
- )
- )
- (return
- (i32.or
- (i32.shl
- (get_local $6)
- (i32.sub
- (i32.const 32)
- (get_local $0)
- )
- )
- (i32.shr_u
- (get_local $8)
- (get_local $0)
- )
- )
- )
- )
- )
+ (set_local $y64
+ (i64.or
+ (i64.extend_u/i32
+ (get_local $yl)
)
- (block
- (if
- (get_local $10)
- (block
- (if
- (i32.ne
- (get_local $4)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $4)
- (i32.rem_u
- (get_local $6)
- (get_local $5)
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.const 0)
- )
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.div_u
- (get_local $6)
- (get_local $5)
- )
- )
- )
- )
- (if
- (i32.eqz
- (get_local $8)
- )
- (block
- (if
- (i32.ne
- (get_local $4)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $4)
- (i32.const 0)
- )
- (i32.store offset=4
- (get_local $4)
- (i32.rem_u
- (get_local $6)
- (get_local $7)
- )
- )
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.div_u
- (get_local $6)
- (get_local $7)
- )
- )
- )
- )
- (if
- (i32.eqz
- (i32.and
- (tee_local $5
- (i32.sub
- (get_local $7)
- (i32.const 1)
- )
- )
- (get_local $7)
- )
- )
- (block
- (if
- (i32.ne
- (get_local $4)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $4)
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $0)
- (i32.const -1)
- )
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.or
- (i32.and
- (get_local $5)
- (get_local $6)
- )
- (i32.and
- (get_local $1)
- (i32.const 0)
- )
- )
- )
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.shr_u
- (get_local $6)
- (i32.ctz
- (get_local $7)
- )
- )
- )
- )
- )
- (if
- (i32.le_u
- (tee_local $5
- (i32.sub
- (i32.clz
- (get_local $7)
- )
- (i32.clz
- (get_local $6)
- )
- )
- )
- (i32.const 30)
- )
- (block
- (set_local $12
- (tee_local $0
- (i32.add
- (get_local $5)
- (i32.const 1)
- )
- )
- )
- (set_local $11
- (i32.or
- (i32.shl
- (get_local $6)
- (tee_local $1
- (i32.sub
- (i32.const 31)
- (get_local $5)
- )
- )
- )
- (i32.shr_u
- (get_local $8)
- (get_local $0)
- )
- )
- )
- (set_local $13
- (i32.shr_u
- (get_local $6)
- (get_local $0)
- )
- )
- (set_local $10
- (i32.const 0)
- )
- (set_local $0
- (i32.shl
- (get_local $8)
- (get_local $1)
- )
- )
- (br $do-once$0)
- )
- )
- (if
- (i32.eqz
- (get_local $4)
- )
- (block
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.const 0)
- )
- )
- )
- (i32.store
- (get_local $4)
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $0)
- (i32.const -1)
- )
- )
- )
- (i32.store offset=4
- (get_local $4)
- (i32.or
- (get_local $9)
- (i32.and
- (get_local $1)
- (i32.const 0)
- )
- )
- )
- (set_global $tempRet0
- (i32.const 0)
- )
- (return
- (i32.const 0)
+ (i64.shl
+ (i64.extend_u/i32
+ (get_local $yh)
)
+ (i64.const 32)
)
)
)
- (set_local $0
- (if
- (get_local $12)
- (block
- (set_local $3
- (call $_i64Add
- (tee_local $1
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $2)
- (i32.const -1)
- )
- )
- )
- (tee_local $2
- (i32.or
- (get_local $14)
- (i32.and
- (get_local $3)
- (i32.const 0)
- )
- )
- )
- (i32.const -1)
- (i32.const -1)
- )
- )
- (set_local $8
- (get_global $tempRet0)
- )
- (set_local $9
- (get_local $0)
- )
- (set_local $0
- (i32.const 0)
- )
- (loop $while-in$3
- (block $while-out$2
- (set_local $6
- (i32.or
- (i32.shr_u
- (get_local $10)
- (i32.const 31)
- )
- (i32.shl
- (get_local $9)
- (i32.const 1)
- )
- )
- )
- (set_local $10
- (i32.or
- (get_local $0)
- (i32.shl
- (get_local $10)
- (i32.const 1)
- )
- )
- )
- (drop
- (call $_i64Subtract
- (get_local $3)
- (get_local $8)
- (tee_local $0
- (i32.or
- (i32.const 0)
- (i32.or
- (i32.shl
- (get_local $11)
- (i32.const 1)
- )
- (i32.shr_u
- (get_local $9)
- (i32.const 31)
- )
- )
- )
- )
- (tee_local $9
- (i32.or
- (i32.shr_u
- (get_local $11)
- (i32.const 31)
- )
- (i32.shl
- (get_local $13)
- (i32.const 1)
- )
- )
- )
- )
- )
- (set_local $7
- (i32.and
- (tee_local $14
- (i32.or
- (i32.shr_s
- (tee_local $5
- (get_global $tempRet0)
- )
- (i32.const 31)
- )
- (i32.shl
- (select
- (i32.const -1)
- (i32.const 0)
- (i32.lt_s
- (get_local $5)
- (i32.const 0)
- )
- )
- (i32.const 1)
- )
- )
- )
- (i32.const 1)
- )
- )
- (set_local $11
- (call $_i64Subtract
- (get_local $0)
- (get_local $9)
- (i32.and
- (get_local $14)
- (get_local $1)
- )
- (i32.and
- (i32.or
- (i32.shr_s
- (select
- (i32.const -1)
- (i32.const 0)
- (i32.lt_s
- (get_local $5)
- (i32.const 0)
- )
- )
- (i32.const 31)
- )
- (i32.shl
- (select
- (i32.const -1)
- (i32.const 0)
- (i32.lt_s
- (get_local $5)
- (i32.const 0)
- )
- )
- (i32.const 1)
- )
- )
- (get_local $2)
- )
- )
- )
- (set_local $13
- (get_global $tempRet0)
- )
- (if
- (tee_local $12
- (i32.sub
- (get_local $12)
- (i32.const 1)
- )
- )
- (block
- (set_local $9
- (get_local $6)
- )
- (set_local $0
- (get_local $7)
- )
- )
- (br $while-out$2)
- )
- (br $while-in$3)
- )
- )
- (set_local $1
- (i32.const 0)
- )
- (get_local $7)
- )
- (block
- (set_local $6
- (get_local $0)
- )
- (set_local $1
- (i32.const 0)
- )
- (i32.const 0)
+ (if
+ (get_local $r)
+ (i64.store
+ (get_local $r)
+ (i64.rem_u
+ (get_local $x64)
+ (get_local $y64)
)
)
)
- (set_local $3
- (i32.or
- (get_local $6)
- (tee_local $2
- (i32.const 0)
- )
- )
- )
- (if
- (i32.ne
- (get_local $4)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $4)
- (i32.or
- (i32.const 0)
- (get_local $11)
- )
- )
- (i32.store offset=4
- (get_local $4)
- (get_local $13)
- )
+ (set_local $x64
+ (i64.div_u
+ (get_local $x64)
+ (get_local $y64)
)
)
(set_global $tempRet0
- (i32.or
- (i32.or
- (i32.or
- (i32.shr_u
- (i32.or
- (i32.const 0)
- (get_local $10)
- )
- (i32.const 31)
- )
- (i32.shl
- (get_local $3)
- (i32.const 1)
- )
- )
- (i32.and
- (i32.or
- (i32.shl
- (get_local $2)
- (i32.const 1)
- )
- (i32.shr_u
- (get_local $10)
- (i32.const 31)
- )
- )
- (i32.const 0)
- )
+ (i32.wrap/i64
+ (i64.shr_u
+ (get_local $x64)
+ (i64.const 32)
)
- (get_local $1)
)
)
- (i32.or
- (i32.and
- (i32.or
- (i32.shl
- (get_local $10)
- (i32.const 1)
- )
- (i32.const 0)
- )
- (i32.const -2)
- )
- (get_local $0)
+ (i32.wrap/i64
+ (get_local $x64)
)
)
(func $dynCall_ii (param $0 i32) (param $1 i32) (result i32)
diff --git a/test/emcc_hello_world.fromasm.imprecise.no-opts b/test/emcc_hello_world.fromasm.imprecise.no-opts
index 486697a52..d7bbe58e8 100644
--- a/test/emcc_hello_world.fromasm.imprecise.no-opts
+++ b/test/emcc_hello_world.fromasm.imprecise.no-opts
@@ -31448,1303 +31448,61 @@
)
)
)
- (func $___udivmoddi4 (param $$a$0 i32) (param $$a$1 i32) (param $$b$0 i32) (param $$b$1 i32) (param $$rem i32) (result i32)
- (local $$n_sroa_0_0_extract_trunc i32)
- (local $$n_sroa_1_4_extract_shift$0 i32)
- (local $$n_sroa_1_4_extract_trunc i32)
- (local $$d_sroa_0_0_extract_trunc i32)
- (local $$d_sroa_1_4_extract_shift$0 i32)
- (local $$d_sroa_1_4_extract_trunc i32)
- (local $$4 i32)
- (local $$17 i32)
- (local $$37 i32)
- (local $$49 i32)
- (local $$51 i32)
- (local $$57 i32)
- (local $$58 i32)
- (local $$66 i32)
- (local $$78 i32)
- (local $$86 i32)
- (local $$88 i32)
- (local $$89 i32)
- (local $$91 i32)
- (local $$92 i32)
- (local $$95 i32)
- (local $$105 i32)
- (local $$117 i32)
- (local $$119 i32)
- (local $$125 i32)
- (local $$126 i32)
- (local $$130 i32)
- (local $$q_sroa_1_1_ph i32)
- (local $$q_sroa_0_1_ph i32)
- (local $$r_sroa_1_1_ph i32)
- (local $$r_sroa_0_1_ph i32)
- (local $$sr_1_ph i32)
- (local $$d_sroa_0_0_insert_insert99$0 i32)
- (local $$d_sroa_0_0_insert_insert99$1 i32)
- (local $$137$0 i32)
- (local $$137$1 i32)
- (local $$carry_0203 i32)
- (local $$sr_1202 i32)
- (local $$r_sroa_0_1201 i32)
- (local $$r_sroa_1_1200 i32)
- (local $$q_sroa_0_1199 i32)
- (local $$q_sroa_1_1198 i32)
- (local $$147 i32)
- (local $$149 i32)
- (local $$r_sroa_0_0_insert_insert42$0 i32)
- (local $$r_sroa_0_0_insert_insert42$1 i32)
- (local $$150$1 i32)
- (local $$151$0 i32)
- (local $$152 i32)
- (local $$154$0 i32)
- (local $$r_sroa_0_0_extract_trunc i32)
- (local $$r_sroa_1_4_extract_trunc i32)
- (local $$155 i32)
- (local $$carry_0_lcssa$0 i32)
- (local $$carry_0_lcssa$1 i32)
- (local $$r_sroa_0_1_lcssa i32)
- (local $$r_sroa_1_1_lcssa i32)
- (local $$q_sroa_0_1_lcssa i32)
- (local $$q_sroa_1_1_lcssa i32)
- (local $$q_sroa_0_0_insert_ext75$0 i32)
- (local $$q_sroa_0_0_insert_ext75$1 i32)
- (local $$q_sroa_0_0_insert_insert77$1 i32)
- (local $$_0$0 i32)
- (local $$_0$1 i32)
- (set_local $$n_sroa_0_0_extract_trunc
- (get_local $$a$0)
- )
- (set_local $$n_sroa_1_4_extract_shift$0
- (get_local $$a$1)
- )
- (set_local $$n_sroa_1_4_extract_trunc
- (get_local $$n_sroa_1_4_extract_shift$0)
- )
- (set_local $$d_sroa_0_0_extract_trunc
- (get_local $$b$0)
- )
- (set_local $$d_sroa_1_4_extract_shift$0
- (get_local $$b$1)
- )
- (set_local $$d_sroa_1_4_extract_trunc
- (get_local $$d_sroa_1_4_extract_shift$0)
- )
- (if
- (i32.eq
- (get_local $$n_sroa_1_4_extract_trunc)
- (i32.const 0)
- )
- (block
- (set_local $$4
- (i32.ne
- (get_local $$rem)
- (i32.const 0)
- )
+ (func $___udivmoddi4 (param $xl i32) (param $xh i32) (param $yl i32) (param $yh i32) (param $r i32) (result i32)
+ (local $x64 i64)
+ (local $y64 i64)
+ (set_local $x64
+ (i64.or
+ (i64.extend_u/i32
+ (get_local $xl)
)
- (if
- (i32.eq
- (get_local $$d_sroa_1_4_extract_trunc)
- (i32.const 0)
- )
- (block
- (if
- (get_local $$4)
- (block
- (i32.store
- (get_local $$rem)
- (i32.rem_u
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.const 0)
- )
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.div_u
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- (block
- (if
- (i32.eqz
- (get_local $$4)
- )
- (block
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.const 0)
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (i32.store
- (get_local $$rem)
- (i32.and
- (get_local $$a$0)
- (i32.const -1)
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.and
- (get_local $$a$1)
- (i32.const 0)
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.const 0)
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
+ (i64.shl
+ (i64.extend_u/i32
+ (get_local $xh)
)
+ (i64.const 32)
)
)
)
- (set_local $$17
- (i32.eq
- (get_local $$d_sroa_1_4_extract_trunc)
- (i32.const 0)
- )
- )
- (block $do-once$0
- (if
- (i32.eq
- (get_local $$d_sroa_0_0_extract_trunc)
- (i32.const 0)
+ (set_local $y64
+ (i64.or
+ (i64.extend_u/i32
+ (get_local $yl)
)
- (block
- (if
- (get_local $$17)
- (block
- (if
- (i32.ne
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $$rem)
- (i32.rem_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.const 0)
- )
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.div_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (if
- (i32.eq
- (get_local $$n_sroa_0_0_extract_trunc)
- (i32.const 0)
- )
- (block
- (if
- (i32.ne
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $$rem)
- (i32.const 0)
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.rem_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$d_sroa_1_4_extract_trunc)
- )
- )
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.div_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$d_sroa_1_4_extract_trunc)
- )
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (set_local $$37
- (i32.sub
- (get_local $$d_sroa_1_4_extract_trunc)
- (i32.const 1)
- )
- )
- (if
- (i32.eq
- (i32.and
- (get_local $$37)
- (get_local $$d_sroa_1_4_extract_trunc)
- )
- (i32.const 0)
- )
- (block
- (if
- (i32.ne
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $$rem)
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $$a$0)
- (i32.const -1)
- )
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.or
- (i32.and
- (get_local $$37)
- (get_local $$n_sroa_1_4_extract_trunc)
- )
- (i32.and
- (get_local $$a$1)
- (i32.const 0)
- )
- )
- )
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.shr_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (i32.ctz
- (get_local $$d_sroa_1_4_extract_trunc)
- )
- )
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (set_local $$49
- (i32.clz
- (get_local $$d_sroa_1_4_extract_trunc)
- )
- )
- (set_local $$51
- (i32.sub
- (get_local $$49)
- (i32.clz
- (get_local $$n_sroa_1_4_extract_trunc)
- )
- )
- )
- (if
- (i32.le_u
- (get_local $$51)
- (i32.const 30)
- )
- (block
- (set_local $$57
- (i32.add
- (get_local $$51)
- (i32.const 1)
- )
- )
- (set_local $$58
- (i32.sub
- (i32.const 31)
- (get_local $$51)
- )
- )
- (set_local $$sr_1_ph
- (get_local $$57)
- )
- (set_local $$r_sroa_0_1_ph
- (i32.or
- (i32.shl
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$58)
- )
- (i32.shr_u
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$57)
- )
- )
- )
- (set_local $$r_sroa_1_1_ph
- (i32.shr_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$57)
- )
- )
- (set_local $$q_sroa_0_1_ph
- (i32.const 0)
- )
- (set_local $$q_sroa_1_1_ph
- (i32.shl
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$58)
- )
- )
- (br $do-once$0)
- )
- )
- (if
- (i32.eq
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.const 0)
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (i32.store
- (get_local $$rem)
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $$a$0)
- (i32.const -1)
- )
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.or
- (get_local $$n_sroa_1_4_extract_shift$0)
- (i32.and
- (get_local $$a$1)
- (i32.const 0)
- )
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.const 0)
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- (block
- (if
- (i32.eqz
- (get_local $$17)
- )
- (block
- (set_local $$117
- (i32.clz
- (get_local $$d_sroa_1_4_extract_trunc)
- )
- )
- (set_local $$119
- (i32.sub
- (get_local $$117)
- (i32.clz
- (get_local $$n_sroa_1_4_extract_trunc)
- )
- )
- )
- (if
- (i32.le_u
- (get_local $$119)
- (i32.const 31)
- )
- (block
- (set_local $$125
- (i32.add
- (get_local $$119)
- (i32.const 1)
- )
- )
- (set_local $$126
- (i32.sub
- (i32.const 31)
- (get_local $$119)
- )
- )
- (set_local $$130
- (i32.shr_s
- (i32.sub
- (get_local $$119)
- (i32.const 31)
- )
- (i32.const 31)
- )
- )
- (set_local $$sr_1_ph
- (get_local $$125)
- )
- (set_local $$r_sroa_0_1_ph
- (i32.or
- (i32.and
- (i32.shr_u
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$125)
- )
- (get_local $$130)
- )
- (i32.shl
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$126)
- )
- )
- )
- (set_local $$r_sroa_1_1_ph
- (i32.and
- (i32.shr_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$125)
- )
- (get_local $$130)
- )
- )
- (set_local $$q_sroa_0_1_ph
- (i32.const 0)
- )
- (set_local $$q_sroa_1_1_ph
- (i32.shl
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$126)
- )
- )
- (br $do-once$0)
- )
- )
- (if
- (i32.eq
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.const 0)
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (i32.store
- (get_local $$rem)
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $$a$0)
- (i32.const -1)
- )
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.or
- (get_local $$n_sroa_1_4_extract_shift$0)
- (i32.and
- (get_local $$a$1)
- (i32.const 0)
- )
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.const 0)
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (set_local $$66
- (i32.sub
- (get_local $$d_sroa_0_0_extract_trunc)
- (i32.const 1)
- )
- )
- (if
- (i32.ne
- (i32.and
- (get_local $$66)
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- (i32.const 0)
- )
- (block
- (set_local $$86
- (i32.add
- (i32.clz
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- (i32.const 33)
- )
- )
- (set_local $$88
- (i32.sub
- (get_local $$86)
- (i32.clz
- (get_local $$n_sroa_1_4_extract_trunc)
- )
- )
- )
- (set_local $$89
- (i32.sub
- (i32.const 64)
- (get_local $$88)
- )
- )
- (set_local $$91
- (i32.sub
- (i32.const 32)
- (get_local $$88)
- )
- )
- (set_local $$92
- (i32.shr_s
- (get_local $$91)
- (i32.const 31)
- )
- )
- (set_local $$95
- (i32.sub
- (get_local $$88)
- (i32.const 32)
- )
- )
- (set_local $$105
- (i32.shr_s
- (get_local $$95)
- (i32.const 31)
- )
- )
- (set_local $$sr_1_ph
- (get_local $$88)
- )
- (set_local $$r_sroa_0_1_ph
- (i32.or
- (i32.and
- (i32.shr_s
- (i32.sub
- (get_local $$91)
- (i32.const 1)
- )
- (i32.const 31)
- )
- (i32.shr_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$95)
- )
- )
- (i32.and
- (i32.or
- (i32.shl
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$91)
- )
- (i32.shr_u
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$88)
- )
- )
- (get_local $$105)
- )
- )
- )
- (set_local $$r_sroa_1_1_ph
- (i32.and
- (get_local $$105)
- (i32.shr_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$88)
- )
- )
- )
- (set_local $$q_sroa_0_1_ph
- (i32.and
- (i32.shl
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$89)
- )
- (get_local $$92)
- )
- )
- (set_local $$q_sroa_1_1_ph
- (i32.or
- (i32.and
- (i32.or
- (i32.shl
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$89)
- )
- (i32.shr_u
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$95)
- )
- )
- (get_local $$92)
- )
- (i32.and
- (i32.shl
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$91)
- )
- (i32.shr_s
- (i32.sub
- (get_local $$88)
- (i32.const 33)
- )
- (i32.const 31)
- )
- )
- )
- )
- (br $do-once$0)
- )
- )
- (if
- (i32.ne
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $$rem)
- (i32.and
- (get_local $$66)
- (get_local $$n_sroa_0_0_extract_trunc)
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.const 0)
- )
- )
- )
- (if
- (i32.eq
- (get_local $$d_sroa_0_0_extract_trunc)
- (i32.const 1)
- )
- (block
- (set_local $$_0$1
- (i32.or
- (get_local $$n_sroa_1_4_extract_shift$0)
- (i32.and
- (get_local $$a$1)
- (i32.const 0)
- )
- )
- )
- (set_local $$_0$0
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $$a$0)
- (i32.const -1)
- )
- )
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- (block
- (set_local $$78
- (i32.ctz
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- )
- (set_local $$_0$1
- (i32.or
- (i32.const 0)
- (i32.shr_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$78)
- )
- )
- )
- (set_local $$_0$0
- (i32.or
- (i32.shl
- (get_local $$n_sroa_1_4_extract_trunc)
- (i32.sub
- (i32.const 32)
- (get_local $$78)
- )
- )
- (i32.shr_u
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$78)
- )
- )
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
+ (i64.shl
+ (i64.extend_u/i32
+ (get_local $yh)
)
+ (i64.const 32)
)
)
)
(if
- (i32.eq
- (get_local $$sr_1_ph)
- (i32.const 0)
- )
- (block
- (set_local $$q_sroa_1_1_lcssa
- (get_local $$q_sroa_1_1_ph)
- )
- (set_local $$q_sroa_0_1_lcssa
- (get_local $$q_sroa_0_1_ph)
- )
- (set_local $$r_sroa_1_1_lcssa
- (get_local $$r_sroa_1_1_ph)
- )
- (set_local $$r_sroa_0_1_lcssa
- (get_local $$r_sroa_0_1_ph)
- )
- (set_local $$carry_0_lcssa$1
- (i32.const 0)
- )
- (set_local $$carry_0_lcssa$0
- (i32.const 0)
+ (get_local $r)
+ (i64.store
+ (get_local $r)
+ (i64.rem_u
+ (get_local $x64)
+ (get_local $y64)
)
)
- (block
- (set_local $$d_sroa_0_0_insert_insert99$0
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $$b$0)
- (i32.const -1)
- )
- )
- )
- (set_local $$d_sroa_0_0_insert_insert99$1
- (i32.or
- (get_local $$d_sroa_1_4_extract_shift$0)
- (i32.and
- (get_local $$b$1)
- (i32.const 0)
- )
- )
- )
- (set_local $$137$0
- (call $_i64Add
- (get_local $$d_sroa_0_0_insert_insert99$0)
- (get_local $$d_sroa_0_0_insert_insert99$1)
- (i32.const -1)
- (i32.const -1)
- )
- )
- (set_local $$137$1
- (get_global $tempRet0)
- )
- (set_local $$q_sroa_1_1198
- (get_local $$q_sroa_1_1_ph)
- )
- (set_local $$q_sroa_0_1199
- (get_local $$q_sroa_0_1_ph)
- )
- (set_local $$r_sroa_1_1200
- (get_local $$r_sroa_1_1_ph)
- )
- (set_local $$r_sroa_0_1201
- (get_local $$r_sroa_0_1_ph)
- )
- (set_local $$sr_1202
- (get_local $$sr_1_ph)
- )
- (set_local $$carry_0203
- (i32.const 0)
- )
- (loop $while-in$3
- (block $while-out$2
- (set_local $$147
- (i32.or
- (i32.shr_u
- (get_local $$q_sroa_0_1199)
- (i32.const 31)
- )
- (i32.shl
- (get_local $$q_sroa_1_1198)
- (i32.const 1)
- )
- )
- )
- (set_local $$149
- (i32.or
- (get_local $$carry_0203)
- (i32.shl
- (get_local $$q_sroa_0_1199)
- (i32.const 1)
- )
- )
- )
- (set_local $$r_sroa_0_0_insert_insert42$0
- (i32.or
- (i32.const 0)
- (i32.or
- (i32.shl
- (get_local $$r_sroa_0_1201)
- (i32.const 1)
- )
- (i32.shr_u
- (get_local $$q_sroa_1_1198)
- (i32.const 31)
- )
- )
- )
- )
- (set_local $$r_sroa_0_0_insert_insert42$1
- (i32.or
- (i32.shr_u
- (get_local $$r_sroa_0_1201)
- (i32.const 31)
- )
- (i32.shl
- (get_local $$r_sroa_1_1200)
- (i32.const 1)
- )
- )
- )
- (drop
- (call $_i64Subtract
- (get_local $$137$0)
- (get_local $$137$1)
- (get_local $$r_sroa_0_0_insert_insert42$0)
- (get_local $$r_sroa_0_0_insert_insert42$1)
- )
- )
- (set_local $$150$1
- (get_global $tempRet0)
- )
- (set_local $$151$0
- (i32.or
- (i32.shr_s
- (get_local $$150$1)
- (i32.const 31)
- )
- (i32.shl
- (if
- (i32.lt_s
- (get_local $$150$1)
- (i32.const 0)
- )
- (i32.const -1)
- (i32.const 0)
- )
- (i32.const 1)
- )
- )
- )
- (set_local $$152
- (i32.and
- (get_local $$151$0)
- (i32.const 1)
- )
- )
- (set_local $$154$0
- (call $_i64Subtract
- (get_local $$r_sroa_0_0_insert_insert42$0)
- (get_local $$r_sroa_0_0_insert_insert42$1)
- (i32.and
- (get_local $$151$0)
- (get_local $$d_sroa_0_0_insert_insert99$0)
- )
- (i32.and
- (i32.or
- (i32.shr_s
- (if
- (i32.lt_s
- (get_local $$150$1)
- (i32.const 0)
- )
- (i32.const -1)
- (i32.const 0)
- )
- (i32.const 31)
- )
- (i32.shl
- (if
- (i32.lt_s
- (get_local $$150$1)
- (i32.const 0)
- )
- (i32.const -1)
- (i32.const 0)
- )
- (i32.const 1)
- )
- )
- (get_local $$d_sroa_0_0_insert_insert99$1)
- )
- )
- )
- (set_local $$r_sroa_0_0_extract_trunc
- (get_local $$154$0)
- )
- (set_local $$r_sroa_1_4_extract_trunc
- (get_global $tempRet0)
- )
- (set_local $$155
- (i32.sub
- (get_local $$sr_1202)
- (i32.const 1)
- )
- )
- (if
- (i32.eq
- (get_local $$155)
- (i32.const 0)
- )
- (br $while-out$2)
- (block
- (set_local $$q_sroa_1_1198
- (get_local $$147)
- )
- (set_local $$q_sroa_0_1199
- (get_local $$149)
- )
- (set_local $$r_sroa_1_1200
- (get_local $$r_sroa_1_4_extract_trunc)
- )
- (set_local $$r_sroa_0_1201
- (get_local $$r_sroa_0_0_extract_trunc)
- )
- (set_local $$sr_1202
- (get_local $$155)
- )
- (set_local $$carry_0203
- (get_local $$152)
- )
- )
- )
- (br $while-in$3)
- )
- )
- (set_local $$q_sroa_1_1_lcssa
- (get_local $$147)
- )
- (set_local $$q_sroa_0_1_lcssa
- (get_local $$149)
- )
- (set_local $$r_sroa_1_1_lcssa
- (get_local $$r_sroa_1_4_extract_trunc)
- )
- (set_local $$r_sroa_0_1_lcssa
- (get_local $$r_sroa_0_0_extract_trunc)
- )
- (set_local $$carry_0_lcssa$1
- (i32.const 0)
- )
- (set_local $$carry_0_lcssa$0
- (get_local $$152)
- )
- )
- )
- (set_local $$q_sroa_0_0_insert_ext75$0
- (get_local $$q_sroa_0_1_lcssa)
- )
- (set_local $$q_sroa_0_0_insert_ext75$1
- (i32.const 0)
)
- (set_local $$q_sroa_0_0_insert_insert77$1
- (i32.or
- (get_local $$q_sroa_1_1_lcssa)
- (get_local $$q_sroa_0_0_insert_ext75$1)
+ (set_local $x64
+ (i64.div_u
+ (get_local $x64)
+ (get_local $y64)
)
)
- (if
- (i32.ne
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $$rem)
- (i32.or
- (i32.const 0)
- (get_local $$r_sroa_0_1_lcssa)
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (get_local $$r_sroa_1_1_lcssa)
- )
- )
- )
- (set_local $$_0$1
- (i32.or
- (i32.or
- (i32.or
- (i32.shr_u
- (i32.or
- (i32.const 0)
- (get_local $$q_sroa_0_0_insert_ext75$0)
- )
- (i32.const 31)
- )
- (i32.shl
- (get_local $$q_sroa_0_0_insert_insert77$1)
- (i32.const 1)
- )
- )
- (i32.and
- (i32.or
- (i32.shl
- (get_local $$q_sroa_0_0_insert_ext75$1)
- (i32.const 1)
- )
- (i32.shr_u
- (get_local $$q_sroa_0_0_insert_ext75$0)
- (i32.const 31)
- )
- )
- (i32.const 0)
- )
- )
- (get_local $$carry_0_lcssa$1)
- )
- )
- (set_local $$_0$0
- (i32.or
- (i32.and
- (i32.or
- (i32.shl
- (get_local $$q_sroa_0_0_insert_ext75$0)
- (i32.const 1)
- )
- (i32.shr_u
- (i32.const 0)
- (i32.const 31)
- )
- )
- (i32.const -2)
+ (set_global $tempRet0
+ (i32.wrap/i64
+ (i64.shr_u
+ (get_local $x64)
+ (i64.const 32)
)
- (get_local $$carry_0_lcssa$0)
)
)
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
+ (i32.wrap/i64
+ (get_local $x64)
)
)
(func $dynCall_ii (param $index i32) (param $a1 i32) (result i32)
diff --git a/test/emcc_hello_world.fromasm.no-opts b/test/emcc_hello_world.fromasm.no-opts
index 93f1a73cd..0231444cc 100644
--- a/test/emcc_hello_world.fromasm.no-opts
+++ b/test/emcc_hello_world.fromasm.no-opts
@@ -31454,1303 +31454,61 @@
)
)
)
- (func $___udivmoddi4 (param $$a$0 i32) (param $$a$1 i32) (param $$b$0 i32) (param $$b$1 i32) (param $$rem i32) (result i32)
- (local $$n_sroa_0_0_extract_trunc i32)
- (local $$n_sroa_1_4_extract_shift$0 i32)
- (local $$n_sroa_1_4_extract_trunc i32)
- (local $$d_sroa_0_0_extract_trunc i32)
- (local $$d_sroa_1_4_extract_shift$0 i32)
- (local $$d_sroa_1_4_extract_trunc i32)
- (local $$4 i32)
- (local $$17 i32)
- (local $$37 i32)
- (local $$49 i32)
- (local $$51 i32)
- (local $$57 i32)
- (local $$58 i32)
- (local $$66 i32)
- (local $$78 i32)
- (local $$86 i32)
- (local $$88 i32)
- (local $$89 i32)
- (local $$91 i32)
- (local $$92 i32)
- (local $$95 i32)
- (local $$105 i32)
- (local $$117 i32)
- (local $$119 i32)
- (local $$125 i32)
- (local $$126 i32)
- (local $$130 i32)
- (local $$q_sroa_1_1_ph i32)
- (local $$q_sroa_0_1_ph i32)
- (local $$r_sroa_1_1_ph i32)
- (local $$r_sroa_0_1_ph i32)
- (local $$sr_1_ph i32)
- (local $$d_sroa_0_0_insert_insert99$0 i32)
- (local $$d_sroa_0_0_insert_insert99$1 i32)
- (local $$137$0 i32)
- (local $$137$1 i32)
- (local $$carry_0203 i32)
- (local $$sr_1202 i32)
- (local $$r_sroa_0_1201 i32)
- (local $$r_sroa_1_1200 i32)
- (local $$q_sroa_0_1199 i32)
- (local $$q_sroa_1_1198 i32)
- (local $$147 i32)
- (local $$149 i32)
- (local $$r_sroa_0_0_insert_insert42$0 i32)
- (local $$r_sroa_0_0_insert_insert42$1 i32)
- (local $$150$1 i32)
- (local $$151$0 i32)
- (local $$152 i32)
- (local $$154$0 i32)
- (local $$r_sroa_0_0_extract_trunc i32)
- (local $$r_sroa_1_4_extract_trunc i32)
- (local $$155 i32)
- (local $$carry_0_lcssa$0 i32)
- (local $$carry_0_lcssa$1 i32)
- (local $$r_sroa_0_1_lcssa i32)
- (local $$r_sroa_1_1_lcssa i32)
- (local $$q_sroa_0_1_lcssa i32)
- (local $$q_sroa_1_1_lcssa i32)
- (local $$q_sroa_0_0_insert_ext75$0 i32)
- (local $$q_sroa_0_0_insert_ext75$1 i32)
- (local $$q_sroa_0_0_insert_insert77$1 i32)
- (local $$_0$0 i32)
- (local $$_0$1 i32)
- (set_local $$n_sroa_0_0_extract_trunc
- (get_local $$a$0)
- )
- (set_local $$n_sroa_1_4_extract_shift$0
- (get_local $$a$1)
- )
- (set_local $$n_sroa_1_4_extract_trunc
- (get_local $$n_sroa_1_4_extract_shift$0)
- )
- (set_local $$d_sroa_0_0_extract_trunc
- (get_local $$b$0)
- )
- (set_local $$d_sroa_1_4_extract_shift$0
- (get_local $$b$1)
- )
- (set_local $$d_sroa_1_4_extract_trunc
- (get_local $$d_sroa_1_4_extract_shift$0)
- )
- (if
- (i32.eq
- (get_local $$n_sroa_1_4_extract_trunc)
- (i32.const 0)
- )
- (block
- (set_local $$4
- (i32.ne
- (get_local $$rem)
- (i32.const 0)
- )
+ (func $___udivmoddi4 (param $xl i32) (param $xh i32) (param $yl i32) (param $yh i32) (param $r i32) (result i32)
+ (local $x64 i64)
+ (local $y64 i64)
+ (set_local $x64
+ (i64.or
+ (i64.extend_u/i32
+ (get_local $xl)
)
- (if
- (i32.eq
- (get_local $$d_sroa_1_4_extract_trunc)
- (i32.const 0)
- )
- (block
- (if
- (get_local $$4)
- (block
- (i32.store
- (get_local $$rem)
- (call_import $i32u-rem
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.const 0)
- )
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (call_import $i32u-div
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- (block
- (if
- (i32.eqz
- (get_local $$4)
- )
- (block
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.const 0)
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (i32.store
- (get_local $$rem)
- (i32.and
- (get_local $$a$0)
- (i32.const -1)
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.and
- (get_local $$a$1)
- (i32.const 0)
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.const 0)
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
+ (i64.shl
+ (i64.extend_u/i32
+ (get_local $xh)
)
+ (i64.const 32)
)
)
)
- (set_local $$17
- (i32.eq
- (get_local $$d_sroa_1_4_extract_trunc)
- (i32.const 0)
- )
- )
- (block $do-once$0
- (if
- (i32.eq
- (get_local $$d_sroa_0_0_extract_trunc)
- (i32.const 0)
+ (set_local $y64
+ (i64.or
+ (i64.extend_u/i32
+ (get_local $yl)
)
- (block
- (if
- (get_local $$17)
- (block
- (if
- (i32.ne
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $$rem)
- (call_import $i32u-rem
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.const 0)
- )
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (call_import $i32u-div
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (if
- (i32.eq
- (get_local $$n_sroa_0_0_extract_trunc)
- (i32.const 0)
- )
- (block
- (if
- (i32.ne
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $$rem)
- (i32.const 0)
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (call_import $i32u-rem
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$d_sroa_1_4_extract_trunc)
- )
- )
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (call_import $i32u-div
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$d_sroa_1_4_extract_trunc)
- )
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (set_local $$37
- (i32.sub
- (get_local $$d_sroa_1_4_extract_trunc)
- (i32.const 1)
- )
- )
- (if
- (i32.eq
- (i32.and
- (get_local $$37)
- (get_local $$d_sroa_1_4_extract_trunc)
- )
- (i32.const 0)
- )
- (block
- (if
- (i32.ne
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $$rem)
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $$a$0)
- (i32.const -1)
- )
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.or
- (i32.and
- (get_local $$37)
- (get_local $$n_sroa_1_4_extract_trunc)
- )
- (i32.and
- (get_local $$a$1)
- (i32.const 0)
- )
- )
- )
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.shr_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (i32.ctz
- (get_local $$d_sroa_1_4_extract_trunc)
- )
- )
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (set_local $$49
- (i32.clz
- (get_local $$d_sroa_1_4_extract_trunc)
- )
- )
- (set_local $$51
- (i32.sub
- (get_local $$49)
- (i32.clz
- (get_local $$n_sroa_1_4_extract_trunc)
- )
- )
- )
- (if
- (i32.le_u
- (get_local $$51)
- (i32.const 30)
- )
- (block
- (set_local $$57
- (i32.add
- (get_local $$51)
- (i32.const 1)
- )
- )
- (set_local $$58
- (i32.sub
- (i32.const 31)
- (get_local $$51)
- )
- )
- (set_local $$sr_1_ph
- (get_local $$57)
- )
- (set_local $$r_sroa_0_1_ph
- (i32.or
- (i32.shl
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$58)
- )
- (i32.shr_u
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$57)
- )
- )
- )
- (set_local $$r_sroa_1_1_ph
- (i32.shr_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$57)
- )
- )
- (set_local $$q_sroa_0_1_ph
- (i32.const 0)
- )
- (set_local $$q_sroa_1_1_ph
- (i32.shl
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$58)
- )
- )
- (br $do-once$0)
- )
- )
- (if
- (i32.eq
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.const 0)
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (i32.store
- (get_local $$rem)
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $$a$0)
- (i32.const -1)
- )
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.or
- (get_local $$n_sroa_1_4_extract_shift$0)
- (i32.and
- (get_local $$a$1)
- (i32.const 0)
- )
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.const 0)
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- (block
- (if
- (i32.eqz
- (get_local $$17)
- )
- (block
- (set_local $$117
- (i32.clz
- (get_local $$d_sroa_1_4_extract_trunc)
- )
- )
- (set_local $$119
- (i32.sub
- (get_local $$117)
- (i32.clz
- (get_local $$n_sroa_1_4_extract_trunc)
- )
- )
- )
- (if
- (i32.le_u
- (get_local $$119)
- (i32.const 31)
- )
- (block
- (set_local $$125
- (i32.add
- (get_local $$119)
- (i32.const 1)
- )
- )
- (set_local $$126
- (i32.sub
- (i32.const 31)
- (get_local $$119)
- )
- )
- (set_local $$130
- (i32.shr_s
- (i32.sub
- (get_local $$119)
- (i32.const 31)
- )
- (i32.const 31)
- )
- )
- (set_local $$sr_1_ph
- (get_local $$125)
- )
- (set_local $$r_sroa_0_1_ph
- (i32.or
- (i32.and
- (i32.shr_u
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$125)
- )
- (get_local $$130)
- )
- (i32.shl
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$126)
- )
- )
- )
- (set_local $$r_sroa_1_1_ph
- (i32.and
- (i32.shr_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$125)
- )
- (get_local $$130)
- )
- )
- (set_local $$q_sroa_0_1_ph
- (i32.const 0)
- )
- (set_local $$q_sroa_1_1_ph
- (i32.shl
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$126)
- )
- )
- (br $do-once$0)
- )
- )
- (if
- (i32.eq
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.const 0)
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (i32.store
- (get_local $$rem)
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $$a$0)
- (i32.const -1)
- )
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.or
- (get_local $$n_sroa_1_4_extract_shift$0)
- (i32.and
- (get_local $$a$1)
- (i32.const 0)
- )
- )
- )
- (set_local $$_0$1
- (i32.const 0)
- )
- (set_local $$_0$0
- (i32.const 0)
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- )
- (set_local $$66
- (i32.sub
- (get_local $$d_sroa_0_0_extract_trunc)
- (i32.const 1)
- )
- )
- (if
- (i32.ne
- (i32.and
- (get_local $$66)
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- (i32.const 0)
- )
- (block
- (set_local $$86
- (i32.add
- (i32.clz
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- (i32.const 33)
- )
- )
- (set_local $$88
- (i32.sub
- (get_local $$86)
- (i32.clz
- (get_local $$n_sroa_1_4_extract_trunc)
- )
- )
- )
- (set_local $$89
- (i32.sub
- (i32.const 64)
- (get_local $$88)
- )
- )
- (set_local $$91
- (i32.sub
- (i32.const 32)
- (get_local $$88)
- )
- )
- (set_local $$92
- (i32.shr_s
- (get_local $$91)
- (i32.const 31)
- )
- )
- (set_local $$95
- (i32.sub
- (get_local $$88)
- (i32.const 32)
- )
- )
- (set_local $$105
- (i32.shr_s
- (get_local $$95)
- (i32.const 31)
- )
- )
- (set_local $$sr_1_ph
- (get_local $$88)
- )
- (set_local $$r_sroa_0_1_ph
- (i32.or
- (i32.and
- (i32.shr_s
- (i32.sub
- (get_local $$91)
- (i32.const 1)
- )
- (i32.const 31)
- )
- (i32.shr_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$95)
- )
- )
- (i32.and
- (i32.or
- (i32.shl
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$91)
- )
- (i32.shr_u
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$88)
- )
- )
- (get_local $$105)
- )
- )
- )
- (set_local $$r_sroa_1_1_ph
- (i32.and
- (get_local $$105)
- (i32.shr_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$88)
- )
- )
- )
- (set_local $$q_sroa_0_1_ph
- (i32.and
- (i32.shl
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$89)
- )
- (get_local $$92)
- )
- )
- (set_local $$q_sroa_1_1_ph
- (i32.or
- (i32.and
- (i32.or
- (i32.shl
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$89)
- )
- (i32.shr_u
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$95)
- )
- )
- (get_local $$92)
- )
- (i32.and
- (i32.shl
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$91)
- )
- (i32.shr_s
- (i32.sub
- (get_local $$88)
- (i32.const 33)
- )
- (i32.const 31)
- )
- )
- )
- )
- (br $do-once$0)
- )
- )
- (if
- (i32.ne
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $$rem)
- (i32.and
- (get_local $$66)
- (get_local $$n_sroa_0_0_extract_trunc)
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (i32.const 0)
- )
- )
- )
- (if
- (i32.eq
- (get_local $$d_sroa_0_0_extract_trunc)
- (i32.const 1)
- )
- (block
- (set_local $$_0$1
- (i32.or
- (get_local $$n_sroa_1_4_extract_shift$0)
- (i32.and
- (get_local $$a$1)
- (i32.const 0)
- )
- )
- )
- (set_local $$_0$0
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $$a$0)
- (i32.const -1)
- )
- )
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
- (block
- (set_local $$78
- (i32.ctz
- (get_local $$d_sroa_0_0_extract_trunc)
- )
- )
- (set_local $$_0$1
- (i32.or
- (i32.const 0)
- (i32.shr_u
- (get_local $$n_sroa_1_4_extract_trunc)
- (get_local $$78)
- )
- )
- )
- (set_local $$_0$0
- (i32.or
- (i32.shl
- (get_local $$n_sroa_1_4_extract_trunc)
- (i32.sub
- (i32.const 32)
- (get_local $$78)
- )
- )
- (i32.shr_u
- (get_local $$n_sroa_0_0_extract_trunc)
- (get_local $$78)
- )
- )
- )
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
- )
- )
+ (i64.shl
+ (i64.extend_u/i32
+ (get_local $yh)
)
+ (i64.const 32)
)
)
)
(if
- (i32.eq
- (get_local $$sr_1_ph)
- (i32.const 0)
- )
- (block
- (set_local $$q_sroa_1_1_lcssa
- (get_local $$q_sroa_1_1_ph)
- )
- (set_local $$q_sroa_0_1_lcssa
- (get_local $$q_sroa_0_1_ph)
- )
- (set_local $$r_sroa_1_1_lcssa
- (get_local $$r_sroa_1_1_ph)
- )
- (set_local $$r_sroa_0_1_lcssa
- (get_local $$r_sroa_0_1_ph)
- )
- (set_local $$carry_0_lcssa$1
- (i32.const 0)
- )
- (set_local $$carry_0_lcssa$0
- (i32.const 0)
+ (get_local $r)
+ (i64.store
+ (get_local $r)
+ (i64.rem_u
+ (get_local $x64)
+ (get_local $y64)
)
)
- (block
- (set_local $$d_sroa_0_0_insert_insert99$0
- (i32.or
- (i32.const 0)
- (i32.and
- (get_local $$b$0)
- (i32.const -1)
- )
- )
- )
- (set_local $$d_sroa_0_0_insert_insert99$1
- (i32.or
- (get_local $$d_sroa_1_4_extract_shift$0)
- (i32.and
- (get_local $$b$1)
- (i32.const 0)
- )
- )
- )
- (set_local $$137$0
- (call $_i64Add
- (get_local $$d_sroa_0_0_insert_insert99$0)
- (get_local $$d_sroa_0_0_insert_insert99$1)
- (i32.const -1)
- (i32.const -1)
- )
- )
- (set_local $$137$1
- (get_global $tempRet0)
- )
- (set_local $$q_sroa_1_1198
- (get_local $$q_sroa_1_1_ph)
- )
- (set_local $$q_sroa_0_1199
- (get_local $$q_sroa_0_1_ph)
- )
- (set_local $$r_sroa_1_1200
- (get_local $$r_sroa_1_1_ph)
- )
- (set_local $$r_sroa_0_1201
- (get_local $$r_sroa_0_1_ph)
- )
- (set_local $$sr_1202
- (get_local $$sr_1_ph)
- )
- (set_local $$carry_0203
- (i32.const 0)
- )
- (loop $while-in$3
- (block $while-out$2
- (set_local $$147
- (i32.or
- (i32.shr_u
- (get_local $$q_sroa_0_1199)
- (i32.const 31)
- )
- (i32.shl
- (get_local $$q_sroa_1_1198)
- (i32.const 1)
- )
- )
- )
- (set_local $$149
- (i32.or
- (get_local $$carry_0203)
- (i32.shl
- (get_local $$q_sroa_0_1199)
- (i32.const 1)
- )
- )
- )
- (set_local $$r_sroa_0_0_insert_insert42$0
- (i32.or
- (i32.const 0)
- (i32.or
- (i32.shl
- (get_local $$r_sroa_0_1201)
- (i32.const 1)
- )
- (i32.shr_u
- (get_local $$q_sroa_1_1198)
- (i32.const 31)
- )
- )
- )
- )
- (set_local $$r_sroa_0_0_insert_insert42$1
- (i32.or
- (i32.shr_u
- (get_local $$r_sroa_0_1201)
- (i32.const 31)
- )
- (i32.shl
- (get_local $$r_sroa_1_1200)
- (i32.const 1)
- )
- )
- )
- (drop
- (call $_i64Subtract
- (get_local $$137$0)
- (get_local $$137$1)
- (get_local $$r_sroa_0_0_insert_insert42$0)
- (get_local $$r_sroa_0_0_insert_insert42$1)
- )
- )
- (set_local $$150$1
- (get_global $tempRet0)
- )
- (set_local $$151$0
- (i32.or
- (i32.shr_s
- (get_local $$150$1)
- (i32.const 31)
- )
- (i32.shl
- (if
- (i32.lt_s
- (get_local $$150$1)
- (i32.const 0)
- )
- (i32.const -1)
- (i32.const 0)
- )
- (i32.const 1)
- )
- )
- )
- (set_local $$152
- (i32.and
- (get_local $$151$0)
- (i32.const 1)
- )
- )
- (set_local $$154$0
- (call $_i64Subtract
- (get_local $$r_sroa_0_0_insert_insert42$0)
- (get_local $$r_sroa_0_0_insert_insert42$1)
- (i32.and
- (get_local $$151$0)
- (get_local $$d_sroa_0_0_insert_insert99$0)
- )
- (i32.and
- (i32.or
- (i32.shr_s
- (if
- (i32.lt_s
- (get_local $$150$1)
- (i32.const 0)
- )
- (i32.const -1)
- (i32.const 0)
- )
- (i32.const 31)
- )
- (i32.shl
- (if
- (i32.lt_s
- (get_local $$150$1)
- (i32.const 0)
- )
- (i32.const -1)
- (i32.const 0)
- )
- (i32.const 1)
- )
- )
- (get_local $$d_sroa_0_0_insert_insert99$1)
- )
- )
- )
- (set_local $$r_sroa_0_0_extract_trunc
- (get_local $$154$0)
- )
- (set_local $$r_sroa_1_4_extract_trunc
- (get_global $tempRet0)
- )
- (set_local $$155
- (i32.sub
- (get_local $$sr_1202)
- (i32.const 1)
- )
- )
- (if
- (i32.eq
- (get_local $$155)
- (i32.const 0)
- )
- (br $while-out$2)
- (block
- (set_local $$q_sroa_1_1198
- (get_local $$147)
- )
- (set_local $$q_sroa_0_1199
- (get_local $$149)
- )
- (set_local $$r_sroa_1_1200
- (get_local $$r_sroa_1_4_extract_trunc)
- )
- (set_local $$r_sroa_0_1201
- (get_local $$r_sroa_0_0_extract_trunc)
- )
- (set_local $$sr_1202
- (get_local $$155)
- )
- (set_local $$carry_0203
- (get_local $$152)
- )
- )
- )
- (br $while-in$3)
- )
- )
- (set_local $$q_sroa_1_1_lcssa
- (get_local $$147)
- )
- (set_local $$q_sroa_0_1_lcssa
- (get_local $$149)
- )
- (set_local $$r_sroa_1_1_lcssa
- (get_local $$r_sroa_1_4_extract_trunc)
- )
- (set_local $$r_sroa_0_1_lcssa
- (get_local $$r_sroa_0_0_extract_trunc)
- )
- (set_local $$carry_0_lcssa$1
- (i32.const 0)
- )
- (set_local $$carry_0_lcssa$0
- (get_local $$152)
- )
- )
- )
- (set_local $$q_sroa_0_0_insert_ext75$0
- (get_local $$q_sroa_0_1_lcssa)
- )
- (set_local $$q_sroa_0_0_insert_ext75$1
- (i32.const 0)
)
- (set_local $$q_sroa_0_0_insert_insert77$1
- (i32.or
- (get_local $$q_sroa_1_1_lcssa)
- (get_local $$q_sroa_0_0_insert_ext75$1)
+ (set_local $x64
+ (i64.div_u
+ (get_local $x64)
+ (get_local $y64)
)
)
- (if
- (i32.ne
- (get_local $$rem)
- (i32.const 0)
- )
- (block
- (i32.store
- (get_local $$rem)
- (i32.or
- (i32.const 0)
- (get_local $$r_sroa_0_1_lcssa)
- )
- )
- (i32.store
- (i32.add
- (get_local $$rem)
- (i32.const 4)
- )
- (get_local $$r_sroa_1_1_lcssa)
- )
- )
- )
- (set_local $$_0$1
- (i32.or
- (i32.or
- (i32.or
- (i32.shr_u
- (i32.or
- (i32.const 0)
- (get_local $$q_sroa_0_0_insert_ext75$0)
- )
- (i32.const 31)
- )
- (i32.shl
- (get_local $$q_sroa_0_0_insert_insert77$1)
- (i32.const 1)
- )
- )
- (i32.and
- (i32.or
- (i32.shl
- (get_local $$q_sroa_0_0_insert_ext75$1)
- (i32.const 1)
- )
- (i32.shr_u
- (get_local $$q_sroa_0_0_insert_ext75$0)
- (i32.const 31)
- )
- )
- (i32.const 0)
- )
- )
- (get_local $$carry_0_lcssa$1)
- )
- )
- (set_local $$_0$0
- (i32.or
- (i32.and
- (i32.or
- (i32.shl
- (get_local $$q_sroa_0_0_insert_ext75$0)
- (i32.const 1)
- )
- (i32.shr_u
- (i32.const 0)
- (i32.const 31)
- )
- )
- (i32.const -2)
+ (set_global $tempRet0
+ (i32.wrap/i64
+ (i64.shr_u
+ (get_local $x64)
+ (i64.const 32)
)
- (get_local $$carry_0_lcssa$0)
)
)
- (return
- (block
- (block
- (set_global $tempRet0
- (get_local $$_0$1)
- )
- (drop
- (get_global $tempRet0)
- )
- )
- (get_local $$_0$0)
- )
+ (i32.wrap/i64
+ (get_local $x64)
)
)
(func $dynCall_ii (param $index i32) (param $a1 i32) (result i32)