Improve per-bit divmod loop for mod & rem (#307)

This commit is contained in:
Max Graey 2018-10-30 16:10:50 +02:00 committed by Daniel Wirtz
parent d864977a1a
commit d864bef1eb
7 changed files with 936 additions and 1079 deletions

View File

@ -1103,19 +1103,17 @@ export namespace NativeMath {
uy &= <u64>-1 >> 12;
uy |= 1 << 52;
}
var i: u64;
for (; ex > ey; ex--) {
i = ux - uy;
if (!(i >> 63)) {
if (!i) return 0 * x;
ux = i;
while (ex > ey) {
if (ux >= uy) {
if (ux == uy) return 0 * x;
ux -= uy;
}
ux <<= 1;
--ex;
}
i = ux - uy;
if (!(i >> 63)) {
if (!i) return 0 * x;
ux = i;
if (ux >= uy) {
if (ux == uy) return 0 * x;
ux -= uy;
}
// for (; !(ux >> 52); ux <<= 1) --ex;
var shift = builtin_clz<i64>(ux << 11);
@ -1160,19 +1158,17 @@ export namespace NativeMath {
if (ex + 1 == ey) break; // goto end
return x;
}
let i: u64;
for (; ex > ey; --ex) {
i = uxi - uy;
if (i >> 63 == 0) {
uxi = i;
while (ex > ey) {
if (uxi >= uy) {
uxi -= uy;
++q;
}
uxi <<= 1;
q <<= 1;
--ex;
}
i = uxi - uy;
if (i >> 63 == 0) {
uxi = i;
if (uxi >= uy) {
uxi -= uy;
++q;
}
if (uxi == 0) ex = -60;
@ -2156,19 +2152,17 @@ export namespace NativeMathf {
uy &= <u32>-1 >> 9;
uy |= 1 << 23;
}
var i: u32;
for (; ex > ey; --ex) {
i = ux - uy;
if (!(i >> 31)) {
if (!i) return 0 * x;
ux = i;
while (ex > ey) {
if (ux >= uy) {
if (ux == uy) return 0 * x;
ux -= uy;
}
ux <<= 1;
--ex;
}
i = ux - uy;
if (!(i >> 31)) {
if (!i) return 0 * x;
ux = i;
if (ux >= uy) {
if (ux == uy) return 0 * x;
ux -= uy;
}
// for (; !(ux >> 23); ux <<= 1) --ex;
var shift = <i32>builtin_clz<u32>(ux << 8);
@ -2213,19 +2207,17 @@ export namespace NativeMathf {
if (ex + 1 == ey) break; // goto end
return x;
}
let i: u32;
for (; ex > ey; --ex) {
i = uxi - uy;
if (i >> 31 == 0) {
uxi = i;
while (ex > ey) {
if (uxi >= uy) {
uxi -= uy;
++q;
}
uxi <<= 1;
q <<= 1;
--ex;
}
i = uxi - uy;
if (i >> 31 == 0) {
uxi = i;
if (uxi >= uy) {
uxi -= uy;
++q;
}
if (uxi == 0) ex = -30;

View File

@ -99,7 +99,7 @@
(local $3 i32)
(local $4 i32)
(block $folding-inner0
(set_local $3
(set_local $2
(i32.and
(i32.shr_u
(tee_local $1
@ -120,20 +120,20 @@
)
(if
(i32.eqz
(tee_local $2
(tee_local $3
(i32.eq
(get_local $3)
(get_local $2)
(i32.const 255)
)
)
)
(set_local $2
(set_local $3
(i32.const 0)
)
)
(if
(i32.and
(get_local $2)
(get_local $3)
(i32.const 1)
)
(return
@ -145,7 +145,7 @@
)
(if
(i32.le_u
(tee_local $2
(tee_local $3
(i32.shl
(get_local $1)
(i32.const 1)
@ -156,7 +156,7 @@
(block
(br_if $folding-inner0
(i32.eq
(get_local $2)
(get_local $3)
(i32.const 2130706432)
)
)
@ -167,7 +167,7 @@
)
(set_local $1
(if (result i32)
(get_local $3)
(get_local $2)
(i32.or
(i32.and
(get_local $1)
@ -179,9 +179,9 @@
(get_local $1)
(i32.sub
(i32.const 1)
(tee_local $3
(tee_local $2
(i32.sub
(get_local $3)
(get_local $2)
(i32.clz
(i32.shl
(get_local $1)
@ -194,79 +194,73 @@
)
)
)
(block $break|0
(loop $repeat|0
(br_if $break|0
(i32.le_s
(get_local $3)
(i32.const 127)
)
(loop $continue|0
(if
(i32.gt_s
(get_local $2)
(i32.const 127)
)
(if
(i32.eqz
(i32.shr_u
(tee_local $2
(block
(if
(i32.ge_u
(get_local $1)
(i32.const 8388608)
)
(block
(br_if $folding-inner0
(i32.eq
(get_local $1)
(i32.const 8388608)
)
)
(set_local $1
(i32.sub
(get_local $1)
(i32.const 8388608)
)
)
(i32.const 31)
)
)
(block
(br_if $folding-inner0
(i32.eqz
(get_local $2)
)
(set_local $1
(i32.shl
(get_local $1)
(i32.const 1)
)
(set_local $1
)
(set_local $2
(i32.sub
(get_local $2)
(i32.const 1)
)
)
(br $continue|0)
)
(set_local $1
(i32.shl
(get_local $1)
(i32.const 1)
)
)
(set_local $3
(i32.sub
(get_local $3)
(i32.const 1)
)
)
(br $repeat|0)
)
)
(if
(i32.eqz
(i32.shr_u
(tee_local $2
(i32.sub
(get_local $1)
(i32.const 8388608)
)
)
(i32.const 31)
)
(i32.ge_u
(get_local $1)
(i32.const 8388608)
)
(block
(br_if $folding-inner0
(i32.eqz
(get_local $2)
(i32.eq
(get_local $1)
(i32.const 8388608)
)
)
(set_local $1
(get_local $2)
(i32.sub
(get_local $1)
(i32.const 8388608)
)
)
)
)
(set_local $1
(i32.shl
(get_local $1)
(tee_local $2
(tee_local $3
(i32.clz
(i32.shl
(get_local $1)
@ -282,10 +276,10 @@
(tee_local $1
(if (result i32)
(i32.gt_s
(tee_local $3
(tee_local $2
(i32.sub
(get_local $3)
(get_local $2)
(get_local $3)
)
)
(i32.const 0)
@ -296,7 +290,7 @@
(i32.const 8388608)
)
(i32.shl
(get_local $3)
(get_local $2)
(i32.const 23)
)
)
@ -304,7 +298,7 @@
(get_local $1)
(i32.sub
(i32.const 1)
(get_local $3)
(get_local $2)
)
)
)
@ -459,72 +453,66 @@
)
)
)
(block $break|0
(loop $repeat|0
(br_if $break|0
(i64.le_s
(get_local $2)
(i64.const 1023)
)
(loop $continue|0
(if
(i64.gt_s
(get_local $2)
(i64.const 1023)
)
(if
(i64.eqz
(i64.shr_u
(tee_local $3
(block
(if
(i64.ge_u
(get_local $1)
(i64.const 4503599627370496)
)
(block
(br_if $folding-inner0
(i64.eq
(get_local $1)
(i64.const 4503599627370496)
)
)
(set_local $1
(i64.sub
(get_local $1)
(i64.const 4503599627370496)
)
)
(i64.const 63)
)
)
(block
(br_if $folding-inner0
(i64.eqz
(get_local $3)
)
)
(set_local $1
(get_local $3)
(set_local $1
(i64.shl
(get_local $1)
(i64.const 1)
)
)
)
(set_local $1
(i64.shl
(get_local $1)
(i64.const 1)
(set_local $2
(i64.sub
(get_local $2)
(i64.const 1)
)
)
(br $continue|0)
)
(set_local $2
(i64.sub
(get_local $2)
(i64.const 1)
)
)
(br $repeat|0)
)
)
(if
(i64.eqz
(i64.shr_u
(tee_local $3
(i64.sub
(get_local $1)
(i64.const 4503599627370496)
)
)
(i64.const 63)
)
(i64.ge_u
(get_local $1)
(i64.const 4503599627370496)
)
(block
(br_if $folding-inner0
(i64.eqz
(get_local $3)
(i64.eq
(get_local $1)
(i64.const 4503599627370496)
)
)
(set_local $1
(get_local $3)
(i64.sub
(get_local $1)
(i64.const 4503599627370496)
)
)
)
)

View File

@ -1697,7 +1697,6 @@
(local $8 i32)
(local $9 i32)
(local $10 i32)
(local $11 i32)
(set_local $2
(i32.reinterpret/f32
(get_local $0)
@ -1909,79 +1908,68 @@
)
)
(block $break|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.gt_s
(get_local $4)
(get_local $5)
)
(loop $continue|0
(if
(i32.gt_s
(get_local $4)
(get_local $5)
)
)
(block
(set_local $10
(i32.sub
(get_local $2)
(get_local $3)
)
)
(if
(i32.eqz
(i32.shr_u
(get_local $10)
(i32.const 31)
)
)
(block
(block
(if
(i32.eqz
(get_local $10)
(i32.ge_u
(get_local $2)
(get_local $3)
)
(return
(f32.mul
(f32.const 0)
(get_local $0)
(block
(if
(i32.eq
(get_local $2)
(get_local $3)
)
(return
(f32.mul
(f32.const 0)
(get_local $0)
)
)
)
(set_local $2
(i32.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $2
(get_local $10)
(i32.shl
(get_local $2)
(i32.const 1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
)
)
(set_local $2
(i32.shl
(get_local $2)
(i32.const 1)
)
(br $continue|0)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(br $repeat|0)
)
)
(set_local $10
(i32.sub
(get_local $2)
(get_local $3)
)
)
(if
(i32.eqz
(i32.shr_u
(get_local $10)
(i32.const 31)
)
(i32.ge_u
(get_local $2)
(get_local $3)
)
(block
(if
(i32.eqz
(get_local $10)
(i32.eq
(get_local $2)
(get_local $3)
)
(return
(f32.mul
@ -1991,11 +1979,14 @@
)
)
(set_local $2
(get_local $10)
(i32.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $11
(set_local $10
(i32.clz
(i32.shl
(get_local $2)
@ -2006,13 +1997,13 @@
(set_local $4
(i32.sub
(get_local $4)
(get_local $11)
(get_local $10)
)
)
(set_local $2
(i32.shl
(get_local $2)
(get_local $11)
(get_local $10)
)
)
(if
@ -3525,7 +3516,6 @@
(local $8 i32)
(local $9 i64)
(local $10 i64)
(local $11 i64)
(set_local $2
(i64.reinterpret/f64
(get_local $0)
@ -3737,79 +3727,68 @@
)
)
(block $break|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i64.gt_s
(get_local $4)
(get_local $5)
)
(loop $continue|0
(if
(i64.gt_s
(get_local $4)
(get_local $5)
)
)
(block
(set_local $10
(i64.sub
(get_local $2)
(get_local $3)
)
)
(if
(i64.eqz
(i64.shr_u
(get_local $10)
(i64.const 63)
)
)
(block
(block
(if
(i64.eqz
(get_local $10)
(i64.ge_u
(get_local $2)
(get_local $3)
)
(return
(f64.mul
(f64.const 0)
(get_local $0)
(block
(if
(i64.eq
(get_local $2)
(get_local $3)
)
(return
(f64.mul
(f64.const 0)
(get_local $0)
)
)
)
(set_local $2
(i64.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $2
(get_local $10)
(i64.shl
(get_local $2)
(i64.const 1)
)
)
(set_local $4
(i64.sub
(get_local $4)
(i64.const 1)
)
)
)
)
(set_local $2
(i64.shl
(get_local $2)
(i64.const 1)
)
(br $continue|0)
)
)
(set_local $4
(i64.sub
(get_local $4)
(i64.const 1)
)
)
(br $repeat|0)
)
)
(set_local $10
(i64.sub
(get_local $2)
(get_local $3)
)
)
(if
(i64.eqz
(i64.shr_u
(get_local $10)
(i64.const 63)
)
(i64.ge_u
(get_local $2)
(get_local $3)
)
(block
(if
(i64.eqz
(get_local $10)
(i64.eq
(get_local $2)
(get_local $3)
)
(return
(f64.mul
@ -3819,11 +3798,14 @@
)
)
(set_local $2
(get_local $10)
(i64.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $11
(set_local $10
(i64.clz
(i64.shl
(get_local $2)
@ -3834,13 +3816,13 @@
(set_local $4
(i64.sub
(get_local $4)
(get_local $11)
(get_local $10)
)
)
(set_local $2
(i64.shl
(get_local $2)
(get_local $11)
(get_local $10)
)
)
(if

File diff suppressed because it is too large Load Diff

View File

@ -9715,7 +9715,6 @@
(local $8 i32)
(local $9 i64)
(local $10 i64)
(local $11 i64)
(set_local $2
(i64.reinterpret/f64
(get_local $0)
@ -9927,79 +9926,68 @@
)
)
(block $break|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i64.gt_s
(get_local $4)
(get_local $5)
)
(loop $continue|0
(if
(i64.gt_s
(get_local $4)
(get_local $5)
)
)
(block
(set_local $10
(i64.sub
(get_local $2)
(get_local $3)
)
)
(if
(i64.eqz
(i64.shr_u
(get_local $10)
(i64.const 63)
)
)
(block
(block
(if
(i64.eqz
(get_local $10)
(i64.ge_u
(get_local $2)
(get_local $3)
)
(return
(f64.mul
(f64.const 0)
(get_local $0)
(block
(if
(i64.eq
(get_local $2)
(get_local $3)
)
(return
(f64.mul
(f64.const 0)
(get_local $0)
)
)
)
(set_local $2
(i64.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $2
(get_local $10)
(i64.shl
(get_local $2)
(i64.const 1)
)
)
(set_local $4
(i64.sub
(get_local $4)
(i64.const 1)
)
)
)
)
(set_local $2
(i64.shl
(get_local $2)
(i64.const 1)
)
(br $continue|0)
)
)
(set_local $4
(i64.sub
(get_local $4)
(i64.const 1)
)
)
(br $repeat|0)
)
)
(set_local $10
(i64.sub
(get_local $2)
(get_local $3)
)
)
(if
(i64.eqz
(i64.shr_u
(get_local $10)
(i64.const 63)
)
(i64.ge_u
(get_local $2)
(get_local $3)
)
(block
(if
(i64.eqz
(get_local $10)
(i64.eq
(get_local $2)
(get_local $3)
)
(return
(f64.mul
@ -10009,11 +9997,14 @@
)
)
(set_local $2
(get_local $10)
(i64.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $11
(set_local $10
(i64.clz
(i64.shl
(get_local $2)
@ -10024,13 +10015,13 @@
(set_local $4
(i64.sub
(get_local $4)
(get_local $11)
(get_local $10)
)
)
(set_local $2
(i64.shl
(get_local $2)
(get_local $11)
(get_local $10)
)
)
(if
@ -10128,7 +10119,6 @@
(local $8 i32)
(local $9 i32)
(local $10 i32)
(local $11 i32)
(set_local $2
(i32.reinterpret/f32
(get_local $0)
@ -10340,79 +10330,68 @@
)
)
(block $break|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.gt_s
(get_local $4)
(get_local $5)
)
(loop $continue|0
(if
(i32.gt_s
(get_local $4)
(get_local $5)
)
)
(block
(set_local $10
(i32.sub
(get_local $2)
(get_local $3)
)
)
(if
(i32.eqz
(i32.shr_u
(get_local $10)
(i32.const 31)
)
)
(block
(block
(if
(i32.eqz
(get_local $10)
(i32.ge_u
(get_local $2)
(get_local $3)
)
(return
(f32.mul
(f32.const 0)
(get_local $0)
(block
(if
(i32.eq
(get_local $2)
(get_local $3)
)
(return
(f32.mul
(f32.const 0)
(get_local $0)
)
)
)
(set_local $2
(i32.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $2
(get_local $10)
(i32.shl
(get_local $2)
(i32.const 1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
)
)
(set_local $2
(i32.shl
(get_local $2)
(i32.const 1)
)
(br $continue|0)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(br $repeat|0)
)
)
(set_local $10
(i32.sub
(get_local $2)
(get_local $3)
)
)
(if
(i32.eqz
(i32.shr_u
(get_local $10)
(i32.const 31)
)
(i32.ge_u
(get_local $2)
(get_local $3)
)
(block
(if
(i32.eqz
(get_local $10)
(i32.eq
(get_local $2)
(get_local $3)
)
(return
(f32.mul
@ -10422,11 +10401,14 @@
)
)
(set_local $2
(get_local $10)
(i32.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $11
(set_local $10
(i32.clz
(i32.shl
(get_local $2)
@ -10437,13 +10419,13 @@
(set_local $4
(i32.sub
(get_local $4)
(get_local $11)
(get_local $10)
)
)
(set_local $2
(i32.shl
(get_local $2)
(get_local $11)
(get_local $10)
)
)
(if
@ -13633,7 +13615,7 @@
(call $~lib/env/abort
(i32.const 0)
(i32.const 40)
(i32.const 2022)
(i32.const 2018)
(i32.const 24)
)
(unreachable)
@ -13820,8 +13802,7 @@
(local $8 i64)
(local $9 i32)
(local $10 i64)
(local $11 i64)
(local $12 f64)
(local $11 f64)
(set_local $2
(i64.reinterpret/f64
(get_local $0)
@ -14038,81 +14019,69 @@
)
)
(block $break|1
(loop $repeat|1
(br_if $break|1
(i32.eqz
(i64.gt_s
(get_local $4)
(get_local $5)
)
(loop $continue|1
(if
(i64.gt_s
(get_local $4)
(get_local $5)
)
)
(block
(set_local $10
(i64.sub
(get_local $8)
(get_local $3)
)
)
(if
(i64.eq
(i64.shr_u
(get_local $10)
(i64.const 63)
)
(i64.const 0)
)
(block
(block
(if
(i64.ge_u
(get_local $8)
(get_local $3)
)
(block
(set_local $8
(i64.sub
(get_local $8)
(get_local $3)
)
)
(set_local $9
(i32.add
(get_local $9)
(i32.const 1)
)
)
)
)
(set_local $8
(get_local $10)
(i64.shl
(get_local $8)
(i64.const 1)
)
)
(set_local $9
(i32.add
(i32.shl
(get_local $9)
(i32.const 1)
)
)
(set_local $4
(i64.sub
(get_local $4)
(i64.const 1)
)
)
)
)
(set_local $8
(i64.shl
(get_local $8)
(i64.const 1)
)
)
(set_local $9
(i32.shl
(get_local $9)
(i32.const 1)
)
(br $continue|1)
)
)
(set_local $4
(i64.sub
(get_local $4)
(i64.const 1)
)
)
(br $repeat|1)
)
)
(set_local $10
(i64.sub
(get_local $8)
(get_local $3)
)
)
(if
(i64.eq
(i64.shr_u
(get_local $10)
(i64.const 63)
)
(i64.const 0)
(i64.ge_u
(get_local $8)
(get_local $3)
)
(block
(set_local $8
(get_local $10)
(i64.sub
(get_local $8)
(get_local $3)
)
)
(set_local $9
(i32.add
@ -14131,7 +14100,7 @@
(i64.const -60)
)
(block
(set_local $11
(set_local $10
(i64.clz
(i64.shl
(get_local $8)
@ -14142,13 +14111,13 @@
(set_local $4
(i64.sub
(get_local $4)
(get_local $11)
(get_local $10)
)
)
(set_local $8
(i64.shl
(get_local $8)
(get_local $11)
(get_local $10)
)
)
)
@ -14205,7 +14174,7 @@
(get_local $1)
)
)
(set_local $12
(set_local $11
(f64.add
(get_local $0)
(get_local $0)
@ -14233,7 +14202,7 @@
(if (result i32)
(tee_local $7
(f64.gt
(get_local $12)
(get_local $11)
(get_local $1)
)
)
@ -14241,7 +14210,7 @@
(if (result i32)
(tee_local $7
(f64.eq
(get_local $12)
(get_local $11)
(get_local $1)
)
)
@ -14290,8 +14259,7 @@
(local $7 i32)
(local $8 i32)
(local $9 i32)
(local $10 i32)
(local $11 f32)
(local $10 f32)
(set_local $2
(i32.reinterpret/f32
(get_local $0)
@ -14506,81 +14474,69 @@
)
)
(block $break|1
(loop $repeat|1
(br_if $break|1
(i32.eqz
(i32.gt_s
(get_local $4)
(get_local $5)
)
(loop $continue|1
(if
(i32.gt_s
(get_local $4)
(get_local $5)
)
)
(block
(set_local $8
(i32.sub
(get_local $7)
(get_local $3)
)
)
(if
(i32.eq
(i32.shr_u
(get_local $8)
(i32.const 31)
)
(i32.const 0)
)
(block
(block
(if
(i32.ge_u
(get_local $7)
(get_local $3)
)
(block
(set_local $7
(i32.sub
(get_local $7)
(get_local $3)
)
)
(set_local $9
(i32.add
(get_local $9)
(i32.const 1)
)
)
)
)
(set_local $7
(get_local $8)
(i32.shl
(get_local $7)
(i32.const 1)
)
)
(set_local $9
(i32.add
(i32.shl
(get_local $9)
(i32.const 1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
)
)
(set_local $7
(i32.shl
(get_local $7)
(i32.const 1)
)
)
(set_local $9
(i32.shl
(get_local $9)
(i32.const 1)
)
(br $continue|1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(br $repeat|1)
)
)
(set_local $8
(i32.sub
(get_local $7)
(get_local $3)
)
)
(if
(i32.eq
(i32.shr_u
(get_local $8)
(i32.const 31)
)
(i32.const 0)
(i32.ge_u
(get_local $7)
(get_local $3)
)
(block
(set_local $7
(get_local $8)
(i32.sub
(get_local $7)
(get_local $3)
)
)
(set_local $9
(i32.add
@ -14599,7 +14555,7 @@
(i32.const -30)
)
(block
(set_local $10
(set_local $8
(i32.clz
(i32.shl
(get_local $7)
@ -14610,13 +14566,13 @@
(set_local $4
(i32.sub
(get_local $4)
(get_local $10)
(get_local $8)
)
)
(set_local $7
(i32.shl
(get_local $7)
(get_local $10)
(get_local $8)
)
)
)
@ -14673,7 +14629,7 @@
(get_local $1)
)
)
(set_local $11
(set_local $10
(f32.add
(get_local $0)
(get_local $0)
@ -14701,7 +14657,7 @@
(if (result i32)
(tee_local $8
(f32.gt
(get_local $11)
(get_local $10)
(get_local $1)
)
)
@ -14709,7 +14665,7 @@
(if (result i32)
(tee_local $8
(f32.eq
(get_local $11)
(get_local $10)
(get_local $1)
)
)

View File

@ -24,12 +24,12 @@
(local $3 i64)
(local $4 i64)
(local $5 i64)
(local $6 i64)
(local $7 i32)
(local $6 i32)
(local $7 i64)
(local $8 i64)
(local $9 i64)
(block $folding-inner0
(set_local $3
(set_local $4
(i64.and
(i64.shr_u
(tee_local $2
@ -42,10 +42,10 @@
(i64.const 2047)
)
)
(set_local $6
(set_local $5
(i64.and
(i64.shr_u
(tee_local $5
(tee_local $3
(i64.reinterpret/f64
(get_local $1)
)
@ -63,11 +63,11 @@
)
(if
(i32.eqz
(tee_local $7
(tee_local $6
(i64.eq
(tee_local $4
(tee_local $7
(i64.shl
(get_local $5)
(get_local $3)
(i64.const 1)
)
)
@ -75,18 +75,18 @@
)
)
)
(set_local $7
(set_local $6
(i64.eq
(get_local $3)
(get_local $4)
(i64.const 2047)
)
)
)
(if
(i32.eqz
(get_local $7)
(get_local $6)
)
(set_local $7
(set_local $6
(f64.ne
(get_local $1)
(get_local $1)
@ -94,7 +94,7 @@
)
)
(if
(get_local $7)
(get_local $6)
(return
(f64.div
(tee_local $0
@ -115,13 +115,13 @@
(i64.const 1)
)
)
(get_local $4)
(get_local $7)
)
(block
(br_if $folding-inner0
(i64.eq
(get_local $9)
(get_local $4)
(get_local $7)
)
)
(return
@ -132,16 +132,16 @@
(set_local $2
(if (result i64)
(i64.eqz
(get_local $3)
(get_local $4)
)
(i64.shl
(get_local $2)
(i64.add
(i64.sub
(i64.const 0)
(tee_local $3
(tee_local $4
(i64.sub
(get_local $3)
(get_local $4)
(i64.clz
(i64.shl
(get_local $2)
@ -163,22 +163,22 @@
)
)
)
(set_local $5
(set_local $3
(if (result i64)
(i64.eqz
(get_local $6)
(get_local $5)
)
(i64.shl
(get_local $5)
(get_local $3)
(i64.add
(i64.sub
(i64.const 0)
(tee_local $6
(tee_local $5
(i64.sub
(get_local $6)
(get_local $5)
(i64.clz
(i64.shl
(get_local $5)
(get_local $3)
(i64.const 12)
)
)
@ -190,86 +190,80 @@
)
(i64.or
(i64.and
(get_local $5)
(get_local $3)
(i64.const 4503599627370495)
)
(i64.const 4503599627370496)
)
)
)
(block $break|0
(loop $repeat|0
(br_if $break|0
(i64.le_s
(get_local $3)
(get_local $6)
)
(loop $continue|0
(if
(i64.gt_s
(get_local $4)
(get_local $5)
)
(if
(i64.eqz
(i64.shr_u
(tee_local $4
(i64.sub
(block
(if
(i64.ge_u
(get_local $2)
(get_local $3)
)
(block
(br_if $folding-inner0
(i64.eq
(get_local $2)
(get_local $5)
(get_local $3)
)
)
(i64.const 63)
)
)
(block
(br_if $folding-inner0
(i64.eqz
(get_local $4)
(set_local $2
(i64.sub
(get_local $2)
(get_local $3)
)
)
)
(set_local $2
(get_local $4)
)
(set_local $2
(i64.shl
(get_local $2)
(i64.const 1)
)
)
)
(set_local $2
(i64.shl
(get_local $2)
(i64.const 1)
(set_local $4
(i64.sub
(get_local $4)
(i64.const 1)
)
)
(br $continue|0)
)
(set_local $3
(i64.sub
(get_local $3)
(i64.const 1)
)
)
(br $repeat|0)
)
)
(if
(i64.eqz
(i64.shr_u
(tee_local $4
(i64.sub
(get_local $2)
(get_local $5)
)
)
(i64.const 63)
)
(i64.ge_u
(get_local $2)
(get_local $3)
)
(block
(br_if $folding-inner0
(i64.eqz
(get_local $4)
(i64.eq
(get_local $2)
(get_local $3)
)
)
(set_local $2
(get_local $4)
(i64.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $2
(i64.shl
(get_local $2)
(tee_local $4
(tee_local $3
(i64.clz
(i64.shl
(get_local $2)
@ -285,10 +279,10 @@
(tee_local $2
(if (result i64)
(i64.gt_s
(tee_local $3
(tee_local $4
(i64.sub
(get_local $3)
(get_local $4)
(get_local $3)
)
)
(i64.const 0)
@ -299,7 +293,7 @@
(i64.const 4503599627370496)
)
(i64.shl
(get_local $3)
(get_local $4)
(i64.const 52)
)
)
@ -308,7 +302,7 @@
(i64.add
(i64.sub
(i64.const 0)
(get_local $3)
(get_local $4)
)
(i64.const 1)
)
@ -403,7 +397,7 @@
(local $7 i32)
(local $8 i32)
(block $folding-inner0
(set_local $4
(set_local $3
(i32.and
(i32.shr_u
(tee_local $2
@ -419,7 +413,7 @@
(set_local $6
(i32.and
(i32.shr_u
(tee_local $5
(tee_local $4
(i32.reinterpret/f32
(get_local $1)
)
@ -437,29 +431,29 @@
)
(if
(i32.eqz
(tee_local $3
(tee_local $5
(i32.eqz
(tee_local $7
(i32.shl
(get_local $5)
(get_local $4)
(i32.const 1)
)
)
)
)
)
(set_local $3
(set_local $5
(i32.eq
(get_local $4)
(get_local $3)
(i32.const 255)
)
)
)
(if
(i32.eqz
(get_local $3)
(get_local $5)
)
(set_local $3
(set_local $5
(f32.ne
(get_local $1)
(get_local $1)
@ -468,7 +462,7 @@
)
(if
(i32.and
(get_local $3)
(get_local $5)
(i32.const 1)
)
(return
@ -485,7 +479,7 @@
)
(if
(i32.le_u
(tee_local $3
(tee_local $5
(i32.shl
(get_local $2)
(i32.const 1)
@ -496,7 +490,7 @@
(block
(br_if $folding-inner0
(i32.eq
(get_local $3)
(get_local $5)
(get_local $7)
)
)
@ -507,7 +501,7 @@
)
(set_local $2
(if (result i32)
(get_local $4)
(get_local $3)
(i32.or
(i32.and
(get_local $2)
@ -519,9 +513,9 @@
(get_local $2)
(i32.sub
(i32.const 1)
(tee_local $4
(tee_local $3
(i32.sub
(get_local $4)
(get_local $3)
(i32.clz
(i32.shl
(get_local $2)
@ -534,18 +528,18 @@
)
)
)
(set_local $5
(set_local $4
(if (result i32)
(get_local $6)
(i32.or
(i32.and
(get_local $5)
(get_local $4)
(i32.const 8388607)
)
(i32.const 8388608)
)
(i32.shl
(get_local $5)
(get_local $4)
(i32.sub
(i32.const 1)
(tee_local $6
@ -553,7 +547,7 @@
(get_local $6)
(i32.clz
(i32.shl
(get_local $5)
(get_local $4)
(i32.const 9)
)
)
@ -563,79 +557,73 @@
)
)
)
(block $break|0
(loop $repeat|0
(br_if $break|0
(i32.le_s
(get_local $4)
(get_local $6)
)
(loop $continue|0
(if
(i32.gt_s
(get_local $3)
(get_local $6)
)
(if
(i32.eqz
(i32.shr_u
(tee_local $3
(i32.sub
(block
(if
(i32.ge_u
(get_local $2)
(get_local $4)
)
(block
(br_if $folding-inner0
(i32.eq
(get_local $2)
(get_local $5)
(get_local $4)
)
)
(i32.const 31)
)
)
(block
(br_if $folding-inner0
(i32.eqz
(get_local $3)
(set_local $2
(i32.sub
(get_local $2)
(get_local $4)
)
)
)
(set_local $2
(get_local $3)
)
(set_local $2
(i32.shl
(get_local $2)
(i32.const 1)
)
)
)
(set_local $2
(i32.shl
(get_local $2)
(i32.const 1)
(set_local $3
(i32.sub
(get_local $3)
(i32.const 1)
)
)
(br $continue|0)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(br $repeat|0)
)
)
(if
(i32.eqz
(i32.shr_u
(tee_local $3
(i32.sub
(get_local $2)
(get_local $5)
)
)
(i32.const 31)
)
(i32.ge_u
(get_local $2)
(get_local $4)
)
(block
(br_if $folding-inner0
(i32.eqz
(get_local $3)
(i32.eq
(get_local $2)
(get_local $4)
)
)
(set_local $2
(get_local $3)
(i32.sub
(get_local $2)
(get_local $4)
)
)
)
)
(set_local $2
(i32.shl
(get_local $2)
(tee_local $3
(tee_local $5
(i32.clz
(i32.shl
(get_local $2)
@ -651,10 +639,10 @@
(tee_local $2
(if (result i32)
(i32.gt_s
(tee_local $4
(tee_local $3
(i32.sub
(get_local $4)
(get_local $3)
(get_local $5)
)
)
(i32.const 0)
@ -665,7 +653,7 @@
(i32.const 8388608)
)
(i32.shl
(get_local $4)
(get_local $3)
(i32.const 23)
)
)
@ -673,7 +661,7 @@
(get_local $2)
(i32.sub
(i32.const 1)
(get_local $4)
(get_local $3)
)
)
)

View File

@ -33,7 +33,6 @@
(local $8 i32)
(local $9 i64)
(local $10 i64)
(local $11 i64)
(set_local $2
(i64.reinterpret/f64
(get_local $0)
@ -245,79 +244,68 @@
)
)
(block $break|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i64.gt_s
(get_local $4)
(get_local $5)
)
(loop $continue|0
(if
(i64.gt_s
(get_local $4)
(get_local $5)
)
)
(block
(set_local $10
(i64.sub
(get_local $2)
(get_local $3)
)
)
(if
(i64.eqz
(i64.shr_u
(get_local $10)
(i64.const 63)
)
)
(block
(block
(if
(i64.eqz
(get_local $10)
(i64.ge_u
(get_local $2)
(get_local $3)
)
(return
(f64.mul
(f64.const 0)
(get_local $0)
(block
(if
(i64.eq
(get_local $2)
(get_local $3)
)
(return
(f64.mul
(f64.const 0)
(get_local $0)
)
)
)
(set_local $2
(i64.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $2
(get_local $10)
(i64.shl
(get_local $2)
(i64.const 1)
)
)
(set_local $4
(i64.sub
(get_local $4)
(i64.const 1)
)
)
)
)
(set_local $2
(i64.shl
(get_local $2)
(i64.const 1)
)
(br $continue|0)
)
)
(set_local $4
(i64.sub
(get_local $4)
(i64.const 1)
)
)
(br $repeat|0)
)
)
(set_local $10
(i64.sub
(get_local $2)
(get_local $3)
)
)
(if
(i64.eqz
(i64.shr_u
(get_local $10)
(i64.const 63)
)
(i64.ge_u
(get_local $2)
(get_local $3)
)
(block
(if
(i64.eqz
(get_local $10)
(i64.eq
(get_local $2)
(get_local $3)
)
(return
(f64.mul
@ -327,11 +315,14 @@
)
)
(set_local $2
(get_local $10)
(i64.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $11
(set_local $10
(i64.clz
(i64.shl
(get_local $2)
@ -342,13 +333,13 @@
(set_local $4
(i64.sub
(get_local $4)
(get_local $11)
(get_local $10)
)
)
(set_local $2
(i64.shl
(get_local $2)
(get_local $11)
(get_local $10)
)
)
(if
@ -484,7 +475,6 @@
(local $8 i32)
(local $9 i32)
(local $10 i32)
(local $11 i32)
(set_local $2
(i32.reinterpret/f32
(get_local $0)
@ -696,79 +686,68 @@
)
)
(block $break|0
(loop $repeat|0
(br_if $break|0
(i32.eqz
(i32.gt_s
(get_local $4)
(get_local $5)
)
(loop $continue|0
(if
(i32.gt_s
(get_local $4)
(get_local $5)
)
)
(block
(set_local $10
(i32.sub
(get_local $2)
(get_local $3)
)
)
(if
(i32.eqz
(i32.shr_u
(get_local $10)
(i32.const 31)
)
)
(block
(block
(if
(i32.eqz
(get_local $10)
(i32.ge_u
(get_local $2)
(get_local $3)
)
(return
(f32.mul
(f32.const 0)
(get_local $0)
(block
(if
(i32.eq
(get_local $2)
(get_local $3)
)
(return
(f32.mul
(f32.const 0)
(get_local $0)
)
)
)
(set_local $2
(i32.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $2
(get_local $10)
(i32.shl
(get_local $2)
(i32.const 1)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
)
)
(set_local $2
(i32.shl
(get_local $2)
(i32.const 1)
)
(br $continue|0)
)
)
(set_local $4
(i32.sub
(get_local $4)
(i32.const 1)
)
)
(br $repeat|0)
)
)
(set_local $10
(i32.sub
(get_local $2)
(get_local $3)
)
)
(if
(i32.eqz
(i32.shr_u
(get_local $10)
(i32.const 31)
)
(i32.ge_u
(get_local $2)
(get_local $3)
)
(block
(if
(i32.eqz
(get_local $10)
(i32.eq
(get_local $2)
(get_local $3)
)
(return
(f32.mul
@ -778,11 +757,14 @@
)
)
(set_local $2
(get_local $10)
(i32.sub
(get_local $2)
(get_local $3)
)
)
)
)
(set_local $11
(set_local $10
(i32.clz
(i32.shl
(get_local $2)
@ -793,13 +775,13 @@
(set_local $4
(i32.sub
(get_local $4)
(get_local $11)
(get_local $10)
)
)
(set_local $2
(i32.shl
(get_local $2)
(get_local $11)
(get_local $10)
)
)
(if