diff --git a/std/assembly/math.ts b/std/assembly/math.ts index 5131fa42b9..6eb9479564 100644 --- a/std/assembly/math.ts +++ b/std/assembly/math.ts @@ -343,8 +343,7 @@ export namespace NativeMath { t = reinterpret((reinterpret(t) + 0x80000000) & 0xFFFFFFFFC0000000); var s = t * t; r = x / s; - var w = t + t; - r = (r - t) / (w + r); + r = (r - t) / (2 * t + r); t = t + t * r; return t; } @@ -402,10 +401,7 @@ export namespace NativeMath { hx &= 0x7FFFFFFF; if (hx >= 0x4086232B) { if (isNaN(x)) return x; - if (x > overflow) { - x *= Ox1p1023; - return x; - } + if (x > overflow) return x * Ox1p1023; if (x < underflow) return 0; } var hi: f64, lo: f64 = 0; @@ -819,8 +815,9 @@ export namespace NativeMath { if (iy >= 0x43400000) yisint = 2; else if (iy >= 0x3FF00000) { k = (iy >> 20) - 0x3FF; - let offset = select(52, 20, k > 20) - k; - let Ly = select(ly, iy, k > 20); + let kcond = k > 20; + let offset = select(52, 20, kcond) - k; + let Ly = select(ly, iy, kcond); let jj = Ly >> offset; if ((jj << offset) == Ly) yisint = 2 - (jj & 1); } @@ -842,19 +839,24 @@ export namespace NativeMath { } var ax = builtin_abs(x), z: f64; if (lx == 0) { - if (ix == 0x7FF00000 || ix == 0 || ix == 0x3FF00000) { + if (ix == 0 || ix == 0x7FF00000 || ix == 0x3FF00000) { z = ax; if (hy < 0) z = 1.0 / z; if (hx < 0) { - if (((ix - 0x3FF00000) | yisint) == 0) z = (z - z) / (z - z); - else if (yisint == 1) z = -z; + if (((ix - 0x3FF00000) | yisint) == 0) { + let d = z - z; + z = d / d; + } else if (yisint == 1) z = -z; } return z; } } var s = 1.0; if (hx < 0) { - if (yisint == 0) return (x - x) / (x - x); + if (yisint == 0) { + let d = x - x; + return d / d; + } if (yisint == 1) s = -1.0; } var t1: f64, t2: f64, p_h: f64, p_l: f64, r: f64, t: f64, u: f64, v: f64, w: f64; @@ -1105,7 +1107,10 @@ export namespace NativeMath { var ey = (uy >> 52 & 0x7FF); var sx = ux >> 63; var uy1 = uy << 1; - if (uy1 == 0 || ex == 0x7FF || isNaN(y)) return (x * y) / (x * y); + if (uy1 == 0 || ex == 0x7FF || isNaN(y)) { + let m = x * y; + return m / m; + } var ux1 = ux << 1; if (ux1 <= uy1) { if (ux1 == uy1) return 0 * x; @@ -1157,7 +1162,10 @@ export namespace NativeMath { var ex = (ux >> 52 & 0x7FF); var ey = (uy >> 52 & 0x7FF); var sx = (ux >> 63); - if (uy << 1 == 0 || ex == 0x7FF || isNaN(y)) return (x * y) / (x * y); + if (uy << 1 == 0 || ex == 0x7FF || isNaN(y)) { + let m = x * y; + return m / m; + } if (ux << 1 == 0) return x; var uxi = ux; if (!ex) { @@ -1236,7 +1244,7 @@ function expo2f(x: f32): f32 { // exp(x)/2 for x >= log(DBL_MAX) const // see: musl/src/math/__expo2f.c k = 235, kln2 = reinterpret(0x4322E3BC); // 0x1.45c778p+7f - var scale = reinterpret((0x7F + k / 2) << 23); + var scale = reinterpret((0x7F + (k >> 1)) << 23); return NativeMathf.exp(x - kln2) * scale * scale; } @@ -1424,7 +1432,7 @@ export namespace NativeMathf { if (iy == 0) { switch (m) { case 0: - case 1: return y; + case 1: return y; case 2: return pi; case 3: return -pi; } @@ -1538,12 +1546,8 @@ export namespace NativeMathf { hx &= 0x7FFFFFFF; if (hx >= 0x42AEAC50) { if (hx >= 0x42B17218) { - if (!sign_) { - x *= Ox1p127f; - return x; - } else { - if (hx >= 0x42CFF1B5) return 0; - } + if (!sign_) return x * Ox1p127f; + else if (hx >= 0x42CFF1B5) return 0; } } var hi: f32, lo: f32; @@ -1889,8 +1893,9 @@ export namespace NativeMathf { if (iy >= 0x4B800000) yisint = 2; else if (iy >= 0x3F800000) { k = (iy >> 23) - 0x7F; - j = iy >> (23 - k); - if ((j << (23 - k)) == iy) yisint = 2 - (j & 1); + let ki = 23 - k; + j = iy >> ki; + if ((j << ki) == iy) yisint = 2 - (j & 1); } } if (iy == 0x7F800000) { // y is +-inf @@ -1909,14 +1914,20 @@ export namespace NativeMathf { z = ax; if (hy < 0) z = 1.0 / z; if (hx < 0) { - if (((ix - 0x3F800000) | yisint) == 0) z = (z - z) / (z - z); + if (((ix - 0x3F800000) | yisint) == 0) { + let d = z - z; + z = d / d; + } else if (yisint == 1) z = -z; } return z; } var sn = 1.0; if (hx < 0) { - if (yisint == 0) return (x - x) / (x - x); + if (yisint == 0) { + let d = x - x; + return d / d; + } if (yisint == 1) sn = -1.0; } var t1: f32, t2: f32, r: f32, s: f32, t: f32, u: f32, v: f32, w: f32, p_h: f32, p_l: f32; @@ -2159,7 +2170,10 @@ export namespace NativeMathf { var ey = (uy >> 23 & 0xFF); var sx = ux & 0x80000000; var uy1 = uy << 1; - if (uy1 == 0 || ex == 0xFF || isNaN(y)) return (x * y) / (x * y); + if (uy1 == 0 || ex == 0xFF || isNaN(y)) { + let m = x * y; + return m / m; + } var ux1 = ux << 1; if (ux1 <= uy1) { if (ux1 == uy1) return 0 * x; @@ -2380,3 +2394,27 @@ export function ipow64(x: i64, e: i32): i64 { } return out; } + +export function ipow32f(x: f32, e: i32): f32 { + var sign = e >> 31; + e = (e + sign) ^ sign; // abs(e) + var out: f32 = 1; + while (e) { + out *= select(x, 1.0, e & 1); + e >>= 1; + x *= x; + } + return sign ? 1.0 / out : out; +} + +export function ipow64f(x: f64, e: i32): f64 { + var sign = e >> 31; + e = (e + sign) ^ sign; // abs(e) + var out = 1.0; + while (e) { + out *= select(x, 1.0, e & 1); + e >>= 1; + x *= x; + } + return sign ? 1.0 / out : out; +} diff --git a/tests/compiler/binary.untouched.wat b/tests/compiler/binary.untouched.wat index 6443b5070d..fac5baa417 100644 --- a/tests/compiler/binary.untouched.wat +++ b/tests/compiler/binary.untouched.wat @@ -121,7 +121,7 @@ (local $11 i32) (local $12 i32) (local $13 i32) - (local $14 f64) + (local $14 i32) (local $15 f64) (local $16 f64) (local $17 f64) @@ -133,10 +133,10 @@ (local $23 f64) (local $24 f64) (local $25 f64) - (local $26 i32) - (local $27 i32) - (local $28 f64) - (local $29 f64) + (local $26 f64) + (local $27 f64) + (local $28 i32) + (local $29 i32) (local $30 f64) (local $31 f64) (local $32 f64) @@ -147,7 +147,8 @@ (local $37 f64) (local $38 f64) (local $39 f64) - (local $40 i32) + (local $40 f64) + (local $41 i32) get_local $0 i64.reinterpret/f64 set_local $2 @@ -259,34 +260,34 @@ i32.const 1023 i32.sub set_local $11 - i32.const 52 - i32.const 20 get_local $11 i32.const 20 i32.gt_s + set_local $9 + i32.const 52 + i32.const 20 + get_local $9 select get_local $11 i32.sub - set_local $9 + set_local $12 get_local $6 get_local $8 - get_local $11 - i32.const 20 - i32.gt_s - select - set_local $12 - get_local $12 get_local $9 - i32.shr_s + select set_local $13 get_local $13 - get_local $9 - i32.shl get_local $12 + i32.shr_s + set_local $14 + get_local $14 + get_local $12 + i32.shl + get_local $13 i32.eq if i32.const 2 - get_local $13 + get_local $14 i32.const 1 i32.and i32.sub @@ -385,41 +386,41 @@ end get_local $0 f64.abs - set_local $14 + set_local $15 get_local $4 i32.const 0 i32.eq if get_local $7 - i32.const 2146435072 + i32.const 0 i32.eq - tee_local $13 + tee_local $14 if (result i32) - get_local $13 + get_local $14 else get_local $7 - i32.const 0 + i32.const 2146435072 i32.eq end - tee_local $13 + tee_local $14 if (result i32) - get_local $13 + get_local $14 else get_local $7 i32.const 1072693248 i32.eq end if - get_local $14 - set_local $15 + get_local $15 + set_local $16 get_local $5 i32.const 0 i32.lt_s if f64.const 1 - get_local $15 + get_local $16 f64.div - set_local $15 + set_local $16 end get_local $3 i32.const 0 @@ -433,31 +434,31 @@ i32.const 0 i32.eq if - get_local $15 - get_local $15 - f64.sub - get_local $15 - get_local $15 + get_local $16 + get_local $16 f64.sub + set_local $17 + get_local $17 + get_local $17 f64.div - set_local $15 + set_local $16 else get_local $10 i32.const 1 i32.eq if - get_local $15 + get_local $16 f64.neg - set_local $15 + set_local $16 end end end - get_local $15 + get_local $16 return end end f64.const 1 - set_local $16 + set_local $18 get_local $3 i32.const 0 i32.lt_s @@ -469,9 +470,9 @@ get_local $0 get_local $0 f64.sub - get_local $0 - get_local $0 - f64.sub + set_local $17 + get_local $17 + get_local $17 f64.div return end @@ -480,7 +481,7 @@ i32.eq if f64.const -1 - set_local $16 + set_local $18 end end get_local $8 @@ -536,13 +537,13 @@ i32.const 0 i32.lt_s if (result f64) - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -558,13 +559,13 @@ i32.const 0 i32.gt_s if (result f64) - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -572,98 +573,98 @@ end return end - get_local $14 + get_local $15 f64.const 1 f64.sub - set_local $22 - get_local $22 - get_local $22 + set_local $24 + get_local $24 + get_local $24 f64.mul f64.const 0.5 - get_local $22 + get_local $24 f64.const 0.3333333333333333 - get_local $22 + get_local $24 f64.const 0.25 f64.mul f64.sub f64.mul f64.sub f64.mul - set_local $25 + set_local $27 f64.const 1.4426950216293335 - get_local $22 + get_local $24 f64.mul - set_local $23 - get_local $22 + set_local $25 + get_local $24 f64.const 1.9259629911266175e-08 f64.mul - get_local $25 + get_local $27 f64.const 1.4426950408889634 f64.mul f64.sub - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.add - set_local $17 - get_local $17 + set_local $19 + get_local $19 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $17 - get_local $24 - get_local $17 - get_local $23 + set_local $19 + get_local $26 + get_local $19 + get_local $25 f64.sub f64.sub - set_local $18 + set_local $20 else i32.const 0 - set_local $27 + set_local $29 get_local $7 i32.const 1048576 i32.lt_s if - get_local $14 + get_local $15 f64.const 9007199254740992 f64.mul - set_local $14 - get_local $27 + set_local $15 + get_local $29 i32.const 53 i32.sub - set_local $27 - get_local $14 + set_local $29 + get_local $15 i64.reinterpret/f64 i64.const 32 i64.shr_u i32.wrap/i64 set_local $7 end - get_local $27 + get_local $29 get_local $7 i32.const 20 i32.shr_s i32.const 1023 i32.sub i32.add - set_local $27 + set_local $29 get_local $7 i32.const 1048575 i32.and - set_local $26 - get_local $26 + set_local $28 + get_local $28 i32.const 1072693248 i32.or set_local $7 - get_local $26 + get_local $28 i32.const 235662 i32.le_s if i32.const 0 set_local $11 else - get_local $26 + get_local $28 i32.const 767610 i32.lt_s if @@ -672,17 +673,17 @@ else i32.const 0 set_local $11 - get_local $27 + get_local $29 i32.const 1 i32.add - set_local $27 + set_local $29 get_local $7 i32.const 1048576 i32.sub set_local $7 end end - get_local $14 + get_local $15 i64.reinterpret/f64 i64.const 4294967295 i64.and @@ -692,34 +693,34 @@ i64.shl i64.or f64.reinterpret/i64 - set_local $14 + set_local $15 f64.const 1.5 f64.const 1 get_local $11 select - set_local $34 - get_local $14 - get_local $34 + set_local $35 + get_local $15 + get_local $35 f64.sub - set_local $23 + set_local $25 f64.const 1 - get_local $14 - get_local $34 + get_local $15 + get_local $35 f64.add f64.div - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.mul - set_local $28 - get_local $28 - set_local $30 - get_local $30 + set_local $17 + get_local $17 + set_local $31 + get_local $31 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $30 + set_local $31 get_local $7 i32.const 1 i32.shr_s @@ -735,42 +736,42 @@ i64.const 32 i64.shl f64.reinterpret/i64 - set_local $32 - get_local $14 - get_local $32 - get_local $34 + set_local $33 + get_local $15 + get_local $33 + get_local $35 f64.sub f64.sub - set_local $33 - get_local $24 - get_local $23 - get_local $30 - get_local $32 + set_local $34 + get_local $26 + get_local $25 + get_local $31 + get_local $33 f64.mul f64.sub - get_local $30 - get_local $33 + get_local $31 + get_local $34 f64.mul f64.sub f64.mul - set_local $31 - get_local $28 - get_local $28 + set_local $32 + get_local $17 + get_local $17 f64.mul - set_local $29 - get_local $29 - get_local $29 + set_local $30 + get_local $30 + get_local $30 f64.mul f64.const 0.5999999999999946 - get_local $29 + get_local $30 f64.const 0.4285714285785502 - get_local $29 + get_local $30 f64.const 0.33333332981837743 - get_local $29 + get_local $30 f64.const 0.272728123808534 - get_local $29 + get_local $30 f64.const 0.23066074577556175 - get_local $29 + get_local $30 f64.const 0.20697501780033842 f64.mul f64.add @@ -783,184 +784,184 @@ f64.mul f64.add f64.mul - set_local $21 - get_local $21 + set_local $23 + get_local $23 + get_local $32 get_local $31 - get_local $30 - get_local $28 + get_local $17 f64.add f64.mul f64.add - set_local $21 - get_local $30 - get_local $30 + set_local $23 + get_local $31 + get_local $31 f64.mul - set_local $29 + set_local $30 f64.const 3 - get_local $29 + get_local $30 f64.add - get_local $21 + get_local $23 f64.add - set_local $32 - get_local $32 + set_local $33 + get_local $33 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $32 - get_local $21 - get_local $32 + set_local $33 + get_local $23 + get_local $33 f64.const 3 f64.sub - get_local $29 + get_local $30 f64.sub f64.sub - set_local $33 - get_local $30 - get_local $32 - f64.mul - set_local $23 + set_local $34 get_local $31 - get_local $32 + get_local $33 f64.mul + set_local $25 + get_local $32 get_local $33 - get_local $28 + f64.mul + get_local $34 + get_local $17 f64.mul f64.add - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.add - set_local $19 - get_local $19 + set_local $21 + get_local $21 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $19 - get_local $24 - get_local $19 - get_local $23 + set_local $21 + get_local $26 + get_local $21 + get_local $25 f64.sub f64.sub - set_local $20 + set_local $22 f64.const 0.9617967009544373 - get_local $19 + get_local $21 f64.mul - set_local $35 + set_local $36 f64.const 1.350039202129749e-08 f64.const 0 get_local $11 select - set_local $36 + set_local $37 f64.const -7.028461650952758e-09 - get_local $19 + get_local $21 f64.mul - get_local $20 + get_local $22 f64.const 0.9617966939259756 f64.mul f64.add - get_local $36 + get_local $37 f64.add - set_local $37 - get_local $27 + set_local $38 + get_local $29 f64.convert_s/i32 - set_local $22 + set_local $24 f64.const 0.5849624872207642 f64.const 0 get_local $11 select - set_local $38 - get_local $35 - get_local $37 - f64.add + set_local $39 + get_local $36 get_local $38 f64.add - get_local $22 + get_local $39 f64.add - set_local $17 - get_local $17 + get_local $24 + f64.add + set_local $19 + get_local $19 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $17 - get_local $37 - get_local $17 - get_local $22 - f64.sub + set_local $19 get_local $38 + get_local $19 + get_local $24 f64.sub - get_local $35 + get_local $39 + f64.sub + get_local $36 f64.sub f64.sub - set_local $18 + set_local $20 end get_local $1 - set_local $39 - get_local $39 + set_local $40 + get_local $40 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $39 + set_local $40 get_local $1 - get_local $39 + get_local $40 f64.sub - get_local $17 + get_local $19 f64.mul get_local $1 - get_local $18 + get_local $20 f64.mul f64.add - set_local $20 - get_local $39 - get_local $17 - f64.mul - set_local $19 - get_local $20 + set_local $22 + get_local $40 get_local $19 + f64.mul + set_local $21 + get_local $22 + get_local $21 f64.add - set_local $15 - get_local $15 + set_local $16 + get_local $16 i64.reinterpret/f64 set_local $2 get_local $2 i64.const 32 i64.shr_u i32.wrap/i64 - set_local $26 + set_local $28 get_local $2 i32.wrap/i64 - set_local $40 - get_local $26 + set_local $41 + get_local $28 i32.const 1083179008 i32.ge_s if - get_local $26 + get_local $28 i32.const 1083179008 i32.sub - get_local $40 + get_local $41 i32.or i32.const 0 i32.ne if - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul return end - get_local $20 + get_local $22 f64.const 8.008566259537294e-17 f64.add - get_local $15 - get_local $19 + get_local $16 + get_local $21 f64.sub f64.gt if - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 @@ -968,34 +969,34 @@ return end else - get_local $26 + get_local $28 i32.const 2147483647 i32.and i32.const 1083231232 i32.ge_s if - get_local $26 + get_local $28 i32.const -1064252416 i32.sub - get_local $40 + get_local $41 i32.or i32.const 0 i32.ne if - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 f64.mul return end - get_local $20 - get_local $15 - get_local $19 + get_local $22 + get_local $16 + get_local $21 f64.sub f64.le if - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -1004,31 +1005,31 @@ end end end - get_local $26 + get_local $28 i32.const 2147483647 i32.and - set_local $40 - get_local $40 + set_local $41 + get_local $41 i32.const 20 i32.shr_s i32.const 1023 i32.sub set_local $11 i32.const 0 - set_local $27 - get_local $40 + set_local $29 + get_local $41 i32.const 1071644672 i32.gt_s if - get_local $26 + get_local $28 i32.const 1048576 get_local $11 i32.const 1 i32.add i32.shr_s i32.add - set_local $27 - get_local $27 + set_local $29 + get_local $29 i32.const 2147483647 i32.and i32.const 20 @@ -1037,8 +1038,8 @@ i32.sub set_local $11 f64.const 0 - set_local $22 - get_local $27 + set_local $24 + get_local $29 i32.const 1048575 get_local $11 i32.shr_s @@ -1049,8 +1050,8 @@ i64.const 32 i64.shl f64.reinterpret/i64 - set_local $22 - get_local $27 + set_local $24 + get_local $29 i32.const 1048575 i32.and i32.const 1048576 @@ -1059,71 +1060,71 @@ get_local $11 i32.sub i32.shr_s - set_local $27 - get_local $26 + set_local $29 + get_local $28 i32.const 0 i32.lt_s if i32.const 0 - get_local $27 + get_local $29 i32.sub - set_local $27 + set_local $29 end - get_local $19 - get_local $22 + get_local $21 + get_local $24 f64.sub - set_local $19 + set_local $21 end - get_local $20 - get_local $19 - f64.add - set_local $22 get_local $22 + get_local $21 + f64.add + set_local $24 + get_local $24 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $22 - get_local $22 + set_local $24 + get_local $24 f64.const 0.6931471824645996 f64.mul - set_local $23 - get_local $20 + set_local $25 get_local $22 - get_local $19 + get_local $24 + get_local $21 f64.sub f64.sub f64.const 0.6931471805599453 f64.mul - get_local $22 + get_local $24 f64.const -1.904654299957768e-09 f64.mul f64.add - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.add - set_local $15 - get_local $24 - get_local $15 - get_local $23 + set_local $16 + get_local $26 + get_local $16 + get_local $25 f64.sub f64.sub - set_local $25 - get_local $15 - get_local $15 + set_local $27 + get_local $16 + get_local $16 f64.mul - set_local $22 - get_local $15 - get_local $22 + set_local $24 + get_local $16 + get_local $24 f64.const 0.16666666666666602 - get_local $22 + get_local $24 f64.const -2.7777777777015593e-03 - get_local $22 + get_local $24 f64.const 6.613756321437934e-05 - get_local $22 + get_local $24 f64.const -1.6533902205465252e-06 - get_local $22 + get_local $24 f64.const 4.1381367970572385e-08 f64.mul f64.add @@ -1135,64 +1136,64 @@ f64.add f64.mul f64.sub - set_local $17 - get_local $15 - get_local $17 + set_local $19 + get_local $16 + get_local $19 f64.mul - get_local $17 + get_local $19 f64.const 2 f64.sub f64.div - get_local $25 - get_local $15 - get_local $25 + get_local $27 + get_local $16 + get_local $27 f64.mul f64.add f64.sub - set_local $21 + set_local $23 f64.const 1 - get_local $21 - get_local $15 + get_local $23 + get_local $16 f64.sub f64.sub - set_local $15 - get_local $15 + set_local $16 + get_local $16 i64.reinterpret/f64 i64.const 32 i64.shr_u i32.wrap/i64 - set_local $26 - get_local $26 - get_local $27 + set_local $28 + get_local $28 + get_local $29 i32.const 20 i32.shl i32.add - set_local $26 - get_local $26 + set_local $28 + get_local $28 i32.const 20 i32.shr_s i32.const 0 i32.le_s if - get_local $15 - get_local $27 + get_local $16 + get_local $29 call $~lib/math/NativeMath.scalbn - set_local $15 + set_local $16 else - get_local $15 + get_local $16 i64.reinterpret/f64 i64.const 4294967295 i64.and - get_local $26 + get_local $28 i64.extend_s/i32 i64.const 32 i64.shl i64.or f64.reinterpret/i64 - set_local $15 + set_local $16 end + get_local $18 get_local $16 - get_local $15 f64.mul ) (func $~lib/math/NativeMathf.mod (; 2 ;) (type $fff) (param $0 f32) (param $1 f32) (result f32) @@ -1203,8 +1204,9 @@ (local $6 i32) (local $7 i32) (local $8 i32) - (local $9 i32) + (local $9 f32) (local $10 i32) + (local $11 i32) get_local $0 i32.reinterpret/f32 set_local $2 @@ -1256,21 +1258,21 @@ get_local $0 get_local $1 f32.mul - get_local $0 - get_local $1 - f32.mul + set_local $9 + get_local $9 + get_local $9 f32.div return end get_local $2 i32.const 1 i32.shl - set_local $9 - get_local $9 + set_local $10 + get_local $10 get_local $7 i32.le_u if - get_local $9 + get_local $10 get_local $7 i32.eq if @@ -1406,13 +1408,13 @@ i32.const 8 i32.shl i32.clz - set_local $10 + set_local $11 get_local $4 - get_local $10 + get_local $11 i32.sub set_local $4 get_local $2 - get_local $10 + get_local $11 i32.shl set_local $2 get_local $4 @@ -1560,9 +1562,9 @@ (local $20 f32) (local $21 f32) (local $22 f32) - (local $23 i32) + (local $23 f32) (local $24 i32) - (local $25 f32) + (local $25 i32) (local $26 f32) (local $27 f32) (local $28 f32) @@ -1635,16 +1637,16 @@ i32.const 127 i32.sub set_local $9 - get_local $5 i32.const 23 get_local $9 i32.sub + set_local $6 + get_local $5 + get_local $6 i32.shr_s set_local $8 get_local $8 - i32.const 23 - get_local $9 - i32.sub + get_local $6 i32.shl get_local $5 i32.eq @@ -1787,9 +1789,9 @@ get_local $11 get_local $11 f32.sub - get_local $11 - get_local $11 - f32.sub + set_local $12 + get_local $12 + get_local $12 f32.div set_local $11 else @@ -1807,7 +1809,7 @@ return end f32.const 1 - set_local $12 + set_local $13 get_local $2 i32.const 0 i32.lt_s @@ -1819,9 +1821,9 @@ get_local $0 get_local $0 f32.sub - get_local $0 - get_local $0 - f32.sub + set_local $12 + get_local $12 + get_local $12 f32.div return end @@ -1830,7 +1832,7 @@ i32.eq if f32.const -1 - set_local $12 + set_local $13 end end get_local $5 @@ -1845,13 +1847,13 @@ i32.const 0 i32.lt_s if (result f32) - get_local $12 + get_local $13 f32.const 1000000015047466219876688e6 f32.mul f32.const 1000000015047466219876688e6 f32.mul else - get_local $12 + get_local $13 f32.const 1.0000000031710769e-30 f32.mul f32.const 1.0000000031710769e-30 @@ -1867,13 +1869,13 @@ i32.const 0 i32.gt_s if (result f32) - get_local $12 + get_local $13 f32.const 1000000015047466219876688e6 f32.mul f32.const 1000000015047466219876688e6 f32.mul else - get_local $12 + get_local $13 f32.const 1.0000000031710769e-30 f32.mul f32.const 1.0000000031710769e-30 @@ -1884,54 +1886,54 @@ get_local $10 f32.const 1 f32.sub - set_local $17 - get_local $17 - get_local $17 + set_local $18 + get_local $18 + get_local $18 f32.mul f32.const 0.5 - get_local $17 + get_local $18 f32.const 0.3333333432674408 - get_local $17 + get_local $18 f32.const 0.25 f32.mul f32.sub f32.mul f32.sub f32.mul - set_local $20 + set_local $21 f32.const 1.44268798828125 - get_local $17 + get_local $18 f32.mul - set_local $18 - get_local $17 + set_local $19 + get_local $18 f32.const 7.052607543300837e-06 f32.mul - get_local $20 + get_local $21 f32.const 1.4426950216293335 f32.mul f32.sub - set_local $19 - get_local $18 + set_local $20 get_local $19 + get_local $20 f32.add - set_local $13 - get_local $13 + set_local $14 + get_local $14 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -4096 i32.and f32.reinterpret/i32 - set_local $13 + set_local $14 + get_local $20 + get_local $14 get_local $19 - get_local $13 - get_local $18 f32.sub f32.sub - set_local $14 + set_local $15 else i32.const 0 - set_local $23 + set_local $24 get_local $4 i32.const 8388608 i32.lt_s @@ -1940,22 +1942,22 @@ f32.const 16777216 f32.mul set_local $10 - get_local $23 + get_local $24 i32.const 24 i32.sub - set_local $23 + set_local $24 get_local $10 i32.reinterpret/f32 set_local $4 end - get_local $23 + get_local $24 get_local $4 i32.const 23 i32.shr_s i32.const 127 i32.sub i32.add - set_local $23 + set_local $24 get_local $4 i32.const 8388607 i32.and @@ -1980,10 +1982,10 @@ else i32.const 0 set_local $9 - get_local $23 + get_local $24 i32.const 1 i32.add - set_local $23 + set_local $24 get_local $4 i32.const 8388608 i32.sub @@ -2001,23 +2003,23 @@ get_local $10 get_local $30 f32.sub - set_local $18 + set_local $19 f32.const 1 get_local $10 get_local $30 f32.add f32.div - set_local $19 - get_local $18 + set_local $20 get_local $19 + get_local $20 f32.mul - set_local $16 - get_local $16 + set_local $17 + get_local $17 set_local $26 get_local $26 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -4096 i32.and f32.reinterpret/i32 @@ -2029,8 +2031,8 @@ i32.and i32.const 536870912 i32.or - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const 4194304 i32.add get_local $9 @@ -2045,8 +2047,8 @@ f32.sub f32.sub set_local $29 + get_local $20 get_local $19 - get_local $18 get_local $26 get_local $28 f32.mul @@ -2057,23 +2059,23 @@ f32.sub f32.mul set_local $27 - get_local $16 - get_local $16 + get_local $17 + get_local $17 f32.mul - set_local $25 - get_local $25 - get_local $25 + set_local $12 + get_local $12 + get_local $12 f32.mul f32.const 0.6000000238418579 - get_local $25 + get_local $12 f32.const 0.4285714328289032 - get_local $25 + get_local $12 f32.const 0.3333333432674408 - get_local $25 + get_local $12 f32.const 0.2727281153202057 - get_local $25 + get_local $12 f32.const 0.23066075146198273 - get_local $25 + get_local $12 f32.const 0.20697501301765442 f32.mul f32.add @@ -2086,73 +2088,73 @@ f32.mul f32.add f32.mul - set_local $15 - get_local $15 + set_local $16 + get_local $16 get_local $27 get_local $26 - get_local $16 + get_local $17 f32.add f32.mul f32.add - set_local $15 + set_local $16 get_local $26 get_local $26 f32.mul - set_local $25 + set_local $12 f32.const 3 - get_local $25 + get_local $12 f32.add - get_local $15 + get_local $16 f32.add set_local $28 get_local $28 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -4096 i32.and f32.reinterpret/i32 set_local $28 - get_local $15 + get_local $16 get_local $28 f32.const 3 f32.sub - get_local $25 + get_local $12 f32.sub f32.sub set_local $29 get_local $26 get_local $28 f32.mul - set_local $18 + set_local $19 get_local $27 get_local $28 f32.mul get_local $29 - get_local $16 + get_local $17 f32.mul f32.add - set_local $19 - get_local $18 + set_local $20 get_local $19 + get_local $20 f32.add - set_local $21 - get_local $21 + set_local $22 + get_local $22 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -4096 i32.and f32.reinterpret/i32 - set_local $21 + set_local $22 + get_local $20 + get_local $22 get_local $19 - get_local $21 - get_local $18 f32.sub f32.sub - set_local $22 + set_local $23 f32.const 0.9619140625 - get_local $21 + get_local $22 f32.mul set_local $31 f32.const 1.5632208487659227e-06 @@ -2161,18 +2163,18 @@ select set_local $32 f32.const -1.1736857413779944e-04 - get_local $21 - f32.mul get_local $22 + f32.mul + get_local $23 f32.const 0.9617967009544373 f32.mul f32.add get_local $32 f32.add set_local $33 - get_local $23 + get_local $24 f32.convert_s/i32 - set_local $17 + set_local $18 f32.const 0.5849609375 f32.const 0 get_local $9 @@ -2183,32 +2185,32 @@ f32.add get_local $34 f32.add - get_local $17 + get_local $18 f32.add - set_local $13 - get_local $13 + set_local $14 + get_local $14 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -4096 i32.and f32.reinterpret/i32 - set_local $13 + set_local $14 get_local $33 - get_local $13 - get_local $17 + get_local $14 + get_local $18 f32.sub get_local $34 f32.sub get_local $31 f32.sub f32.sub - set_local $14 + set_local $15 end get_local $1 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -4096 i32.and f32.reinterpret/i32 @@ -2216,19 +2218,19 @@ get_local $1 get_local $35 f32.sub - get_local $13 + get_local $14 f32.mul get_local $1 - get_local $14 + get_local $15 f32.mul f32.add - set_local $22 + set_local $23 get_local $35 - get_local $13 + get_local $14 f32.mul - set_local $21 + set_local $22 + get_local $23 get_local $22 - get_local $21 f32.add set_local $11 get_local $11 @@ -2238,7 +2240,7 @@ i32.const 1124073472 i32.gt_s if - get_local $12 + get_local $13 f32.const 1000000015047466219876688e6 f32.mul f32.const 1000000015047466219876688e6 @@ -2249,15 +2251,15 @@ i32.const 1124073472 i32.eq if - get_local $22 + get_local $23 f32.const 4.299566569443414e-08 f32.add get_local $11 - get_local $21 + get_local $22 f32.sub f32.gt if - get_local $12 + get_local $13 f32.const 1000000015047466219876688e6 f32.mul f32.const 1000000015047466219876688e6 @@ -2271,7 +2273,7 @@ i32.const 1125515264 i32.gt_s if - get_local $12 + get_local $13 f32.const 1.0000000031710769e-30 f32.mul f32.const 1.0000000031710769e-30 @@ -2282,13 +2284,13 @@ i32.const -1021968384 i32.eq if - get_local $22 + get_local $23 get_local $11 - get_local $21 + get_local $22 f32.sub f32.le if - get_local $12 + get_local $13 f32.const 1.0000000031710769e-30 f32.mul f32.const 1.0000000031710769e-30 @@ -2310,7 +2312,7 @@ i32.sub set_local $9 i32.const 0 - set_local $23 + set_local $24 get_local $36 i32.const 1056964608 i32.gt_s @@ -2322,8 +2324,8 @@ i32.add i32.shr_s i32.add - set_local $23 - get_local $23 + set_local $24 + get_local $24 i32.const 2147483647 i32.and i32.const 23 @@ -2331,7 +2333,7 @@ i32.const 127 i32.sub set_local $9 - get_local $23 + get_local $24 i32.const 8388607 get_local $9 i32.shr_s @@ -2339,8 +2341,8 @@ i32.xor i32.and f32.reinterpret/i32 - set_local $17 - get_local $23 + set_local $18 + get_local $24 i32.const 8388607 i32.and i32.const 8388608 @@ -2349,73 +2351,73 @@ get_local $9 i32.sub i32.shr_s - set_local $23 + set_local $24 get_local $8 i32.const 0 i32.lt_s if i32.const 0 - get_local $23 + get_local $24 i32.sub - set_local $23 + set_local $24 end - get_local $21 - get_local $17 + get_local $22 + get_local $18 f32.sub - set_local $21 + set_local $22 end + get_local $23 get_local $22 - get_local $21 f32.add - set_local $17 - get_local $17 + set_local $18 + get_local $18 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -32768 i32.and f32.reinterpret/i32 - set_local $17 - get_local $17 + set_local $18 + get_local $18 f32.const 0.693145751953125 f32.mul - set_local $18 + set_local $19 + get_local $23 + get_local $18 get_local $22 - get_local $17 - get_local $21 f32.sub f32.sub f32.const 0.6931471824645996 f32.mul - get_local $17 + get_local $18 f32.const 1.4286065379565116e-06 f32.mul f32.add - set_local $19 - get_local $18 + set_local $20 get_local $19 + get_local $20 f32.add set_local $11 - get_local $19 + get_local $20 get_local $11 - get_local $18 + get_local $19 f32.sub f32.sub - set_local $20 + set_local $21 get_local $11 get_local $11 f32.mul - set_local $17 + set_local $18 get_local $11 - get_local $17 + get_local $18 f32.const 0.1666666716337204 - get_local $17 + get_local $18 f32.const -2.7777778450399637e-03 - get_local $17 + get_local $18 f32.const 6.61375597701408e-05 - get_local $17 + get_local $18 f32.const -1.6533901998627698e-06 - get_local $17 + get_local $18 f32.const 4.138136944220605e-08 f32.mul f32.add @@ -2427,23 +2429,23 @@ f32.add f32.mul f32.sub - set_local $13 + set_local $14 get_local $11 - get_local $13 + get_local $14 f32.mul - get_local $13 + get_local $14 f32.const 2 f32.sub f32.div - get_local $20 + get_local $21 get_local $11 - get_local $20 + get_local $21 f32.mul f32.add f32.sub - set_local $15 + set_local $16 f32.const 1 - get_local $15 + get_local $16 get_local $11 f32.sub f32.sub @@ -2452,7 +2454,7 @@ i32.reinterpret/f32 set_local $8 get_local $8 - get_local $23 + get_local $24 i32.const 23 i32.shl i32.add @@ -2464,7 +2466,7 @@ i32.le_s if get_local $11 - get_local $23 + get_local $24 call $~lib/math/NativeMathf.scalbn set_local $11 else @@ -2472,7 +2474,7 @@ f32.reinterpret/i32 set_local $11 end - get_local $12 + get_local $13 get_local $11 f32.mul ) @@ -2484,8 +2486,9 @@ (local $6 i64) (local $7 i64) (local $8 i32) - (local $9 i64) + (local $9 f64) (local $10 i64) + (local $11 i64) get_local $0 i64.reinterpret/f64 set_local $2 @@ -2537,21 +2540,21 @@ get_local $0 get_local $1 f64.mul - get_local $0 - get_local $1 - f64.mul + set_local $9 + get_local $9 + get_local $9 f64.div return end get_local $2 i64.const 1 i64.shl - set_local $9 - get_local $9 + set_local $10 + get_local $10 get_local $7 i64.le_u if - get_local $9 + get_local $10 get_local $7 i64.eq if @@ -2687,13 +2690,13 @@ i64.const 11 i64.shl i64.clz - set_local $10 + set_local $11 get_local $4 - get_local $10 + get_local $11 i64.sub set_local $4 get_local $2 - get_local $10 + get_local $11 i64.shl set_local $2 get_local $4 diff --git a/tests/compiler/std/array.optimized.wat b/tests/compiler/std/array.optimized.wat index a0c559ce31..1567e86885 100644 --- a/tests/compiler/std/array.optimized.wat +++ b/tests/compiler/std/array.optimized.wat @@ -3813,7 +3813,7 @@ if i32.const 0 i32.const 2816 - i32.const 970 + i32.const 972 i32.const 4 call $~lib/env/abort unreachable @@ -5479,7 +5479,7 @@ if i32.const 0 i32.const 2816 - i32.const 979 + i32.const 981 i32.const 24 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/array.untouched.wat b/tests/compiler/std/array.untouched.wat index 19d89fac2b..e9b2281109 100644 --- a/tests/compiler/std/array.untouched.wat +++ b/tests/compiler/std/array.untouched.wat @@ -5225,7 +5225,7 @@ if i32.const 0 i32.const 2816 - i32.const 970 + i32.const 972 i32.const 4 call $~lib/env/abort unreachable @@ -8241,7 +8241,7 @@ if i32.const 0 i32.const 2816 - i32.const 979 + i32.const 981 i32.const 24 call $~lib/env/abort unreachable diff --git a/tests/compiler/std/libm.optimized.wat b/tests/compiler/std/libm.optimized.wat index f78ccf2455..252633e651 100644 --- a/tests/compiler/std/libm.optimized.wat +++ b/tests/compiler/std/libm.optimized.wat @@ -1506,6 +1506,7 @@ f64.div f64.mul set_local $2 + get_local $0 get_local $1 f64.const 1.87595182427177 get_local $2 @@ -1538,18 +1539,16 @@ tee_local $1 get_local $1 f64.mul + f64.div set_local $2 get_local $1 get_local $1 - get_local $0 get_local $2 - f64.div - tee_local $2 get_local $1 f64.sub + f64.const 2 get_local $1 - get_local $1 - f64.add + f64.mul get_local $2 f64.add f64.div @@ -2840,19 +2839,20 @@ (local $5 i32) (local $6 f64) (local $7 i32) - (local $8 i32) - (local $9 f64) - (local $10 i32) - (local $11 f64) + (local $8 f64) + (local $9 i32) + (local $10 f64) + (local $11 i32) (local $12 i32) (local $13 i32) - (local $14 i32) - (local $15 f64) + (local $14 f64) + (local $15 i32) (local $16 f64) (local $17 i64) (local $18 i32) (local $19 f64) (local $20 i32) + (local $21 i32) get_local $0 i64.reinterpret/f64 tee_local $17 @@ -2866,7 +2866,7 @@ get_local $18 i32.const 2147483647 i32.and - set_local $4 + set_local $5 get_local $1 i64.reinterpret/f64 tee_local $17 @@ -2876,57 +2876,57 @@ tee_local $13 i32.const 2147483647 i32.and - set_local $12 - get_local $12 + set_local $11 + get_local $11 get_local $17 i32.wrap/i64 - tee_local $7 + tee_local $21 i32.or i32.eqz if f64.const 1 return end - get_local $4 + get_local $5 i32.const 2146435072 i32.gt_s - tee_local $8 + tee_local $4 i32.eqz if - get_local $4 + get_local $5 i32.const 2146435072 i32.eq - tee_local $8 + tee_local $4 if get_local $20 i32.const 0 i32.ne - set_local $8 + set_local $4 end end - get_local $8 + get_local $4 i32.eqz if - get_local $12 + get_local $11 i32.const 2146435072 i32.gt_s - set_local $8 + set_local $4 end - get_local $8 + get_local $4 i32.eqz if - get_local $12 + get_local $11 i32.const 2146435072 i32.eq - tee_local $8 + tee_local $4 if - get_local $7 + get_local $21 i32.const 0 i32.ne - set_local $8 + set_local $4 end end - get_local $8 + get_local $4 if get_local $0 get_local $1 @@ -2937,71 +2937,70 @@ i32.const 0 i32.lt_s if - get_local $12 + get_local $11 i32.const 1128267776 i32.ge_s if (result i32) i32.const 2 else - get_local $12 + get_local $11 i32.const 1072693248 i32.ge_s if (result i32) - i32.const 52 - i32.const 20 - get_local $12 + get_local $21 + get_local $11 + get_local $11 i32.const 20 i32.shr_s i32.const 1023 i32.sub - tee_local $10 + tee_local $12 i32.const 20 i32.gt_s - tee_local $5 + tee_local $4 select - get_local $10 - i32.sub - set_local $8 - get_local $7 - get_local $12 - get_local $5 + tee_local $7 + i32.const 52 + i32.const 20 + get_local $4 select - tee_local $10 - get_local $8 + get_local $12 + i32.sub + tee_local $9 i32.shr_s - set_local $5 + set_local $4 i32.const 2 - get_local $5 + get_local $4 i32.const 1 i32.and i32.sub i32.const 0 - get_local $5 - get_local $8 + get_local $4 + get_local $9 i32.shl - get_local $10 + get_local $7 i32.eq select else i32.const 0 end end - set_local $14 + set_local $15 end - get_local $7 + get_local $21 i32.eqz if - get_local $12 + get_local $11 i32.const 2146435072 i32.eq if - get_local $4 + get_local $5 i32.const 1072693248 i32.sub get_local $20 i32.or if - get_local $4 + get_local $5 i32.const 1072693248 i32.ge_s if @@ -3031,7 +3030,7 @@ end unreachable end - get_local $12 + get_local $11 i32.const 1072693248 i32.eq if @@ -3076,25 +3075,25 @@ get_local $20 i32.eqz if - get_local $4 - i32.const 2146435072 - i32.eq - tee_local $5 + get_local $5 + i32.eqz + tee_local $4 i32.eqz if - get_local $4 - i32.eqz - set_local $5 + get_local $5 + i32.const 2146435072 + i32.eq + set_local $4 end - get_local $5 + get_local $4 i32.eqz if - get_local $4 + get_local $5 i32.const 1072693248 i32.eq - set_local $5 + set_local $4 end - get_local $5 + get_local $4 if f64.const 1 get_local $2 @@ -3109,16 +3108,16 @@ i32.const 0 i32.lt_s if (result f64) - get_local $4 + get_local $5 i32.const 1072693248 i32.sub - get_local $14 + get_local $15 i32.or if (result f64) get_local $2 f64.neg get_local $2 - get_local $14 + get_local $15 i32.const 1 i32.eq select @@ -3126,8 +3125,8 @@ get_local $2 get_local $2 f64.sub - tee_local $0 - get_local $0 + tee_local $14 + get_local $14 f64.div end else @@ -3137,39 +3136,39 @@ end end f64.const 1 - set_local $11 + set_local $10 get_local $18 i32.const 0 i32.lt_s if - get_local $14 + get_local $15 i32.eqz if get_local $0 get_local $0 f64.sub - tee_local $0 - get_local $0 + tee_local $14 + get_local $14 f64.div return end f64.const -1 f64.const 1 - get_local $14 + get_local $15 i32.const 1 i32.eq select - set_local $11 + set_local $10 end - get_local $12 + get_local $11 i32.const 1105199104 i32.gt_s if (result f64) - get_local $12 + get_local $11 i32.const 1139802112 i32.gt_s if - get_local $4 + get_local $5 i32.const 1072693247 i32.le_s if @@ -3181,7 +3180,7 @@ select return end - get_local $4 + get_local $5 i32.const 1072693248 i32.ge_s if @@ -3194,7 +3193,7 @@ return end end - get_local $4 + get_local $5 i32.const 1072693247 i32.lt_s if @@ -3202,13 +3201,13 @@ i32.const 0 i32.lt_s if (result f64) - get_local $11 + get_local $10 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $11 + get_local $10 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -3216,7 +3215,7 @@ end return end - get_local $4 + get_local $5 i32.const 1072693248 i32.gt_s if @@ -3224,13 +3223,13 @@ i32.const 0 i32.gt_s if (result f64) - get_local $11 + get_local $10 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $11 + get_local $10 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -3268,21 +3267,21 @@ f64.sub tee_local $6 f64.add - set_local $9 + set_local $8 get_local $6 - get_local $9 + get_local $8 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - tee_local $9 + tee_local $8 get_local $16 f64.sub f64.sub else i32.const 0 set_local $7 - get_local $4 + get_local $5 i32.const 1048576 i32.lt_s if (result i32) @@ -3294,32 +3293,32 @@ i64.const 32 i64.shr_u i32.wrap/i64 - set_local $4 + set_local $5 i32.const -53 else i32.const 0 end - get_local $4 + get_local $5 i32.const 20 i32.shr_s i32.const 1023 i32.sub i32.add set_local $7 - get_local $4 + get_local $5 i32.const 1048575 i32.and - tee_local $5 + tee_local $9 i32.const 1072693248 i32.or - set_local $4 - get_local $5 + set_local $5 + get_local $9 i32.const 235662 i32.le_s if (result i32) i32.const 0 else - get_local $5 + get_local $9 i32.const 767610 i32.lt_s if (result i32) @@ -3329,19 +3328,19 @@ i32.const 1 i32.add set_local $7 - get_local $4 + get_local $5 i32.const -1048576 i32.add - set_local $4 + set_local $5 i32.const 0 end end - set_local $10 + set_local $12 get_local $2 i64.reinterpret/f64 i64.const 4294967295 i64.and - get_local $4 + get_local $5 i64.extend_s/i32 i64.const 32 i64.shl @@ -3350,7 +3349,7 @@ tee_local $2 f64.const 1.5 f64.const 1 - get_local $10 + get_local $12 select tee_local $0 f64.sub @@ -3362,16 +3361,16 @@ f64.div tee_local $6 f64.mul - set_local $9 + set_local $14 get_local $2 - get_local $4 + get_local $5 i32.const 1 i32.shr_s i32.const 536870912 i32.or i32.const 524288 i32.add - get_local $10 + get_local $12 i32.const 18 i32.shl i32.add @@ -3379,27 +3378,27 @@ i64.const 32 i64.shl f64.reinterpret/i64 - tee_local $3 + tee_local $8 get_local $0 f64.sub f64.sub set_local $2 - get_local $9 - get_local $9 + get_local $14 + get_local $14 f64.mul - tee_local $15 - get_local $15 + tee_local $3 + get_local $3 f64.mul f64.const 0.5999999999999946 - get_local $15 + get_local $3 f64.const 0.4285714285785502 - get_local $15 + get_local $3 f64.const 0.33333332981837743 - get_local $15 + get_local $3 f64.const 0.272728123808534 - get_local $15 + get_local $3 f64.const 0.23066074577556175 - get_local $15 + get_local $3 f64.const 0.20697501780033842 f64.mul f64.add @@ -3415,13 +3414,13 @@ set_local $19 get_local $6 get_local $16 - get_local $9 + get_local $14 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 tee_local $6 - get_local $3 + get_local $8 f64.mul f64.sub get_local $6 @@ -3434,40 +3433,40 @@ get_local $6 get_local $6 f64.mul - tee_local $15 + tee_local $3 f64.add get_local $19 get_local $0 get_local $6 - get_local $9 + get_local $14 f64.add f64.mul f64.add tee_local $19 f64.add - set_local $3 + set_local $8 get_local $19 - get_local $3 + get_local $8 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - tee_local $3 + tee_local $8 f64.const 3 f64.sub - get_local $15 + get_local $3 f64.sub f64.sub set_local $2 get_local $6 - get_local $3 + get_local $8 f64.mul tee_local $16 get_local $0 - get_local $3 + get_local $8 f64.mul get_local $2 - get_local $9 + get_local $14 f64.mul f64.add tee_local $6 @@ -3497,14 +3496,14 @@ f64.add f64.const 1.350039202129749e-08 f64.const 0 - get_local $10 + get_local $12 select f64.add tee_local $2 f64.add f64.const 0.5849624872207642 f64.const 0 - get_local $10 + get_local $12 select tee_local $0 f64.add @@ -3512,14 +3511,14 @@ f64.convert_s/i32 tee_local $3 f64.add - set_local $9 + set_local $8 get_local $2 - get_local $9 + get_local $8 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - tee_local $9 + tee_local $8 get_local $3 f64.sub get_local $0 @@ -3537,7 +3536,7 @@ f64.reinterpret/i64 tee_local $0 f64.sub - get_local $9 + get_local $8 f64.mul get_local $1 get_local $2 @@ -3545,7 +3544,7 @@ f64.add tee_local $6 get_local $0 - get_local $9 + get_local $8 f64.mul tee_local $0 f64.add @@ -3553,21 +3552,21 @@ i64.reinterpret/f64 tee_local $17 i32.wrap/i64 - set_local $8 + set_local $4 block $folding-inner1 block $folding-inner0 get_local $17 i64.const 32 i64.shr_u i32.wrap/i64 - tee_local $5 + tee_local $9 i32.const 1083179008 i32.ge_s if - get_local $5 + get_local $9 i32.const 1083179008 i32.sub - get_local $8 + get_local $4 i32.or br_if $folding-inner0 get_local $6 @@ -3579,16 +3578,16 @@ f64.gt br_if $folding-inner0 else - get_local $5 + get_local $9 i32.const 2147483647 i32.and i32.const 1083231232 i32.ge_s if - get_local $5 + get_local $9 i32.const -1064252416 i32.sub - get_local $8 + get_local $4 i32.or br_if $folding-inner1 get_local $6 @@ -3599,27 +3598,27 @@ br_if $folding-inner1 end end - get_local $5 + get_local $9 i32.const 2147483647 i32.and - tee_local $8 + tee_local $4 i32.const 20 i32.shr_s i32.const 1023 i32.sub - set_local $10 + set_local $12 i32.const 0 set_local $7 - get_local $8 + get_local $4 i32.const 1071644672 i32.gt_s if i32.const 1048576 - get_local $10 + get_local $12 i32.const 1 i32.add i32.shr_s - get_local $5 + get_local $9 i32.add tee_local $7 i32.const 2147483647 @@ -3628,9 +3627,9 @@ i32.shr_s i32.const 1023 i32.sub - set_local $10 + set_local $12 i32.const 1048575 - get_local $10 + get_local $12 i32.shr_s i32.const -1 i32.xor @@ -3647,7 +3646,7 @@ i32.const 1048576 i32.or i32.const 20 - get_local $10 + get_local $12 i32.sub i32.shr_s set_local $7 @@ -3655,7 +3654,7 @@ get_local $7 i32.sub get_local $7 - get_local $5 + get_local $9 i32.const 0 i32.lt_s select @@ -3693,7 +3692,7 @@ get_local $2 f64.mul set_local $3 - get_local $11 + get_local $10 f64.const 1 get_local $2 get_local $2 @@ -3717,9 +3716,9 @@ f64.add f64.mul f64.sub - tee_local $9 + tee_local $8 f64.mul - get_local $9 + get_local $8 f64.const 2 f64.sub f64.div @@ -3746,7 +3745,7 @@ i32.const 20 i32.shl i32.add - tee_local $5 + tee_local $9 i32.const 20 i32.shr_s i32.const 0 @@ -3760,7 +3759,7 @@ i64.reinterpret/f64 i64.const 4294967295 i64.and - get_local $5 + get_local $9 i64.extend_s/i32 i64.const 32 i64.shl @@ -3770,14 +3769,14 @@ f64.mul return end - get_local $11 + get_local $10 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul return end - get_local $11 + get_local $10 f64.const 1e-300 f64.mul f64.const 1e-300 diff --git a/tests/compiler/std/libm.untouched.wat b/tests/compiler/std/libm.untouched.wat index 844d371238..ce8b000c16 100644 --- a/tests/compiler/std/libm.untouched.wat +++ b/tests/compiler/std/libm.untouched.wat @@ -1772,7 +1772,6 @@ (local $3 f64) (local $4 f64) (local $5 f64) - (local $6 f64) get_local $0 i64.reinterpret/f64 set_local $1 @@ -1893,14 +1892,12 @@ get_local $5 f64.div set_local $4 - get_local $3 - get_local $3 - f64.add - set_local $6 get_local $4 get_local $3 f64.sub - get_local $6 + f64.const 2 + get_local $3 + f64.mul get_local $4 f64.add f64.div @@ -2381,8 +2378,6 @@ get_local $0 f64.const 8988465674311579538646525e283 f64.mul - set_local $0 - get_local $0 return end get_local $0 @@ -3428,7 +3423,7 @@ (local $11 i32) (local $12 i32) (local $13 i32) - (local $14 f64) + (local $14 i32) (local $15 f64) (local $16 f64) (local $17 f64) @@ -3440,10 +3435,10 @@ (local $23 f64) (local $24 f64) (local $25 f64) - (local $26 i32) - (local $27 i32) - (local $28 f64) - (local $29 f64) + (local $26 f64) + (local $27 f64) + (local $28 i32) + (local $29 i32) (local $30 f64) (local $31 f64) (local $32 f64) @@ -3454,7 +3449,8 @@ (local $37 f64) (local $38 f64) (local $39 f64) - (local $40 i32) + (local $40 f64) + (local $41 i32) get_local $0 i64.reinterpret/f64 set_local $2 @@ -3566,34 +3562,34 @@ i32.const 1023 i32.sub set_local $11 - i32.const 52 - i32.const 20 get_local $11 i32.const 20 i32.gt_s + set_local $9 + i32.const 52 + i32.const 20 + get_local $9 select get_local $11 i32.sub - set_local $9 + set_local $12 get_local $6 get_local $8 - get_local $11 - i32.const 20 - i32.gt_s - select - set_local $12 - get_local $12 get_local $9 - i32.shr_s + select set_local $13 get_local $13 - get_local $9 - i32.shl get_local $12 + i32.shr_s + set_local $14 + get_local $14 + get_local $12 + i32.shl + get_local $13 i32.eq if i32.const 2 - get_local $13 + get_local $14 i32.const 1 i32.and i32.sub @@ -3692,41 +3688,41 @@ end get_local $0 f64.abs - set_local $14 + set_local $15 get_local $4 i32.const 0 i32.eq if get_local $7 - i32.const 2146435072 + i32.const 0 i32.eq - tee_local $13 + tee_local $14 if (result i32) - get_local $13 + get_local $14 else get_local $7 - i32.const 0 + i32.const 2146435072 i32.eq end - tee_local $13 + tee_local $14 if (result i32) - get_local $13 + get_local $14 else get_local $7 i32.const 1072693248 i32.eq end if - get_local $14 - set_local $15 + get_local $15 + set_local $16 get_local $5 i32.const 0 i32.lt_s if f64.const 1 - get_local $15 + get_local $16 f64.div - set_local $15 + set_local $16 end get_local $3 i32.const 0 @@ -3740,31 +3736,31 @@ i32.const 0 i32.eq if - get_local $15 - get_local $15 - f64.sub - get_local $15 - get_local $15 + get_local $16 + get_local $16 f64.sub + set_local $17 + get_local $17 + get_local $17 f64.div - set_local $15 + set_local $16 else get_local $10 i32.const 1 i32.eq if - get_local $15 + get_local $16 f64.neg - set_local $15 + set_local $16 end end end - get_local $15 + get_local $16 return end end f64.const 1 - set_local $16 + set_local $18 get_local $3 i32.const 0 i32.lt_s @@ -3776,9 +3772,9 @@ get_local $0 get_local $0 f64.sub - get_local $0 - get_local $0 - f64.sub + set_local $17 + get_local $17 + get_local $17 f64.div return end @@ -3787,7 +3783,7 @@ i32.eq if f64.const -1 - set_local $16 + set_local $18 end end get_local $8 @@ -3843,13 +3839,13 @@ i32.const 0 i32.lt_s if (result f64) - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -3865,13 +3861,13 @@ i32.const 0 i32.gt_s if (result f64) - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -3879,98 +3875,98 @@ end return end - get_local $14 + get_local $15 f64.const 1 f64.sub - set_local $22 - get_local $22 - get_local $22 + set_local $24 + get_local $24 + get_local $24 f64.mul f64.const 0.5 - get_local $22 + get_local $24 f64.const 0.3333333333333333 - get_local $22 + get_local $24 f64.const 0.25 f64.mul f64.sub f64.mul f64.sub f64.mul - set_local $25 + set_local $27 f64.const 1.4426950216293335 - get_local $22 + get_local $24 f64.mul - set_local $23 - get_local $22 + set_local $25 + get_local $24 f64.const 1.9259629911266175e-08 f64.mul - get_local $25 + get_local $27 f64.const 1.4426950408889634 f64.mul f64.sub - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.add - set_local $17 - get_local $17 + set_local $19 + get_local $19 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $17 - get_local $24 - get_local $17 - get_local $23 + set_local $19 + get_local $26 + get_local $19 + get_local $25 f64.sub f64.sub - set_local $18 + set_local $20 else i32.const 0 - set_local $27 + set_local $29 get_local $7 i32.const 1048576 i32.lt_s if - get_local $14 + get_local $15 f64.const 9007199254740992 f64.mul - set_local $14 - get_local $27 + set_local $15 + get_local $29 i32.const 53 i32.sub - set_local $27 - get_local $14 + set_local $29 + get_local $15 i64.reinterpret/f64 i64.const 32 i64.shr_u i32.wrap/i64 set_local $7 end - get_local $27 + get_local $29 get_local $7 i32.const 20 i32.shr_s i32.const 1023 i32.sub i32.add - set_local $27 + set_local $29 get_local $7 i32.const 1048575 i32.and - set_local $26 - get_local $26 + set_local $28 + get_local $28 i32.const 1072693248 i32.or set_local $7 - get_local $26 + get_local $28 i32.const 235662 i32.le_s if i32.const 0 set_local $11 else - get_local $26 + get_local $28 i32.const 767610 i32.lt_s if @@ -3979,17 +3975,17 @@ else i32.const 0 set_local $11 - get_local $27 + get_local $29 i32.const 1 i32.add - set_local $27 + set_local $29 get_local $7 i32.const 1048576 i32.sub set_local $7 end end - get_local $14 + get_local $15 i64.reinterpret/f64 i64.const 4294967295 i64.and @@ -3999,34 +3995,34 @@ i64.shl i64.or f64.reinterpret/i64 - set_local $14 + set_local $15 f64.const 1.5 f64.const 1 get_local $11 select - set_local $34 - get_local $14 - get_local $34 + set_local $35 + get_local $15 + get_local $35 f64.sub - set_local $23 + set_local $25 f64.const 1 - get_local $14 - get_local $34 + get_local $15 + get_local $35 f64.add f64.div - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.mul - set_local $28 - get_local $28 - set_local $30 - get_local $30 + set_local $17 + get_local $17 + set_local $31 + get_local $31 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $30 + set_local $31 get_local $7 i32.const 1 i32.shr_s @@ -4042,42 +4038,42 @@ i64.const 32 i64.shl f64.reinterpret/i64 - set_local $32 - get_local $14 - get_local $32 - get_local $34 + set_local $33 + get_local $15 + get_local $33 + get_local $35 f64.sub f64.sub - set_local $33 - get_local $24 - get_local $23 - get_local $30 - get_local $32 + set_local $34 + get_local $26 + get_local $25 + get_local $31 + get_local $33 f64.mul f64.sub - get_local $30 - get_local $33 + get_local $31 + get_local $34 f64.mul f64.sub f64.mul - set_local $31 - get_local $28 - get_local $28 + set_local $32 + get_local $17 + get_local $17 f64.mul - set_local $29 - get_local $29 - get_local $29 + set_local $30 + get_local $30 + get_local $30 f64.mul f64.const 0.5999999999999946 - get_local $29 + get_local $30 f64.const 0.4285714285785502 - get_local $29 + get_local $30 f64.const 0.33333332981837743 - get_local $29 + get_local $30 f64.const 0.272728123808534 - get_local $29 + get_local $30 f64.const 0.23066074577556175 - get_local $29 + get_local $30 f64.const 0.20697501780033842 f64.mul f64.add @@ -4090,184 +4086,184 @@ f64.mul f64.add f64.mul - set_local $21 - get_local $21 + set_local $23 + get_local $23 + get_local $32 get_local $31 - get_local $30 - get_local $28 + get_local $17 f64.add f64.mul f64.add - set_local $21 - get_local $30 - get_local $30 + set_local $23 + get_local $31 + get_local $31 f64.mul - set_local $29 + set_local $30 f64.const 3 - get_local $29 + get_local $30 f64.add - get_local $21 + get_local $23 f64.add - set_local $32 - get_local $32 + set_local $33 + get_local $33 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $32 - get_local $21 - get_local $32 + set_local $33 + get_local $23 + get_local $33 f64.const 3 f64.sub - get_local $29 + get_local $30 f64.sub f64.sub - set_local $33 - get_local $30 - get_local $32 - f64.mul - set_local $23 + set_local $34 get_local $31 - get_local $32 + get_local $33 f64.mul + set_local $25 + get_local $32 get_local $33 - get_local $28 + f64.mul + get_local $34 + get_local $17 f64.mul f64.add - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.add - set_local $19 - get_local $19 + set_local $21 + get_local $21 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $19 - get_local $24 - get_local $19 - get_local $23 + set_local $21 + get_local $26 + get_local $21 + get_local $25 f64.sub f64.sub - set_local $20 + set_local $22 f64.const 0.9617967009544373 - get_local $19 + get_local $21 f64.mul - set_local $35 + set_local $36 f64.const 1.350039202129749e-08 f64.const 0 get_local $11 select - set_local $36 + set_local $37 f64.const -7.028461650952758e-09 - get_local $19 + get_local $21 f64.mul - get_local $20 + get_local $22 f64.const 0.9617966939259756 f64.mul f64.add - get_local $36 + get_local $37 f64.add - set_local $37 - get_local $27 + set_local $38 + get_local $29 f64.convert_s/i32 - set_local $22 + set_local $24 f64.const 0.5849624872207642 f64.const 0 get_local $11 select - set_local $38 - get_local $35 - get_local $37 - f64.add + set_local $39 + get_local $36 get_local $38 f64.add - get_local $22 + get_local $39 f64.add - set_local $17 - get_local $17 + get_local $24 + f64.add + set_local $19 + get_local $19 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $17 - get_local $37 - get_local $17 - get_local $22 - f64.sub + set_local $19 get_local $38 + get_local $19 + get_local $24 f64.sub - get_local $35 + get_local $39 + f64.sub + get_local $36 f64.sub f64.sub - set_local $18 + set_local $20 end get_local $1 - set_local $39 - get_local $39 + set_local $40 + get_local $40 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $39 + set_local $40 get_local $1 - get_local $39 + get_local $40 f64.sub - get_local $17 + get_local $19 f64.mul get_local $1 - get_local $18 + get_local $20 f64.mul f64.add - set_local $20 - get_local $39 - get_local $17 - f64.mul - set_local $19 - get_local $20 + set_local $22 + get_local $40 get_local $19 + f64.mul + set_local $21 + get_local $22 + get_local $21 f64.add - set_local $15 - get_local $15 + set_local $16 + get_local $16 i64.reinterpret/f64 set_local $2 get_local $2 i64.const 32 i64.shr_u i32.wrap/i64 - set_local $26 + set_local $28 get_local $2 i32.wrap/i64 - set_local $40 - get_local $26 + set_local $41 + get_local $28 i32.const 1083179008 i32.ge_s if - get_local $26 + get_local $28 i32.const 1083179008 i32.sub - get_local $40 + get_local $41 i32.or i32.const 0 i32.ne if - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul return end - get_local $20 + get_local $22 f64.const 8.008566259537294e-17 f64.add - get_local $15 - get_local $19 + get_local $16 + get_local $21 f64.sub f64.gt if - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 @@ -4275,34 +4271,34 @@ return end else - get_local $26 + get_local $28 i32.const 2147483647 i32.and i32.const 1083231232 i32.ge_s if - get_local $26 + get_local $28 i32.const -1064252416 i32.sub - get_local $40 + get_local $41 i32.or i32.const 0 i32.ne if - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 f64.mul return end - get_local $20 - get_local $15 - get_local $19 + get_local $22 + get_local $16 + get_local $21 f64.sub f64.le if - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -4311,31 +4307,31 @@ end end end - get_local $26 + get_local $28 i32.const 2147483647 i32.and - set_local $40 - get_local $40 + set_local $41 + get_local $41 i32.const 20 i32.shr_s i32.const 1023 i32.sub set_local $11 i32.const 0 - set_local $27 - get_local $40 + set_local $29 + get_local $41 i32.const 1071644672 i32.gt_s if - get_local $26 + get_local $28 i32.const 1048576 get_local $11 i32.const 1 i32.add i32.shr_s i32.add - set_local $27 - get_local $27 + set_local $29 + get_local $29 i32.const 2147483647 i32.and i32.const 20 @@ -4344,8 +4340,8 @@ i32.sub set_local $11 f64.const 0 - set_local $22 - get_local $27 + set_local $24 + get_local $29 i32.const 1048575 get_local $11 i32.shr_s @@ -4356,8 +4352,8 @@ i64.const 32 i64.shl f64.reinterpret/i64 - set_local $22 - get_local $27 + set_local $24 + get_local $29 i32.const 1048575 i32.and i32.const 1048576 @@ -4366,71 +4362,71 @@ get_local $11 i32.sub i32.shr_s - set_local $27 - get_local $26 + set_local $29 + get_local $28 i32.const 0 i32.lt_s if i32.const 0 - get_local $27 + get_local $29 i32.sub - set_local $27 + set_local $29 end - get_local $19 - get_local $22 + get_local $21 + get_local $24 f64.sub - set_local $19 + set_local $21 end - get_local $20 - get_local $19 - f64.add - set_local $22 get_local $22 + get_local $21 + f64.add + set_local $24 + get_local $24 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $22 - get_local $22 + set_local $24 + get_local $24 f64.const 0.6931471824645996 f64.mul - set_local $23 - get_local $20 + set_local $25 get_local $22 - get_local $19 + get_local $24 + get_local $21 f64.sub f64.sub f64.const 0.6931471805599453 f64.mul - get_local $22 + get_local $24 f64.const -1.904654299957768e-09 f64.mul f64.add - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.add - set_local $15 - get_local $24 - get_local $15 - get_local $23 + set_local $16 + get_local $26 + get_local $16 + get_local $25 f64.sub f64.sub - set_local $25 - get_local $15 - get_local $15 + set_local $27 + get_local $16 + get_local $16 f64.mul - set_local $22 - get_local $15 - get_local $22 + set_local $24 + get_local $16 + get_local $24 f64.const 0.16666666666666602 - get_local $22 + get_local $24 f64.const -2.7777777777015593e-03 - get_local $22 + get_local $24 f64.const 6.613756321437934e-05 - get_local $22 + get_local $24 f64.const -1.6533902205465252e-06 - get_local $22 + get_local $24 f64.const 4.1381367970572385e-08 f64.mul f64.add @@ -4442,64 +4438,64 @@ f64.add f64.mul f64.sub - set_local $17 - get_local $15 - get_local $17 + set_local $19 + get_local $16 + get_local $19 f64.mul - get_local $17 + get_local $19 f64.const 2 f64.sub f64.div - get_local $25 - get_local $15 - get_local $25 + get_local $27 + get_local $16 + get_local $27 f64.mul f64.add f64.sub - set_local $21 + set_local $23 f64.const 1 - get_local $21 - get_local $15 + get_local $23 + get_local $16 f64.sub f64.sub - set_local $15 - get_local $15 + set_local $16 + get_local $16 i64.reinterpret/f64 i64.const 32 i64.shr_u i32.wrap/i64 - set_local $26 - get_local $26 - get_local $27 + set_local $28 + get_local $28 + get_local $29 i32.const 20 i32.shl i32.add - set_local $26 - get_local $26 + set_local $28 + get_local $28 i32.const 20 i32.shr_s i32.const 0 i32.le_s if - get_local $15 - get_local $27 + get_local $16 + get_local $29 call $~lib/math/NativeMath.scalbn - set_local $15 + set_local $16 else - get_local $15 + get_local $16 i64.reinterpret/f64 i64.const 4294967295 i64.and - get_local $26 + get_local $28 i64.extend_s/i32 i64.const 32 i64.shl i64.or f64.reinterpret/i64 - set_local $15 + set_local $16 end + get_local $18 get_local $16 - get_local $15 f64.mul ) (func $std/libm/pow (; 48 ;) (type $FFF) (param $0 f64) (param $1 f64) (result f64) diff --git a/tests/compiler/std/math.optimized.wat b/tests/compiler/std/math.optimized.wat index 146505f9bb..1581b5e513 100644 --- a/tests/compiler/std/math.optimized.wat +++ b/tests/compiler/std/math.optimized.wat @@ -3292,6 +3292,7 @@ f64.div f64.mul set_local $2 + get_local $0 get_local $1 f64.const 1.87595182427177 get_local $2 @@ -3324,18 +3325,16 @@ tee_local $1 get_local $1 f64.mul + f64.div set_local $2 get_local $1 get_local $1 - get_local $0 get_local $2 - f64.div - tee_local $2 get_local $1 f64.sub + f64.const 2 get_local $1 - get_local $1 - f64.add + f64.mul get_local $2 f64.add f64.div @@ -6178,19 +6177,20 @@ (local $5 i32) (local $6 f64) (local $7 i32) - (local $8 i32) - (local $9 f64) - (local $10 i32) - (local $11 f64) + (local $8 f64) + (local $9 i32) + (local $10 f64) + (local $11 i32) (local $12 i32) (local $13 i32) - (local $14 i32) - (local $15 f64) + (local $14 f64) + (local $15 i32) (local $16 f64) (local $17 i64) (local $18 i32) (local $19 f64) (local $20 i32) + (local $21 i32) get_local $0 i64.reinterpret/f64 tee_local $17 @@ -6204,7 +6204,7 @@ get_local $18 i32.const 2147483647 i32.and - set_local $4 + set_local $5 get_local $1 i64.reinterpret/f64 tee_local $17 @@ -6214,57 +6214,57 @@ tee_local $13 i32.const 2147483647 i32.and - set_local $12 - get_local $12 + set_local $11 + get_local $11 get_local $17 i32.wrap/i64 - tee_local $7 + tee_local $21 i32.or i32.eqz if f64.const 1 return end - get_local $4 + get_local $5 i32.const 2146435072 i32.gt_s - tee_local $8 + tee_local $4 i32.eqz if - get_local $4 + get_local $5 i32.const 2146435072 i32.eq - tee_local $8 + tee_local $4 if get_local $20 i32.const 0 i32.ne - set_local $8 + set_local $4 end end - get_local $8 + get_local $4 i32.eqz if - get_local $12 + get_local $11 i32.const 2146435072 i32.gt_s - set_local $8 + set_local $4 end - get_local $8 + get_local $4 i32.eqz if - get_local $12 + get_local $11 i32.const 2146435072 i32.eq - tee_local $8 + tee_local $4 if - get_local $7 + get_local $21 i32.const 0 i32.ne - set_local $8 + set_local $4 end end - get_local $8 + get_local $4 if get_local $0 get_local $1 @@ -6275,71 +6275,70 @@ i32.const 0 i32.lt_s if - get_local $12 + get_local $11 i32.const 1128267776 i32.ge_s if (result i32) i32.const 2 else - get_local $12 + get_local $11 i32.const 1072693248 i32.ge_s if (result i32) - i32.const 52 - i32.const 20 - get_local $12 + get_local $21 + get_local $11 + get_local $11 i32.const 20 i32.shr_s i32.const 1023 i32.sub - tee_local $10 + tee_local $12 i32.const 20 i32.gt_s - tee_local $5 + tee_local $4 select - get_local $10 - i32.sub - set_local $8 - get_local $7 - get_local $12 - get_local $5 + tee_local $7 + i32.const 52 + i32.const 20 + get_local $4 select - tee_local $10 - get_local $8 + get_local $12 + i32.sub + tee_local $9 i32.shr_s - set_local $5 + set_local $4 i32.const 2 - get_local $5 + get_local $4 i32.const 1 i32.and i32.sub i32.const 0 - get_local $5 - get_local $8 + get_local $4 + get_local $9 i32.shl - get_local $10 + get_local $7 i32.eq select else i32.const 0 end end - set_local $14 + set_local $15 end - get_local $7 + get_local $21 i32.eqz if - get_local $12 + get_local $11 i32.const 2146435072 i32.eq if - get_local $4 + get_local $5 i32.const 1072693248 i32.sub get_local $20 i32.or if - get_local $4 + get_local $5 i32.const 1072693248 i32.ge_s if @@ -6369,7 +6368,7 @@ end unreachable end - get_local $12 + get_local $11 i32.const 1072693248 i32.eq if @@ -6414,25 +6413,25 @@ get_local $20 i32.eqz if - get_local $4 - i32.const 2146435072 - i32.eq - tee_local $5 + get_local $5 + i32.eqz + tee_local $4 i32.eqz if - get_local $4 - i32.eqz - set_local $5 + get_local $5 + i32.const 2146435072 + i32.eq + set_local $4 end - get_local $5 + get_local $4 i32.eqz if - get_local $4 + get_local $5 i32.const 1072693248 i32.eq - set_local $5 + set_local $4 end - get_local $5 + get_local $4 if f64.const 1 get_local $2 @@ -6447,16 +6446,16 @@ i32.const 0 i32.lt_s if (result f64) - get_local $4 + get_local $5 i32.const 1072693248 i32.sub - get_local $14 + get_local $15 i32.or if (result f64) get_local $2 f64.neg get_local $2 - get_local $14 + get_local $15 i32.const 1 i32.eq select @@ -6464,8 +6463,8 @@ get_local $2 get_local $2 f64.sub - tee_local $0 - get_local $0 + tee_local $14 + get_local $14 f64.div end else @@ -6475,39 +6474,39 @@ end end f64.const 1 - set_local $11 + set_local $10 get_local $18 i32.const 0 i32.lt_s if - get_local $14 + get_local $15 i32.eqz if get_local $0 get_local $0 f64.sub - tee_local $0 - get_local $0 + tee_local $14 + get_local $14 f64.div return end f64.const -1 f64.const 1 - get_local $14 + get_local $15 i32.const 1 i32.eq select - set_local $11 + set_local $10 end - get_local $12 + get_local $11 i32.const 1105199104 i32.gt_s if (result f64) - get_local $12 + get_local $11 i32.const 1139802112 i32.gt_s if - get_local $4 + get_local $5 i32.const 1072693247 i32.le_s if @@ -6519,7 +6518,7 @@ select return end - get_local $4 + get_local $5 i32.const 1072693248 i32.ge_s if @@ -6532,7 +6531,7 @@ return end end - get_local $4 + get_local $5 i32.const 1072693247 i32.lt_s if @@ -6540,13 +6539,13 @@ i32.const 0 i32.lt_s if (result f64) - get_local $11 + get_local $10 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $11 + get_local $10 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -6554,7 +6553,7 @@ end return end - get_local $4 + get_local $5 i32.const 1072693248 i32.gt_s if @@ -6562,13 +6561,13 @@ i32.const 0 i32.gt_s if (result f64) - get_local $11 + get_local $10 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $11 + get_local $10 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -6606,21 +6605,21 @@ f64.sub tee_local $6 f64.add - set_local $9 + set_local $8 get_local $6 - get_local $9 + get_local $8 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - tee_local $9 + tee_local $8 get_local $16 f64.sub f64.sub else i32.const 0 set_local $7 - get_local $4 + get_local $5 i32.const 1048576 i32.lt_s if (result i32) @@ -6632,32 +6631,32 @@ i64.const 32 i64.shr_u i32.wrap/i64 - set_local $4 + set_local $5 i32.const -53 else i32.const 0 end - get_local $4 + get_local $5 i32.const 20 i32.shr_s i32.const 1023 i32.sub i32.add set_local $7 - get_local $4 + get_local $5 i32.const 1048575 i32.and - tee_local $5 + tee_local $9 i32.const 1072693248 i32.or - set_local $4 - get_local $5 + set_local $5 + get_local $9 i32.const 235662 i32.le_s if (result i32) i32.const 0 else - get_local $5 + get_local $9 i32.const 767610 i32.lt_s if (result i32) @@ -6667,19 +6666,19 @@ i32.const 1 i32.add set_local $7 - get_local $4 + get_local $5 i32.const -1048576 i32.add - set_local $4 + set_local $5 i32.const 0 end end - set_local $10 + set_local $12 get_local $2 i64.reinterpret/f64 i64.const 4294967295 i64.and - get_local $4 + get_local $5 i64.extend_s/i32 i64.const 32 i64.shl @@ -6688,7 +6687,7 @@ tee_local $2 f64.const 1.5 f64.const 1 - get_local $10 + get_local $12 select tee_local $0 f64.sub @@ -6700,16 +6699,16 @@ f64.div tee_local $6 f64.mul - set_local $9 + set_local $14 get_local $2 - get_local $4 + get_local $5 i32.const 1 i32.shr_s i32.const 536870912 i32.or i32.const 524288 i32.add - get_local $10 + get_local $12 i32.const 18 i32.shl i32.add @@ -6717,27 +6716,27 @@ i64.const 32 i64.shl f64.reinterpret/i64 - tee_local $3 + tee_local $8 get_local $0 f64.sub f64.sub set_local $2 - get_local $9 - get_local $9 + get_local $14 + get_local $14 f64.mul - tee_local $15 - get_local $15 + tee_local $3 + get_local $3 f64.mul f64.const 0.5999999999999946 - get_local $15 + get_local $3 f64.const 0.4285714285785502 - get_local $15 + get_local $3 f64.const 0.33333332981837743 - get_local $15 + get_local $3 f64.const 0.272728123808534 - get_local $15 + get_local $3 f64.const 0.23066074577556175 - get_local $15 + get_local $3 f64.const 0.20697501780033842 f64.mul f64.add @@ -6753,13 +6752,13 @@ set_local $19 get_local $6 get_local $16 - get_local $9 + get_local $14 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 tee_local $6 - get_local $3 + get_local $8 f64.mul f64.sub get_local $6 @@ -6772,40 +6771,40 @@ get_local $6 get_local $6 f64.mul - tee_local $15 + tee_local $3 f64.add get_local $19 get_local $0 get_local $6 - get_local $9 + get_local $14 f64.add f64.mul f64.add tee_local $19 f64.add - set_local $3 + set_local $8 get_local $19 - get_local $3 + get_local $8 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - tee_local $3 + tee_local $8 f64.const 3 f64.sub - get_local $15 + get_local $3 f64.sub f64.sub set_local $2 get_local $6 - get_local $3 + get_local $8 f64.mul tee_local $16 get_local $0 - get_local $3 + get_local $8 f64.mul get_local $2 - get_local $9 + get_local $14 f64.mul f64.add tee_local $6 @@ -6835,14 +6834,14 @@ f64.add f64.const 1.350039202129749e-08 f64.const 0 - get_local $10 + get_local $12 select f64.add tee_local $2 f64.add f64.const 0.5849624872207642 f64.const 0 - get_local $10 + get_local $12 select tee_local $0 f64.add @@ -6850,14 +6849,14 @@ f64.convert_s/i32 tee_local $3 f64.add - set_local $9 + set_local $8 get_local $2 - get_local $9 + get_local $8 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - tee_local $9 + tee_local $8 get_local $3 f64.sub get_local $0 @@ -6875,7 +6874,7 @@ f64.reinterpret/i64 tee_local $0 f64.sub - get_local $9 + get_local $8 f64.mul get_local $1 get_local $2 @@ -6883,7 +6882,7 @@ f64.add tee_local $6 get_local $0 - get_local $9 + get_local $8 f64.mul tee_local $0 f64.add @@ -6891,21 +6890,21 @@ i64.reinterpret/f64 tee_local $17 i32.wrap/i64 - set_local $8 + set_local $4 block $folding-inner1 block $folding-inner0 get_local $17 i64.const 32 i64.shr_u i32.wrap/i64 - tee_local $5 + tee_local $9 i32.const 1083179008 i32.ge_s if - get_local $5 + get_local $9 i32.const 1083179008 i32.sub - get_local $8 + get_local $4 i32.or br_if $folding-inner0 get_local $6 @@ -6917,16 +6916,16 @@ f64.gt br_if $folding-inner0 else - get_local $5 + get_local $9 i32.const 2147483647 i32.and i32.const 1083231232 i32.ge_s if - get_local $5 + get_local $9 i32.const -1064252416 i32.sub - get_local $8 + get_local $4 i32.or br_if $folding-inner1 get_local $6 @@ -6937,27 +6936,27 @@ br_if $folding-inner1 end end - get_local $5 + get_local $9 i32.const 2147483647 i32.and - tee_local $8 + tee_local $4 i32.const 20 i32.shr_s i32.const 1023 i32.sub - set_local $10 + set_local $12 i32.const 0 set_local $7 - get_local $8 + get_local $4 i32.const 1071644672 i32.gt_s if i32.const 1048576 - get_local $10 + get_local $12 i32.const 1 i32.add i32.shr_s - get_local $5 + get_local $9 i32.add tee_local $7 i32.const 2147483647 @@ -6966,9 +6965,9 @@ i32.shr_s i32.const 1023 i32.sub - set_local $10 + set_local $12 i32.const 1048575 - get_local $10 + get_local $12 i32.shr_s i32.const -1 i32.xor @@ -6985,7 +6984,7 @@ i32.const 1048576 i32.or i32.const 20 - get_local $10 + get_local $12 i32.sub i32.shr_s set_local $7 @@ -6993,7 +6992,7 @@ get_local $7 i32.sub get_local $7 - get_local $5 + get_local $9 i32.const 0 i32.lt_s select @@ -7031,7 +7030,7 @@ get_local $2 f64.mul set_local $3 - get_local $11 + get_local $10 f64.const 1 get_local $2 get_local $2 @@ -7055,9 +7054,9 @@ f64.add f64.mul f64.sub - tee_local $9 + tee_local $8 f64.mul - get_local $9 + get_local $8 f64.const 2 f64.sub f64.div @@ -7084,7 +7083,7 @@ i32.const 20 i32.shl i32.add - tee_local $5 + tee_local $9 i32.const 20 i32.shr_s i32.const 0 @@ -7098,7 +7097,7 @@ i64.reinterpret/f64 i64.const 4294967295 i64.and - get_local $5 + get_local $9 i64.extend_s/i32 i64.const 32 i64.shl @@ -7108,14 +7107,14 @@ f64.mul return end - get_local $11 + get_local $10 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul return end - get_local $11 + get_local $10 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -7152,9 +7151,9 @@ (local $9 f32) (local $10 f32) (local $11 f32) - (local $12 i32) + (local $12 f32) (local $13 i32) - (local $14 f32) + (local $14 i32) (local $15 f32) (local $16 f32) (local $17 f32) @@ -7166,10 +7165,10 @@ set_local $6 get_local $1 i32.reinterpret/f32 - tee_local $13 + tee_local $14 i32.const 2147483647 i32.and - tee_local $12 + tee_local $13 i32.eqz if f32.const 1 @@ -7181,7 +7180,7 @@ tee_local $5 i32.eqz if - get_local $12 + get_local $13 i32.const 2139095040 i32.gt_s set_local $5 @@ -7197,19 +7196,19 @@ i32.const 0 i32.lt_s if - get_local $12 + get_local $13 i32.const 1266679808 i32.ge_s if (result i32) i32.const 2 else - get_local $12 + get_local $13 i32.const 1065353216 i32.ge_s if (result i32) - get_local $12 + get_local $13 i32.const 150 - get_local $12 + get_local $13 i32.const 23 i32.shr_s i32.sub @@ -7218,7 +7217,7 @@ tee_local $8 get_local $5 i32.shl - get_local $12 + get_local $13 i32.eq if (result i32) i32.const 2 @@ -7235,7 +7234,7 @@ end set_local $4 end - get_local $12 + get_local $13 i32.const 2139095040 i32.eq if @@ -7250,7 +7249,7 @@ i32.const 1065353216 i32.gt_s if - get_local $13 + get_local $14 i32.const 0 i32.lt_s if @@ -7263,7 +7262,7 @@ f32.const 0 get_local $1 f32.neg - get_local $13 + get_local $14 i32.const 0 i32.ge_s select @@ -7273,11 +7272,11 @@ end unreachable end - get_local $12 + get_local $13 i32.const 1065353216 i32.eq if - get_local $13 + get_local $14 i32.const 0 i32.lt_s if @@ -7289,7 +7288,7 @@ get_local $0 return end - get_local $13 + get_local $14 i32.const 1073741824 i32.eq if @@ -7298,7 +7297,7 @@ f32.mul return end - get_local $13 + get_local $14 i32.const 1056964608 i32.eq if @@ -7338,7 +7337,7 @@ get_local $2 f32.div get_local $2 - get_local $13 + get_local $14 i32.const 0 i32.lt_s select @@ -7364,8 +7363,8 @@ get_local $2 get_local $2 f32.sub - tee_local $0 - get_local $0 + tee_local $9 + get_local $9 f32.div end else @@ -7374,7 +7373,7 @@ return end f32.const 1 - set_local $9 + set_local $10 get_local $7 i32.const 0 i32.lt_s @@ -7385,8 +7384,8 @@ get_local $0 get_local $0 f32.sub - tee_local $0 - get_local $0 + tee_local $9 + get_local $9 f32.div return end @@ -7396,9 +7395,9 @@ i32.const 1 i32.eq select - set_local $9 + set_local $10 end - get_local $12 + get_local $13 i32.const 1291845632 i32.gt_s if (result f32) @@ -7406,17 +7405,17 @@ i32.const 1065353208 i32.lt_s if - get_local $13 + get_local $14 i32.const 0 i32.lt_s if (result f32) - get_local $9 + get_local $10 f32.const 1000000015047466219876688e6 f32.mul f32.const 1000000015047466219876688e6 f32.mul else - get_local $9 + get_local $10 f32.const 1.0000000031710769e-30 f32.mul f32.const 1.0000000031710769e-30 @@ -7428,17 +7427,17 @@ i32.const 1065353223 i32.gt_s if - get_local $13 + get_local $14 i32.const 0 i32.gt_s if (result f32) - get_local $9 + get_local $10 f32.const 1000000015047466219876688e6 f32.mul f32.const 1000000015047466219876688e6 f32.mul else - get_local $9 + get_local $10 f32.const 1.0000000031710769e-30 f32.mul f32.const 1.0000000031710769e-30 @@ -7483,7 +7482,7 @@ i32.const -4096 i32.and f32.reinterpret/i32 - tee_local $11 + tee_local $12 get_local $15 f32.sub f32.sub @@ -7558,7 +7557,7 @@ f32.div tee_local $16 f32.mul - tee_local $10 + tee_local $11 i32.reinterpret/f32 i32.const -4096 i32.and @@ -7579,27 +7578,27 @@ i32.shl i32.add f32.reinterpret/i32 - tee_local $11 + tee_local $12 get_local $0 f32.sub f32.sub set_local $2 - get_local $10 - get_local $10 + get_local $11 + get_local $11 f32.mul - tee_local $14 - get_local $14 + tee_local $9 + get_local $9 f32.mul f32.const 0.6000000238418579 - get_local $14 + get_local $9 f32.const 0.4285714328289032 - get_local $14 + get_local $9 f32.const 0.3333333432674408 - get_local $14 + get_local $9 f32.const 0.2727281153202057 - get_local $14 + get_local $9 f32.const 0.23066075146198273 - get_local $14 + get_local $9 f32.const 0.20697501301765442 f32.mul f32.add @@ -7617,13 +7616,13 @@ get_local $3 get_local $3 f32.mul - tee_local $14 + tee_local $9 f32.add get_local $17 get_local $16 get_local $15 get_local $3 - get_local $11 + get_local $12 f32.mul f32.sub get_local $3 @@ -7633,7 +7632,7 @@ f32.mul tee_local $0 get_local $3 - get_local $10 + get_local $11 f32.add f32.mul f32.add @@ -7646,22 +7645,22 @@ i32.const -4096 i32.and f32.reinterpret/i32 - tee_local $11 + tee_local $12 f32.const 3 f32.sub - get_local $14 + get_local $9 f32.sub f32.sub set_local $2 get_local $3 - get_local $11 + get_local $12 f32.mul tee_local $15 get_local $0 - get_local $11 + get_local $12 f32.mul get_local $2 - get_local $10 + get_local $11 f32.mul f32.add tee_local $16 @@ -7677,7 +7676,7 @@ get_local $15 f32.sub f32.sub - set_local $10 + set_local $11 f32.const 0.9619140625 get_local $0 f32.mul @@ -7685,7 +7684,7 @@ f32.const -1.1736857413779944e-04 get_local $0 f32.mul - get_local $10 + get_local $11 f32.const 0.9617967009544373 f32.mul f32.add @@ -7713,7 +7712,7 @@ i32.const -4096 i32.and f32.reinterpret/i32 - tee_local $11 + tee_local $12 get_local $3 f32.sub get_local $0 @@ -7732,15 +7731,15 @@ f32.reinterpret/i32 tee_local $0 f32.sub - get_local $11 + get_local $12 f32.mul get_local $1 get_local $2 f32.mul f32.add - tee_local $10 + tee_local $11 get_local $0 - get_local $11 + get_local $12 f32.mul tee_local $0 f32.add @@ -7755,7 +7754,7 @@ i32.const 1124073472 i32.eq if - get_local $10 + get_local $11 f32.const 4.299566569443414e-08 f32.add get_local $2 @@ -7776,7 +7775,7 @@ i32.const -1021968384 i32.eq if - get_local $10 + get_local $11 get_local $2 get_local $0 f32.sub @@ -7848,7 +7847,7 @@ f32.sub set_local $0 end - get_local $10 + get_local $11 get_local $0 f32.add i32.reinterpret/f32 @@ -7859,7 +7858,7 @@ f32.const 0.693145751953125 f32.mul tee_local $15 - get_local $10 + get_local $11 get_local $3 get_local $0 f32.sub @@ -7876,7 +7875,7 @@ get_local $2 f32.mul set_local $3 - get_local $9 + get_local $10 f32.const 1 get_local $2 get_local $2 @@ -7900,9 +7899,9 @@ f32.add f32.mul f32.sub - tee_local $11 + tee_local $12 f32.mul - get_local $11 + get_local $12 f32.const 2 f32.sub f32.div @@ -7942,14 +7941,14 @@ f32.mul return end - get_local $9 + get_local $10 f32.const 1.0000000031710769e-30 f32.mul f32.const 1.0000000031710769e-30 f32.mul return end - get_local $9 + get_local $10 f32.const 1000000015047466219876688e6 f32.mul f32.const 1000000015047466219876688e6 @@ -8002,7 +8001,7 @@ if i32.const 0 i32.const 40 - i32.const 970 + i32.const 972 i32.const 4 call $~lib/env/abort unreachable @@ -8068,7 +8067,7 @@ if i32.const 0 i32.const 40 - i32.const 979 + i32.const 981 i32.const 24 call $~lib/env/abort unreachable @@ -8115,7 +8114,7 @@ if i32.const 0 i32.const 40 - i32.const 2040 + i32.const 2051 i32.const 24 call $~lib/env/abort unreachable @@ -9416,11 +9415,103 @@ end get_local $2 ) - (func $start (; 147 ;) (type $v) - (local $0 i32) - (local $1 i32) + (func $~lib/math/ipow32f (; 147 ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) + (local $2 f32) + (local $3 i32) + get_local $1 + i32.const 31 + i32.shr_s + tee_local $3 + get_local $1 + get_local $3 + i32.add + i32.xor + set_local $1 + f32.const 1 + set_local $2 + loop $continue|0 + get_local $1 + if + get_local $2 + get_local $0 + f32.const 1 + get_local $1 + i32.const 1 + i32.and + select + f32.mul + set_local $2 + get_local $1 + i32.const 1 + i32.shr_s + set_local $1 + get_local $0 + get_local $0 + f32.mul + set_local $0 + br $continue|0 + end + end + get_local $3 + if + f32.const 1 + get_local $2 + f32.div + set_local $2 + end + get_local $2 + ) + (func $~lib/math/ipow64f (; 148 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) (local $2 f64) - (local $3 f32) + (local $3 i32) + get_local $1 + i32.const 31 + i32.shr_s + tee_local $3 + get_local $1 + get_local $3 + i32.add + i32.xor + set_local $1 + f64.const 1 + set_local $2 + loop $continue|0 + get_local $1 + if + get_local $2 + get_local $0 + f64.const 1 + get_local $1 + i32.const 1 + i32.and + select + f64.mul + set_local $2 + get_local $1 + i32.const 1 + i32.shr_s + set_local $1 + get_local $0 + get_local $0 + f64.mul + set_local $0 + br $continue|0 + end + end + get_local $3 + if + f64.const 1 + get_local $2 + f64.div + set_local $2 + end + get_local $2 + ) + (func $start (; 149 ;) (type $v) + (local $0 f64) + (local $1 f32) + (local $2 i32) + (local $3 i32) f64.const 2.718281828459045 get_global $~lib/bindings/Math/E f64.const 0 @@ -31334,30 +31425,28 @@ i64.reinterpret/f64 call $~lib/math/NativeMath.seedRandom loop $repeat|0 - block $break|0 - get_local $0 - f64.convert_s/i32 - f64.const 1e6 - f64.lt - i32.eqz - br_if $break|0 + get_local $2 + f64.convert_s/i32 + f64.const 1e6 + f64.lt + if call $~lib/math/NativeMath.random - tee_local $2 + tee_local $0 f64.const 0 f64.ge - tee_local $1 - if - get_local $2 + tee_local $3 + if (result i32) + get_local $0 f64.const 1 f64.lt - set_local $1 + else + get_local $3 end - get_local $1 if - get_local $0 + get_local $2 i32.const 1 i32.add - set_local $0 + set_local $2 br $repeat|0 else i32.const 0 @@ -31374,32 +31463,30 @@ i64.reinterpret/f64 call $~lib/math/NativeMath.seedRandom i32.const 0 - set_local $0 + set_local $2 loop $repeat|1 - block $break|1 - get_local $0 - f64.convert_s/i32 - f64.const 1e6 - f64.lt - i32.eqz - br_if $break|1 + get_local $2 + f64.convert_s/i32 + f64.const 1e6 + f64.lt + if call $~lib/math/NativeMathf.random - tee_local $3 + tee_local $1 f32.const 0 f32.ge - tee_local $1 - if - get_local $3 + tee_local $3 + if (result i32) + get_local $1 f32.const 1 f32.lt - set_local $1 + else + get_local $3 end - get_local $1 if - get_local $0 + get_local $2 i32.const 1 i32.add - set_local $0 + set_local $2 br $repeat|1 else i32.const 0 @@ -38124,8 +38211,430 @@ call $~lib/env/abort unreachable end + f32.const 0 + i32.const 0 + call $~lib/math/ipow32f + f32.const 1 + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3326 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const nan:0x400000 + i32.const 0 + call $~lib/math/ipow32f + f32.const 1 + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3327 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const nan:0x400000 + i32.const 1 + call $~lib/math/ipow32f + tee_local $1 + get_local $1 + f32.eq + if + i32.const 0 + i32.const 8 + i32.const 3328 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const nan:0x400000 + i32.const -1 + call $~lib/math/ipow32f + tee_local $1 + get_local $1 + f32.eq + if + i32.const 0 + i32.const 8 + i32.const 3329 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const nan:0x400000 + i32.const 2 + call $~lib/math/ipow32f + tee_local $1 + get_local $1 + f32.eq + if + i32.const 0 + i32.const 8 + i32.const 3330 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const inf + i32.const 0 + call $~lib/math/ipow32f + f32.const 1 + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3331 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const inf + i32.const 1 + call $~lib/math/ipow32f + f32.const inf + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3332 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const -inf + i32.const 0 + call $~lib/math/ipow32f + f32.const 1 + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3333 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const -inf + i32.const 1 + call $~lib/math/ipow32f + f32.const -inf + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3334 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const -inf + i32.const 2 + call $~lib/math/ipow32f + f32.const inf + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3335 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const 1 + i32.const 0 + call $~lib/math/ipow32f + f32.const 1 + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3336 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const 3402823466385288598117041e14 + i32.const 2 + call $~lib/math/ipow32f + f32.const inf + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3337 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const 1.401298464324817e-45 + i32.const 2 + call $~lib/math/ipow32f + f32.const 0 + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3338 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const 3402823466385288598117041e14 + i32.const -1 + call $~lib/math/ipow32f + f32.const 2.938735877055719e-39 + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3339 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const 10 + i32.const 36 + call $~lib/math/ipow32f + f32.const 1000000040918478759629753e12 + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3340 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const 10 + i32.const -36 + call $~lib/math/ipow32f + f32.const 9.999999462560281e-37 + f32.ne + if + i32.const 0 + i32.const 8 + i32.const 3341 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const 0 + i32.const 0 + call $~lib/math/ipow64f + f64.const 1 + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3345 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const nan:0x8000000000000 + i32.const 0 + call $~lib/math/ipow64f + f64.const 1 + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3346 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const nan:0x8000000000000 + i32.const 1 + call $~lib/math/ipow64f + tee_local $0 + get_local $0 + f64.eq + if + i32.const 0 + i32.const 8 + i32.const 3347 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const nan:0x8000000000000 + i32.const -1 + call $~lib/math/ipow64f + tee_local $0 + get_local $0 + f64.eq + if + i32.const 0 + i32.const 8 + i32.const 3348 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const nan:0x8000000000000 + i32.const 2 + call $~lib/math/ipow64f + tee_local $0 + get_local $0 + f64.eq + if + i32.const 0 + i32.const 8 + i32.const 3349 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const inf + i32.const 0 + call $~lib/math/ipow64f + f64.const 1 + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3350 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const inf + i32.const 1 + call $~lib/math/ipow64f + f64.const inf + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3351 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const -inf + i32.const 0 + call $~lib/math/ipow64f + f64.const 1 + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3352 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const -inf + i32.const 1 + call $~lib/math/ipow64f + f64.const -inf + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3353 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const -inf + i32.const 2 + call $~lib/math/ipow64f + f64.const inf + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3354 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const 1 + i32.const 0 + call $~lib/math/ipow64f + f64.const 1 + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3355 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const 1797693134862315708145274e284 + i32.const 2 + call $~lib/math/ipow64f + f64.const inf + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3356 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const 5e-324 + i32.const 2 + call $~lib/math/ipow64f + f64.const 0 + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3357 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const 1797693134862315708145274e284 + i32.const -1 + call $~lib/math/ipow64f + f64.const 5.562684646268003e-309 + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3358 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const 10 + i32.const 127 + call $~lib/math/ipow64f + f64.const 1000000000000000195419867e103 + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3359 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const 10 + i32.const -127 + call $~lib/math/ipow64f + f64.const 9.999999999999998e-128 + f64.ne + if + i32.const 0 + i32.const 8 + i32.const 3360 + i32.const 0 + call $~lib/env/abort + unreachable + end ) - (func $null (; 148 ;) (type $v) + (func $null (; 150 ;) (type $v) nop ) ) diff --git a/tests/compiler/std/math.ts b/tests/compiler/std/math.ts index 83dfc216ee..5d10bbbda7 100644 --- a/tests/compiler/std/math.ts +++ b/tests/compiler/std/math.ts @@ -3320,3 +3320,41 @@ assert(ipow64(3, 64) == 8733086111712066817); // should overflow assert(ipow64(3, 128) == -9204772141784466943); // should overflow assert(ipow64(57055, 3) + ipow64(339590, 3) == 39347712995520375); // add Buterin's twit example + +// ipow32f ///////////////////////////////////////////////////////////////////////////////////// + +assert(ipow32f(0, 0) == 1.0); +assert(ipow32f(NaN, 0) == 1.0); +assert(isNaN(ipow32f(NaN, 1))); +assert(isNaN(ipow32f(NaN, -1))); +assert(isNaN(ipow32f(NaN, 2))); +assert(ipow32f(Infinity, 0) == 1.0); +assert(ipow32f(Infinity, 1) == Infinity); +assert(ipow32f(-Infinity, 0) == 1.0); +assert(ipow32f(-Infinity, 1) == -Infinity); +assert(ipow32f(-Infinity, 2) == Infinity); +assert(ipow32f(1.0, 0) == 1.0); +assert(ipow32f(f32.MAX_VALUE, 2) == Infinity); +assert(ipow32f(f32.MIN_VALUE, 2) == 0.0); +assert(ipow32f(f32.MAX_VALUE, -1) == 2.938735877055719e-39); +assert(ipow32f(10.0, 36) == 1.0000000409184788e+36); +assert(ipow32f(10.0,-36) == 9.999999462560281e-37); + +// ipow64f ///////////////////////////////////////////////////////////////////////////////////// + +assert(ipow64f(0, 0) == 1.0); +assert(ipow64f(NaN, 0) == 1.0); +assert(isNaN(ipow64f(NaN, 1))); +assert(isNaN(ipow64f(NaN, -1))); +assert(isNaN(ipow64f(NaN, 2))); +assert(ipow64f(Infinity, 0) == 1.0); +assert(ipow64f(Infinity, 1) == Infinity); +assert(ipow64f(-Infinity, 0) == 1.0); +assert(ipow64f(-Infinity, 1) == -Infinity); +assert(ipow64f(-Infinity, 2) == Infinity); +assert(ipow64f(1.0, 0) == 1.0); +assert(ipow64f(f64.MAX_VALUE, 2) == Infinity); +assert(ipow64f(f64.MIN_VALUE, 2) == 0.0); +assert(ipow64f(f64.MAX_VALUE, -1) == 5.562684646268003e-309); +assert(ipow64f(10.0, 127) == 1.0000000000000002e+127); +assert(ipow64f(10.0,-127) == 9.999999999999998e-128); diff --git a/tests/compiler/std/math.untouched.wat b/tests/compiler/std/math.untouched.wat index a2c93e4b51..c24aa0e314 100644 --- a/tests/compiler/std/math.untouched.wat +++ b/tests/compiler/std/math.untouched.wat @@ -95,6 +95,8 @@ (global $~lib/math/random_state1_32 (mut i32) (i32.const 0)) (global $ASC_SHRINK_LEVEL i32 (i32.const 0)) (global $~lib/builtins/f64.MAX_VALUE f64 (f64.const 1797693134862315708145274e284)) + (global $~lib/builtins/f32.MAX_VALUE f32 (f32.const 3402823466385288598117041e14)) + (global $~lib/builtins/f32.MIN_VALUE f32 (f32.const 1.401298464324817e-45)) (global $HEAP_BASE i32 (i32.const 68)) (export "memory" (memory $0)) (export "table" (table $0)) @@ -3952,7 +3954,6 @@ (local $3 f64) (local $4 f64) (local $5 f64) - (local $6 f64) get_local $0 i64.reinterpret/f64 set_local $1 @@ -4073,14 +4074,12 @@ get_local $5 f64.div set_local $4 - get_local $3 - get_local $3 - f64.add - set_local $6 get_local $4 get_local $3 f64.sub - get_local $6 + f64.const 2 + get_local $3 + f64.mul get_local $4 f64.add f64.div @@ -4638,8 +4637,6 @@ get_local $0 f64.const 8988465674311579538646525e283 f64.mul - set_local $0 - get_local $0 return end get_local $0 @@ -5212,8 +5209,6 @@ get_local $0 f32.const 1701411834604692317316873e14 f32.mul - set_local $0 - get_local $0 return else get_local $1 @@ -5387,8 +5382,8 @@ block $~lib/math/expo2f|inlined.0 (result f32) i32.const 127 i32.const 235 - i32.const 2 - i32.div_u + i32.const 1 + i32.shr_u i32.add i32.const 23 i32.shl @@ -7043,8 +7038,9 @@ (local $6 i64) (local $7 i64) (local $8 i32) - (local $9 i64) + (local $9 f64) (local $10 i64) + (local $11 i64) get_local $0 i64.reinterpret/f64 set_local $2 @@ -7096,21 +7092,21 @@ get_local $0 get_local $1 f64.mul - get_local $0 - get_local $1 - f64.mul + set_local $9 + get_local $9 + get_local $9 f64.div return end get_local $2 i64.const 1 i64.shl - set_local $9 - get_local $9 + set_local $10 + get_local $10 get_local $7 i64.le_u if - get_local $9 + get_local $10 get_local $7 i64.eq if @@ -7246,13 +7242,13 @@ i64.const 11 i64.shl i64.clz - set_local $10 + set_local $11 get_local $4 - get_local $10 + get_local $11 i64.sub set_local $4 get_local $2 - get_local $10 + get_local $11 i64.shl set_local $2 get_local $4 @@ -7327,8 +7323,9 @@ (local $6 i32) (local $7 i32) (local $8 i32) - (local $9 i32) + (local $9 f32) (local $10 i32) + (local $11 i32) get_local $0 i32.reinterpret/f32 set_local $2 @@ -7380,21 +7377,21 @@ get_local $0 get_local $1 f32.mul - get_local $0 - get_local $1 - f32.mul + set_local $9 + get_local $9 + get_local $9 f32.div return end get_local $2 i32.const 1 i32.shl - set_local $9 - get_local $9 + set_local $10 + get_local $10 get_local $7 i32.le_u if - get_local $9 + get_local $10 get_local $7 i32.eq if @@ -7530,13 +7527,13 @@ i32.const 8 i32.shl i32.clz - set_local $10 + set_local $11 get_local $4 - get_local $10 + get_local $11 i32.sub set_local $4 get_local $2 - get_local $10 + get_local $11 i32.shl set_local $2 get_local $4 @@ -7594,7 +7591,7 @@ (local $11 i32) (local $12 i32) (local $13 i32) - (local $14 f64) + (local $14 i32) (local $15 f64) (local $16 f64) (local $17 f64) @@ -7606,10 +7603,10 @@ (local $23 f64) (local $24 f64) (local $25 f64) - (local $26 i32) - (local $27 i32) - (local $28 f64) - (local $29 f64) + (local $26 f64) + (local $27 f64) + (local $28 i32) + (local $29 i32) (local $30 f64) (local $31 f64) (local $32 f64) @@ -7620,7 +7617,8 @@ (local $37 f64) (local $38 f64) (local $39 f64) - (local $40 i32) + (local $40 f64) + (local $41 i32) get_local $0 i64.reinterpret/f64 set_local $2 @@ -7732,34 +7730,34 @@ i32.const 1023 i32.sub set_local $11 - i32.const 52 - i32.const 20 get_local $11 i32.const 20 i32.gt_s + set_local $9 + i32.const 52 + i32.const 20 + get_local $9 select get_local $11 i32.sub - set_local $9 + set_local $12 get_local $6 get_local $8 - get_local $11 - i32.const 20 - i32.gt_s - select - set_local $12 - get_local $12 get_local $9 - i32.shr_s + select set_local $13 get_local $13 - get_local $9 - i32.shl get_local $12 + i32.shr_s + set_local $14 + get_local $14 + get_local $12 + i32.shl + get_local $13 i32.eq if i32.const 2 - get_local $13 + get_local $14 i32.const 1 i32.and i32.sub @@ -7858,41 +7856,41 @@ end get_local $0 f64.abs - set_local $14 + set_local $15 get_local $4 i32.const 0 i32.eq if get_local $7 - i32.const 2146435072 + i32.const 0 i32.eq - tee_local $13 + tee_local $14 if (result i32) - get_local $13 + get_local $14 else get_local $7 - i32.const 0 + i32.const 2146435072 i32.eq end - tee_local $13 + tee_local $14 if (result i32) - get_local $13 + get_local $14 else get_local $7 i32.const 1072693248 i32.eq end if - get_local $14 - set_local $15 + get_local $15 + set_local $16 get_local $5 i32.const 0 i32.lt_s if f64.const 1 - get_local $15 + get_local $16 f64.div - set_local $15 + set_local $16 end get_local $3 i32.const 0 @@ -7906,31 +7904,31 @@ i32.const 0 i32.eq if - get_local $15 - get_local $15 - f64.sub - get_local $15 - get_local $15 + get_local $16 + get_local $16 f64.sub + set_local $17 + get_local $17 + get_local $17 f64.div - set_local $15 + set_local $16 else get_local $10 i32.const 1 i32.eq if - get_local $15 + get_local $16 f64.neg - set_local $15 + set_local $16 end end end - get_local $15 + get_local $16 return end end f64.const 1 - set_local $16 + set_local $18 get_local $3 i32.const 0 i32.lt_s @@ -7942,9 +7940,9 @@ get_local $0 get_local $0 f64.sub - get_local $0 - get_local $0 - f64.sub + set_local $17 + get_local $17 + get_local $17 f64.div return end @@ -7953,7 +7951,7 @@ i32.eq if f64.const -1 - set_local $16 + set_local $18 end end get_local $8 @@ -8009,13 +8007,13 @@ i32.const 0 i32.lt_s if (result f64) - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -8031,13 +8029,13 @@ i32.const 0 i32.gt_s if (result f64) - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -8045,98 +8043,98 @@ end return end - get_local $14 + get_local $15 f64.const 1 f64.sub - set_local $22 - get_local $22 - get_local $22 + set_local $24 + get_local $24 + get_local $24 f64.mul f64.const 0.5 - get_local $22 + get_local $24 f64.const 0.3333333333333333 - get_local $22 + get_local $24 f64.const 0.25 f64.mul f64.sub f64.mul f64.sub f64.mul - set_local $25 + set_local $27 f64.const 1.4426950216293335 - get_local $22 + get_local $24 f64.mul - set_local $23 - get_local $22 + set_local $25 + get_local $24 f64.const 1.9259629911266175e-08 f64.mul - get_local $25 + get_local $27 f64.const 1.4426950408889634 f64.mul f64.sub - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.add - set_local $17 - get_local $17 + set_local $19 + get_local $19 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $17 - get_local $24 - get_local $17 - get_local $23 + set_local $19 + get_local $26 + get_local $19 + get_local $25 f64.sub f64.sub - set_local $18 + set_local $20 else i32.const 0 - set_local $27 + set_local $29 get_local $7 i32.const 1048576 i32.lt_s if - get_local $14 + get_local $15 f64.const 9007199254740992 f64.mul - set_local $14 - get_local $27 + set_local $15 + get_local $29 i32.const 53 i32.sub - set_local $27 - get_local $14 + set_local $29 + get_local $15 i64.reinterpret/f64 i64.const 32 i64.shr_u i32.wrap/i64 set_local $7 end - get_local $27 + get_local $29 get_local $7 i32.const 20 i32.shr_s i32.const 1023 i32.sub i32.add - set_local $27 + set_local $29 get_local $7 i32.const 1048575 i32.and - set_local $26 - get_local $26 + set_local $28 + get_local $28 i32.const 1072693248 i32.or set_local $7 - get_local $26 + get_local $28 i32.const 235662 i32.le_s if i32.const 0 set_local $11 else - get_local $26 + get_local $28 i32.const 767610 i32.lt_s if @@ -8145,17 +8143,17 @@ else i32.const 0 set_local $11 - get_local $27 + get_local $29 i32.const 1 i32.add - set_local $27 + set_local $29 get_local $7 i32.const 1048576 i32.sub set_local $7 end end - get_local $14 + get_local $15 i64.reinterpret/f64 i64.const 4294967295 i64.and @@ -8165,34 +8163,34 @@ i64.shl i64.or f64.reinterpret/i64 - set_local $14 + set_local $15 f64.const 1.5 f64.const 1 get_local $11 select - set_local $34 - get_local $14 - get_local $34 + set_local $35 + get_local $15 + get_local $35 f64.sub - set_local $23 + set_local $25 f64.const 1 - get_local $14 - get_local $34 + get_local $15 + get_local $35 f64.add f64.div - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.mul - set_local $28 - get_local $28 - set_local $30 - get_local $30 + set_local $17 + get_local $17 + set_local $31 + get_local $31 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $30 + set_local $31 get_local $7 i32.const 1 i32.shr_s @@ -8208,42 +8206,42 @@ i64.const 32 i64.shl f64.reinterpret/i64 - set_local $32 - get_local $14 - get_local $32 - get_local $34 + set_local $33 + get_local $15 + get_local $33 + get_local $35 f64.sub f64.sub - set_local $33 - get_local $24 - get_local $23 - get_local $30 - get_local $32 + set_local $34 + get_local $26 + get_local $25 + get_local $31 + get_local $33 f64.mul f64.sub - get_local $30 - get_local $33 + get_local $31 + get_local $34 f64.mul f64.sub f64.mul - set_local $31 - get_local $28 - get_local $28 + set_local $32 + get_local $17 + get_local $17 f64.mul - set_local $29 - get_local $29 - get_local $29 + set_local $30 + get_local $30 + get_local $30 f64.mul f64.const 0.5999999999999946 - get_local $29 + get_local $30 f64.const 0.4285714285785502 - get_local $29 + get_local $30 f64.const 0.33333332981837743 - get_local $29 + get_local $30 f64.const 0.272728123808534 - get_local $29 + get_local $30 f64.const 0.23066074577556175 - get_local $29 + get_local $30 f64.const 0.20697501780033842 f64.mul f64.add @@ -8256,184 +8254,184 @@ f64.mul f64.add f64.mul - set_local $21 - get_local $21 + set_local $23 + get_local $23 + get_local $32 get_local $31 - get_local $30 - get_local $28 + get_local $17 f64.add f64.mul f64.add - set_local $21 - get_local $30 - get_local $30 + set_local $23 + get_local $31 + get_local $31 f64.mul - set_local $29 + set_local $30 f64.const 3 - get_local $29 + get_local $30 f64.add - get_local $21 + get_local $23 f64.add - set_local $32 - get_local $32 + set_local $33 + get_local $33 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $32 - get_local $21 - get_local $32 + set_local $33 + get_local $23 + get_local $33 f64.const 3 f64.sub - get_local $29 + get_local $30 f64.sub f64.sub - set_local $33 - get_local $30 - get_local $32 - f64.mul - set_local $23 + set_local $34 get_local $31 - get_local $32 + get_local $33 f64.mul + set_local $25 + get_local $32 get_local $33 - get_local $28 + f64.mul + get_local $34 + get_local $17 f64.mul f64.add - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.add - set_local $19 - get_local $19 + set_local $21 + get_local $21 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $19 - get_local $24 - get_local $19 - get_local $23 + set_local $21 + get_local $26 + get_local $21 + get_local $25 f64.sub f64.sub - set_local $20 + set_local $22 f64.const 0.9617967009544373 - get_local $19 + get_local $21 f64.mul - set_local $35 + set_local $36 f64.const 1.350039202129749e-08 f64.const 0 get_local $11 select - set_local $36 + set_local $37 f64.const -7.028461650952758e-09 - get_local $19 + get_local $21 f64.mul - get_local $20 + get_local $22 f64.const 0.9617966939259756 f64.mul f64.add - get_local $36 + get_local $37 f64.add - set_local $37 - get_local $27 + set_local $38 + get_local $29 f64.convert_s/i32 - set_local $22 + set_local $24 f64.const 0.5849624872207642 f64.const 0 get_local $11 select - set_local $38 - get_local $35 - get_local $37 - f64.add + set_local $39 + get_local $36 get_local $38 f64.add - get_local $22 + get_local $39 f64.add - set_local $17 - get_local $17 + get_local $24 + f64.add + set_local $19 + get_local $19 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $17 - get_local $37 - get_local $17 - get_local $22 - f64.sub + set_local $19 get_local $38 + get_local $19 + get_local $24 f64.sub - get_local $35 + get_local $39 f64.sub + get_local $36 f64.sub - set_local $18 + f64.sub + set_local $20 end get_local $1 - set_local $39 - get_local $39 + set_local $40 + get_local $40 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $39 + set_local $40 get_local $1 - get_local $39 + get_local $40 f64.sub - get_local $17 + get_local $19 f64.mul get_local $1 - get_local $18 + get_local $20 f64.mul f64.add - set_local $20 - get_local $39 - get_local $17 - f64.mul - set_local $19 - get_local $20 + set_local $22 + get_local $40 get_local $19 + f64.mul + set_local $21 + get_local $22 + get_local $21 f64.add - set_local $15 - get_local $15 + set_local $16 + get_local $16 i64.reinterpret/f64 set_local $2 get_local $2 i64.const 32 i64.shr_u i32.wrap/i64 - set_local $26 + set_local $28 get_local $2 i32.wrap/i64 - set_local $40 - get_local $26 + set_local $41 + get_local $28 i32.const 1083179008 i32.ge_s if - get_local $26 + get_local $28 i32.const 1083179008 i32.sub - get_local $40 + get_local $41 i32.or i32.const 0 i32.ne if - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul return end - get_local $20 + get_local $22 f64.const 8.008566259537294e-17 f64.add - get_local $15 - get_local $19 + get_local $16 + get_local $21 f64.sub f64.gt if - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 @@ -8441,34 +8439,34 @@ return end else - get_local $26 + get_local $28 i32.const 2147483647 i32.and i32.const 1083231232 i32.ge_s if - get_local $26 + get_local $28 i32.const -1064252416 i32.sub - get_local $40 + get_local $41 i32.or i32.const 0 i32.ne if - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 f64.mul return end - get_local $20 - get_local $15 - get_local $19 + get_local $22 + get_local $16 + get_local $21 f64.sub f64.le if - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -8477,31 +8475,31 @@ end end end - get_local $26 + get_local $28 i32.const 2147483647 i32.and - set_local $40 - get_local $40 + set_local $41 + get_local $41 i32.const 20 i32.shr_s i32.const 1023 i32.sub set_local $11 i32.const 0 - set_local $27 - get_local $40 + set_local $29 + get_local $41 i32.const 1071644672 i32.gt_s if - get_local $26 + get_local $28 i32.const 1048576 get_local $11 i32.const 1 i32.add i32.shr_s i32.add - set_local $27 - get_local $27 + set_local $29 + get_local $29 i32.const 2147483647 i32.and i32.const 20 @@ -8510,8 +8508,8 @@ i32.sub set_local $11 f64.const 0 - set_local $22 - get_local $27 + set_local $24 + get_local $29 i32.const 1048575 get_local $11 i32.shr_s @@ -8522,8 +8520,8 @@ i64.const 32 i64.shl f64.reinterpret/i64 - set_local $22 - get_local $27 + set_local $24 + get_local $29 i32.const 1048575 i32.and i32.const 1048576 @@ -8532,71 +8530,71 @@ get_local $11 i32.sub i32.shr_s - set_local $27 - get_local $26 + set_local $29 + get_local $28 i32.const 0 i32.lt_s if i32.const 0 - get_local $27 + get_local $29 i32.sub - set_local $27 + set_local $29 end - get_local $19 - get_local $22 + get_local $21 + get_local $24 f64.sub - set_local $19 + set_local $21 end - get_local $20 - get_local $19 - f64.add - set_local $22 get_local $22 + get_local $21 + f64.add + set_local $24 + get_local $24 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $22 - get_local $22 + set_local $24 + get_local $24 f64.const 0.6931471824645996 f64.mul - set_local $23 - get_local $20 + set_local $25 get_local $22 - get_local $19 + get_local $24 + get_local $21 f64.sub f64.sub f64.const 0.6931471805599453 f64.mul - get_local $22 + get_local $24 f64.const -1.904654299957768e-09 f64.mul f64.add - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.add - set_local $15 - get_local $24 - get_local $15 - get_local $23 + set_local $16 + get_local $26 + get_local $16 + get_local $25 f64.sub f64.sub - set_local $25 - get_local $15 - get_local $15 + set_local $27 + get_local $16 + get_local $16 f64.mul - set_local $22 - get_local $15 - get_local $22 + set_local $24 + get_local $16 + get_local $24 f64.const 0.16666666666666602 - get_local $22 + get_local $24 f64.const -2.7777777777015593e-03 - get_local $22 + get_local $24 f64.const 6.613756321437934e-05 - get_local $22 + get_local $24 f64.const -1.6533902205465252e-06 - get_local $22 + get_local $24 f64.const 4.1381367970572385e-08 f64.mul f64.add @@ -8608,64 +8606,64 @@ f64.add f64.mul f64.sub - set_local $17 - get_local $15 - get_local $17 + set_local $19 + get_local $16 + get_local $19 f64.mul - get_local $17 + get_local $19 f64.const 2 f64.sub f64.div - get_local $25 - get_local $15 - get_local $25 + get_local $27 + get_local $16 + get_local $27 f64.mul f64.add f64.sub - set_local $21 + set_local $23 f64.const 1 - get_local $21 - get_local $15 + get_local $23 + get_local $16 f64.sub f64.sub - set_local $15 - get_local $15 + set_local $16 + get_local $16 i64.reinterpret/f64 i64.const 32 i64.shr_u i32.wrap/i64 - set_local $26 - get_local $26 - get_local $27 + set_local $28 + get_local $28 + get_local $29 i32.const 20 i32.shl i32.add - set_local $26 - get_local $26 + set_local $28 + get_local $28 i32.const 20 i32.shr_s i32.const 0 i32.le_s if - get_local $15 - get_local $27 + get_local $16 + get_local $29 call $~lib/math/NativeMath.scalbn - set_local $15 + set_local $16 else - get_local $15 + get_local $16 i64.reinterpret/f64 i64.const 4294967295 i64.and - get_local $26 + get_local $28 i64.extend_s/i32 i64.const 32 i64.shl i64.or f64.reinterpret/i64 - set_local $15 + set_local $16 end + get_local $18 get_local $16 - get_local $15 f64.mul ) (func $std/math/test_pow (; 125 ;) (type $FFFFii) (param $0 f64) (param $1 f64) (param $2 f64) (param $3 f64) (param $4 i32) (result i32) @@ -8719,9 +8717,9 @@ (local $20 f32) (local $21 f32) (local $22 f32) - (local $23 i32) + (local $23 f32) (local $24 i32) - (local $25 f32) + (local $25 i32) (local $26 f32) (local $27 f32) (local $28 f32) @@ -8794,16 +8792,16 @@ i32.const 127 i32.sub set_local $9 - get_local $5 i32.const 23 get_local $9 i32.sub + set_local $6 + get_local $5 + get_local $6 i32.shr_s set_local $8 get_local $8 - i32.const 23 - get_local $9 - i32.sub + get_local $6 i32.shl get_local $5 i32.eq @@ -8946,9 +8944,9 @@ get_local $11 get_local $11 f32.sub - get_local $11 - get_local $11 - f32.sub + set_local $12 + get_local $12 + get_local $12 f32.div set_local $11 else @@ -8966,7 +8964,7 @@ return end f32.const 1 - set_local $12 + set_local $13 get_local $2 i32.const 0 i32.lt_s @@ -8978,9 +8976,9 @@ get_local $0 get_local $0 f32.sub - get_local $0 - get_local $0 - f32.sub + set_local $12 + get_local $12 + get_local $12 f32.div return end @@ -8989,7 +8987,7 @@ i32.eq if f32.const -1 - set_local $12 + set_local $13 end end get_local $5 @@ -9004,13 +9002,13 @@ i32.const 0 i32.lt_s if (result f32) - get_local $12 + get_local $13 f32.const 1000000015047466219876688e6 f32.mul f32.const 1000000015047466219876688e6 f32.mul else - get_local $12 + get_local $13 f32.const 1.0000000031710769e-30 f32.mul f32.const 1.0000000031710769e-30 @@ -9026,13 +9024,13 @@ i32.const 0 i32.gt_s if (result f32) - get_local $12 + get_local $13 f32.const 1000000015047466219876688e6 f32.mul f32.const 1000000015047466219876688e6 f32.mul else - get_local $12 + get_local $13 f32.const 1.0000000031710769e-30 f32.mul f32.const 1.0000000031710769e-30 @@ -9043,54 +9041,54 @@ get_local $10 f32.const 1 f32.sub - set_local $17 - get_local $17 - get_local $17 + set_local $18 + get_local $18 + get_local $18 f32.mul f32.const 0.5 - get_local $17 + get_local $18 f32.const 0.3333333432674408 - get_local $17 + get_local $18 f32.const 0.25 f32.mul f32.sub f32.mul f32.sub f32.mul - set_local $20 + set_local $21 f32.const 1.44268798828125 - get_local $17 + get_local $18 f32.mul - set_local $18 - get_local $17 + set_local $19 + get_local $18 f32.const 7.052607543300837e-06 f32.mul - get_local $20 + get_local $21 f32.const 1.4426950216293335 f32.mul f32.sub - set_local $19 - get_local $18 + set_local $20 get_local $19 + get_local $20 f32.add - set_local $13 - get_local $13 + set_local $14 + get_local $14 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -4096 i32.and f32.reinterpret/i32 - set_local $13 + set_local $14 + get_local $20 + get_local $14 get_local $19 - get_local $13 - get_local $18 f32.sub f32.sub - set_local $14 + set_local $15 else i32.const 0 - set_local $23 + set_local $24 get_local $4 i32.const 8388608 i32.lt_s @@ -9099,22 +9097,22 @@ f32.const 16777216 f32.mul set_local $10 - get_local $23 + get_local $24 i32.const 24 i32.sub - set_local $23 + set_local $24 get_local $10 i32.reinterpret/f32 set_local $4 end - get_local $23 + get_local $24 get_local $4 i32.const 23 i32.shr_s i32.const 127 i32.sub i32.add - set_local $23 + set_local $24 get_local $4 i32.const 8388607 i32.and @@ -9139,10 +9137,10 @@ else i32.const 0 set_local $9 - get_local $23 + get_local $24 i32.const 1 i32.add - set_local $23 + set_local $24 get_local $4 i32.const 8388608 i32.sub @@ -9160,23 +9158,23 @@ get_local $10 get_local $30 f32.sub - set_local $18 + set_local $19 f32.const 1 get_local $10 get_local $30 f32.add f32.div - set_local $19 - get_local $18 + set_local $20 get_local $19 + get_local $20 f32.mul - set_local $16 - get_local $16 + set_local $17 + get_local $17 set_local $26 get_local $26 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -4096 i32.and f32.reinterpret/i32 @@ -9188,8 +9186,8 @@ i32.and i32.const 536870912 i32.or - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const 4194304 i32.add get_local $9 @@ -9204,8 +9202,8 @@ f32.sub f32.sub set_local $29 + get_local $20 get_local $19 - get_local $18 get_local $26 get_local $28 f32.mul @@ -9216,23 +9214,23 @@ f32.sub f32.mul set_local $27 - get_local $16 - get_local $16 + get_local $17 + get_local $17 f32.mul - set_local $25 - get_local $25 - get_local $25 + set_local $12 + get_local $12 + get_local $12 f32.mul f32.const 0.6000000238418579 - get_local $25 + get_local $12 f32.const 0.4285714328289032 - get_local $25 + get_local $12 f32.const 0.3333333432674408 - get_local $25 + get_local $12 f32.const 0.2727281153202057 - get_local $25 + get_local $12 f32.const 0.23066075146198273 - get_local $25 + get_local $12 f32.const 0.20697501301765442 f32.mul f32.add @@ -9245,73 +9243,73 @@ f32.mul f32.add f32.mul - set_local $15 - get_local $15 + set_local $16 + get_local $16 get_local $27 get_local $26 - get_local $16 + get_local $17 f32.add f32.mul f32.add - set_local $15 + set_local $16 get_local $26 get_local $26 f32.mul - set_local $25 + set_local $12 f32.const 3 - get_local $25 + get_local $12 f32.add - get_local $15 + get_local $16 f32.add set_local $28 get_local $28 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -4096 i32.and f32.reinterpret/i32 set_local $28 - get_local $15 + get_local $16 get_local $28 f32.const 3 f32.sub - get_local $25 + get_local $12 f32.sub f32.sub set_local $29 get_local $26 get_local $28 f32.mul - set_local $18 + set_local $19 get_local $27 get_local $28 f32.mul get_local $29 - get_local $16 + get_local $17 f32.mul f32.add - set_local $19 - get_local $18 + set_local $20 get_local $19 + get_local $20 f32.add - set_local $21 - get_local $21 + set_local $22 + get_local $22 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -4096 i32.and f32.reinterpret/i32 - set_local $21 + set_local $22 + get_local $20 + get_local $22 get_local $19 - get_local $21 - get_local $18 f32.sub f32.sub - set_local $22 + set_local $23 f32.const 0.9619140625 - get_local $21 + get_local $22 f32.mul set_local $31 f32.const 1.5632208487659227e-06 @@ -9320,18 +9318,18 @@ select set_local $32 f32.const -1.1736857413779944e-04 - get_local $21 - f32.mul get_local $22 + f32.mul + get_local $23 f32.const 0.9617967009544373 f32.mul f32.add get_local $32 f32.add set_local $33 - get_local $23 + get_local $24 f32.convert_s/i32 - set_local $17 + set_local $18 f32.const 0.5849609375 f32.const 0 get_local $9 @@ -9342,32 +9340,32 @@ f32.add get_local $34 f32.add - get_local $17 + get_local $18 f32.add - set_local $13 - get_local $13 + set_local $14 + get_local $14 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -4096 i32.and f32.reinterpret/i32 - set_local $13 + set_local $14 get_local $33 - get_local $13 - get_local $17 + get_local $14 + get_local $18 f32.sub get_local $34 f32.sub get_local $31 f32.sub f32.sub - set_local $14 + set_local $15 end get_local $1 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -4096 i32.and f32.reinterpret/i32 @@ -9375,19 +9373,19 @@ get_local $1 get_local $35 f32.sub - get_local $13 + get_local $14 f32.mul get_local $1 - get_local $14 + get_local $15 f32.mul f32.add - set_local $22 + set_local $23 get_local $35 - get_local $13 + get_local $14 f32.mul - set_local $21 + set_local $22 + get_local $23 get_local $22 - get_local $21 f32.add set_local $11 get_local $11 @@ -9397,7 +9395,7 @@ i32.const 1124073472 i32.gt_s if - get_local $12 + get_local $13 f32.const 1000000015047466219876688e6 f32.mul f32.const 1000000015047466219876688e6 @@ -9408,15 +9406,15 @@ i32.const 1124073472 i32.eq if - get_local $22 + get_local $23 f32.const 4.299566569443414e-08 f32.add get_local $11 - get_local $21 + get_local $22 f32.sub f32.gt if - get_local $12 + get_local $13 f32.const 1000000015047466219876688e6 f32.mul f32.const 1000000015047466219876688e6 @@ -9430,7 +9428,7 @@ i32.const 1125515264 i32.gt_s if - get_local $12 + get_local $13 f32.const 1.0000000031710769e-30 f32.mul f32.const 1.0000000031710769e-30 @@ -9441,13 +9439,13 @@ i32.const -1021968384 i32.eq if - get_local $22 + get_local $23 get_local $11 - get_local $21 + get_local $22 f32.sub f32.le if - get_local $12 + get_local $13 f32.const 1.0000000031710769e-30 f32.mul f32.const 1.0000000031710769e-30 @@ -9469,7 +9467,7 @@ i32.sub set_local $9 i32.const 0 - set_local $23 + set_local $24 get_local $36 i32.const 1056964608 i32.gt_s @@ -9481,8 +9479,8 @@ i32.add i32.shr_s i32.add - set_local $23 - get_local $23 + set_local $24 + get_local $24 i32.const 2147483647 i32.and i32.const 23 @@ -9490,7 +9488,7 @@ i32.const 127 i32.sub set_local $9 - get_local $23 + get_local $24 i32.const 8388607 get_local $9 i32.shr_s @@ -9498,8 +9496,8 @@ i32.xor i32.and f32.reinterpret/i32 - set_local $17 - get_local $23 + set_local $18 + get_local $24 i32.const 8388607 i32.and i32.const 8388608 @@ -9508,73 +9506,73 @@ get_local $9 i32.sub i32.shr_s - set_local $23 + set_local $24 get_local $8 i32.const 0 i32.lt_s if i32.const 0 - get_local $23 + get_local $24 i32.sub - set_local $23 + set_local $24 end - get_local $21 - get_local $17 + get_local $22 + get_local $18 f32.sub - set_local $21 + set_local $22 end + get_local $23 get_local $22 - get_local $21 f32.add - set_local $17 - get_local $17 + set_local $18 + get_local $18 i32.reinterpret/f32 - set_local $24 - get_local $24 + set_local $25 + get_local $25 i32.const -32768 i32.and f32.reinterpret/i32 - set_local $17 - get_local $17 + set_local $18 + get_local $18 f32.const 0.693145751953125 f32.mul - set_local $18 + set_local $19 + get_local $23 + get_local $18 get_local $22 - get_local $17 - get_local $21 f32.sub f32.sub f32.const 0.6931471824645996 f32.mul - get_local $17 + get_local $18 f32.const 1.4286065379565116e-06 f32.mul f32.add - set_local $19 - get_local $18 + set_local $20 get_local $19 + get_local $20 f32.add set_local $11 - get_local $19 + get_local $20 get_local $11 - get_local $18 + get_local $19 f32.sub f32.sub - set_local $20 + set_local $21 get_local $11 get_local $11 f32.mul - set_local $17 + set_local $18 get_local $11 - get_local $17 + get_local $18 f32.const 0.1666666716337204 - get_local $17 + get_local $18 f32.const -2.7777778450399637e-03 - get_local $17 + get_local $18 f32.const 6.61375597701408e-05 - get_local $17 + get_local $18 f32.const -1.6533901998627698e-06 - get_local $17 + get_local $18 f32.const 4.138136944220605e-08 f32.mul f32.add @@ -9586,23 +9584,23 @@ f32.add f32.mul f32.sub - set_local $13 + set_local $14 get_local $11 - get_local $13 + get_local $14 f32.mul - get_local $13 + get_local $14 f32.const 2 f32.sub f32.div - get_local $20 + get_local $21 get_local $11 - get_local $20 + get_local $21 f32.mul f32.add f32.sub - set_local $15 + set_local $16 f32.const 1 - get_local $15 + get_local $16 get_local $11 f32.sub f32.sub @@ -9611,7 +9609,7 @@ i32.reinterpret/f32 set_local $8 get_local $8 - get_local $23 + get_local $24 i32.const 23 i32.shl i32.add @@ -9623,7 +9621,7 @@ i32.le_s if get_local $11 - get_local $23 + get_local $24 call $~lib/math/NativeMathf.scalbn set_local $11 else @@ -9631,7 +9629,7 @@ f32.reinterpret/i32 set_local $11 end - get_local $12 + get_local $13 get_local $11 f32.mul ) @@ -9714,7 +9712,7 @@ if i32.const 0 i32.const 40 - i32.const 970 + i32.const 972 i32.const 4 call $~lib/env/abort unreachable @@ -9746,7 +9744,7 @@ if i32.const 0 i32.const 40 - i32.const 979 + i32.const 981 i32.const 24 call $~lib/env/abort unreachable @@ -9803,7 +9801,7 @@ if i32.const 0 i32.const 40 - i32.const 2040 + i32.const 2051 i32.const 24 call $~lib/env/abort unreachable @@ -9951,10 +9949,11 @@ (local $5 i64) (local $6 i32) (local $7 i32) - (local $8 i64) - (local $9 i32) - (local $10 i64) - (local $11 f64) + (local $8 f64) + (local $9 i64) + (local $10 i32) + (local $11 i64) + (local $12 f64) get_local $0 i64.reinterpret/f64 set_local $2 @@ -10002,9 +10001,9 @@ get_local $0 get_local $1 f64.mul - get_local $0 - get_local $1 - f64.mul + set_local $8 + get_local $8 + get_local $8 f64.div return end @@ -10018,38 +10017,38 @@ return end get_local $2 - set_local $8 + set_local $9 get_local $4 i64.eqz if get_local $4 - get_local $8 + get_local $9 i64.const 12 i64.shl i64.clz i64.sub set_local $4 - get_local $8 + get_local $9 i64.const 0 get_local $4 i64.sub i64.const 1 i64.add i64.shl - set_local $8 + set_local $9 else - get_local $8 + get_local $9 i64.const -1 i64.const 12 i64.shr_u i64.and - set_local $8 - get_local $8 + set_local $9 + get_local $9 i64.const 1 i64.const 52 i64.shl i64.or - set_local $8 + set_local $9 end get_local $5 i64.eqz @@ -10084,7 +10083,7 @@ set_local $3 end i32.const 0 - set_local $9 + set_local $10 block $break|0 loop $continue|0 get_local $4 @@ -10109,27 +10108,27 @@ i64.gt_s if block - get_local $8 + get_local $9 get_local $3 i64.ge_u if - get_local $8 + get_local $9 get_local $3 i64.sub - set_local $8 - get_local $9 + set_local $9 + get_local $10 i32.const 1 i32.add - set_local $9 + set_local $10 end - get_local $8 + get_local $9 i64.const 1 i64.shl - set_local $8 - get_local $9 + set_local $9 + get_local $10 i32.const 1 i32.shl - set_local $9 + set_local $10 get_local $4 i64.const 1 i64.sub @@ -10139,39 +10138,39 @@ end end end - get_local $8 + get_local $9 get_local $3 i64.ge_u if - get_local $8 + get_local $9 get_local $3 i64.sub - set_local $8 - get_local $9 + set_local $9 + get_local $10 i32.const 1 i32.add - set_local $9 + set_local $10 end - get_local $8 + get_local $9 i64.const 0 i64.eq if i64.const -60 set_local $4 else - get_local $8 + get_local $9 i64.const 11 i64.shl i64.clz - set_local $10 + set_local $11 get_local $4 - get_local $10 + get_local $11 i64.sub set_local $4 - get_local $8 - get_local $10 + get_local $9 + get_local $11 i64.shl - set_local $8 + set_local $9 end br $break|0 unreachable @@ -10183,29 +10182,29 @@ i64.const 0 i64.gt_s if - get_local $8 + get_local $9 i64.const 1 i64.const 52 i64.shl i64.sub - set_local $8 - get_local $8 + set_local $9 + get_local $9 get_local $4 i64.const 52 i64.shl i64.or - set_local $8 + set_local $9 else - get_local $8 + get_local $9 i64.const 0 get_local $4 i64.sub i64.const 1 i64.add i64.shr_u - set_local $8 + set_local $9 end - get_local $8 + get_local $9 f64.reinterpret/i64 set_local $0 get_local $1 @@ -10214,7 +10213,7 @@ get_local $0 get_local $0 f64.add - set_local $11 + set_local $12 get_local $4 get_local $5 i64.eq @@ -10229,19 +10228,19 @@ i64.eq tee_local $7 if (result i32) - get_local $11 + get_local $12 get_local $1 f64.gt tee_local $7 if (result i32) get_local $7 else - get_local $11 + get_local $12 get_local $1 f64.eq tee_local $7 if (result i32) - get_local $9 + get_local $10 i32.const 1 i32.and else @@ -10804,8 +10803,8 @@ block $~lib/math/expo2f|inlined.1 (result f32) i32.const 127 i32.const 235 - i32.const 2 - i32.div_u + i32.const 1 + i32.shr_u i32.add i32.const 23 i32.shl @@ -11388,7 +11387,109 @@ end get_local $2 ) - (func $start (; 155 ;) (type $v) + (func $~lib/math/ipow32f (; 155 ;) (type $fif) (param $0 f32) (param $1 i32) (result f32) + (local $2 i32) + (local $3 f32) + get_local $1 + i32.const 31 + i32.shr_s + set_local $2 + get_local $1 + get_local $2 + i32.add + get_local $2 + i32.xor + set_local $1 + f32.const 1 + set_local $3 + block $break|0 + loop $continue|0 + get_local $1 + if + block + get_local $3 + get_local $0 + f32.const 1 + get_local $1 + i32.const 1 + i32.and + select + f32.mul + set_local $3 + get_local $1 + i32.const 1 + i32.shr_s + set_local $1 + get_local $0 + get_local $0 + f32.mul + set_local $0 + end + br $continue|0 + end + end + end + get_local $2 + if (result f32) + f32.const 1 + get_local $3 + f32.div + else + get_local $3 + end + ) + (func $~lib/math/ipow64f (; 156 ;) (type $FiF) (param $0 f64) (param $1 i32) (result f64) + (local $2 i32) + (local $3 f64) + get_local $1 + i32.const 31 + i32.shr_s + set_local $2 + get_local $1 + get_local $2 + i32.add + get_local $2 + i32.xor + set_local $1 + f64.const 1 + set_local $3 + block $break|0 + loop $continue|0 + get_local $1 + if + block + get_local $3 + get_local $0 + f64.const 1 + get_local $1 + i32.const 1 + i32.and + select + f64.mul + set_local $3 + get_local $1 + i32.const 1 + i32.shr_s + set_local $1 + get_local $0 + get_local $0 + f64.mul + set_local $0 + end + br $continue|0 + end + end + end + get_local $2 + if (result f64) + f64.const 1 + get_local $3 + f64.div + else + get_local $3 + end + ) + (func $start (; 157 ;) (type $v) (local $0 i32) (local $1 f64) (local $2 i32) @@ -42323,7 +42424,478 @@ call $~lib/env/abort unreachable end + f32.const 0 + i32.const 0 + call $~lib/math/ipow32f + f32.const 1 + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3326 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const nan:0x400000 + i32.const 0 + call $~lib/math/ipow32f + f32.const 1 + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3327 + i32.const 0 + call $~lib/env/abort + unreachable + end + block $~lib/builtins/isNaN|inlined.2 (result i32) + f32.const nan:0x400000 + i32.const 1 + call $~lib/math/ipow32f + set_local $4 + get_local $4 + get_local $4 + f32.ne + end + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3328 + i32.const 0 + call $~lib/env/abort + unreachable + end + block $~lib/builtins/isNaN|inlined.3 (result i32) + f32.const nan:0x400000 + i32.const -1 + call $~lib/math/ipow32f + set_local $4 + get_local $4 + get_local $4 + f32.ne + end + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3329 + i32.const 0 + call $~lib/env/abort + unreachable + end + block $~lib/builtins/isNaN|inlined.4 (result i32) + f32.const nan:0x400000 + i32.const 2 + call $~lib/math/ipow32f + set_local $4 + get_local $4 + get_local $4 + f32.ne + end + i32.const 0 + i32.ne + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3330 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const inf + i32.const 0 + call $~lib/math/ipow32f + f32.const 1 + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3331 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const inf + i32.const 1 + call $~lib/math/ipow32f + f32.const inf + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3332 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const inf + f32.neg + i32.const 0 + call $~lib/math/ipow32f + f32.const 1 + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3333 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const inf + f32.neg + i32.const 1 + call $~lib/math/ipow32f + f32.const inf + f32.neg + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3334 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const inf + f32.neg + i32.const 2 + call $~lib/math/ipow32f + f32.const inf + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3335 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const 1 + i32.const 0 + call $~lib/math/ipow32f + f32.const 1 + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3336 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $~lib/builtins/f32.MAX_VALUE + i32.const 2 + call $~lib/math/ipow32f + f32.const inf + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3337 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $~lib/builtins/f32.MIN_VALUE + i32.const 2 + call $~lib/math/ipow32f + f32.const 0 + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3338 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $~lib/builtins/f32.MAX_VALUE + i32.const -1 + call $~lib/math/ipow32f + f32.const 2.938735877055719e-39 + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3339 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const 10 + i32.const 36 + call $~lib/math/ipow32f + f32.const 1000000040918478759629753e12 + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3340 + i32.const 0 + call $~lib/env/abort + unreachable + end + f32.const 10 + i32.const -36 + call $~lib/math/ipow32f + f32.const 9.999999462560281e-37 + f32.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3341 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const 0 + i32.const 0 + call $~lib/math/ipow64f + f64.const 1 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3345 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const nan:0x8000000000000 + i32.const 0 + call $~lib/math/ipow64f + f64.const 1 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3346 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const nan:0x8000000000000 + i32.const 1 + call $~lib/math/ipow64f + call $~lib/builtins/isNaN + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3347 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const nan:0x8000000000000 + i32.const -1 + call $~lib/math/ipow64f + call $~lib/builtins/isNaN + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3348 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const nan:0x8000000000000 + i32.const 2 + call $~lib/math/ipow64f + call $~lib/builtins/isNaN + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3349 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const inf + i32.const 0 + call $~lib/math/ipow64f + f64.const 1 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3350 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const inf + i32.const 1 + call $~lib/math/ipow64f + f64.const inf + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3351 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const inf + f64.neg + i32.const 0 + call $~lib/math/ipow64f + f64.const 1 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3352 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const inf + f64.neg + i32.const 1 + call $~lib/math/ipow64f + f64.const inf + f64.neg + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3353 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const inf + f64.neg + i32.const 2 + call $~lib/math/ipow64f + f64.const inf + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3354 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const 1 + i32.const 0 + call $~lib/math/ipow64f + f64.const 1 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3355 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $~lib/builtins/f64.MAX_VALUE + i32.const 2 + call $~lib/math/ipow64f + f64.const inf + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3356 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $~lib/builtins/f64.MIN_VALUE + i32.const 2 + call $~lib/math/ipow64f + f64.const 0 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3357 + i32.const 0 + call $~lib/env/abort + unreachable + end + get_global $~lib/builtins/f64.MAX_VALUE + i32.const -1 + call $~lib/math/ipow64f + f64.const 5.562684646268003e-309 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3358 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const 10 + i32.const 127 + call $~lib/math/ipow64f + f64.const 1000000000000000195419867e103 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3359 + i32.const 0 + call $~lib/env/abort + unreachable + end + f64.const 10 + i32.const -127 + call $~lib/math/ipow64f + f64.const 9.999999999999998e-128 + f64.eq + i32.eqz + if + i32.const 0 + i32.const 8 + i32.const 3360 + i32.const 0 + call $~lib/env/abort + unreachable + end ) - (func $null (; 156 ;) (type $v) + (func $null (; 158 ;) (type $v) ) ) diff --git a/tests/compiler/std/mod.untouched.wat b/tests/compiler/std/mod.untouched.wat index d1e68472ce..7d5996a633 100644 --- a/tests/compiler/std/mod.untouched.wat +++ b/tests/compiler/std/mod.untouched.wat @@ -31,8 +31,9 @@ (local $6 i64) (local $7 i64) (local $8 i32) - (local $9 i64) + (local $9 f64) (local $10 i64) + (local $11 i64) get_local $0 i64.reinterpret/f64 set_local $2 @@ -84,21 +85,21 @@ get_local $0 get_local $1 f64.mul - get_local $0 - get_local $1 - f64.mul + set_local $9 + get_local $9 + get_local $9 f64.div return end get_local $2 i64.const 1 i64.shl - set_local $9 - get_local $9 + set_local $10 + get_local $10 get_local $7 i64.le_u if - get_local $9 + get_local $10 get_local $7 i64.eq if @@ -234,13 +235,13 @@ i64.const 11 i64.shl i64.clz - set_local $10 + set_local $11 get_local $4 - get_local $10 + get_local $11 i64.sub set_local $4 get_local $2 - get_local $10 + get_local $11 i64.shl set_local $2 get_local $4 @@ -342,8 +343,9 @@ (local $6 i32) (local $7 i32) (local $8 i32) - (local $9 i32) + (local $9 f32) (local $10 i32) + (local $11 i32) get_local $0 i32.reinterpret/f32 set_local $2 @@ -395,21 +397,21 @@ get_local $0 get_local $1 f32.mul - get_local $0 - get_local $1 - f32.mul + set_local $9 + get_local $9 + get_local $9 f32.div return end get_local $2 i32.const 1 i32.shl - set_local $9 - get_local $9 + set_local $10 + get_local $10 get_local $7 i32.le_u if - get_local $9 + get_local $10 get_local $7 i32.eq if @@ -545,13 +547,13 @@ i32.const 8 i32.shl i32.clz - set_local $10 + set_local $11 get_local $4 - get_local $10 + get_local $11 i32.sub set_local $4 get_local $2 - get_local $10 + get_local $11 i32.shl set_local $2 get_local $4 diff --git a/tests/compiler/std/operator-overloading.optimized.wat b/tests/compiler/std/operator-overloading.optimized.wat index 8948e25c61..e1522a87ce 100644 --- a/tests/compiler/std/operator-overloading.optimized.wat +++ b/tests/compiler/std/operator-overloading.optimized.wat @@ -240,19 +240,20 @@ (local $5 i32) (local $6 f64) (local $7 i32) - (local $8 i32) - (local $9 f64) - (local $10 i32) - (local $11 f64) + (local $8 f64) + (local $9 i32) + (local $10 f64) + (local $11 i32) (local $12 i32) (local $13 i32) - (local $14 i32) - (local $15 f64) + (local $14 f64) + (local $15 i32) (local $16 f64) (local $17 i64) (local $18 i32) (local $19 f64) (local $20 i32) + (local $21 i32) get_local $0 i64.reinterpret/f64 tee_local $17 @@ -266,7 +267,7 @@ get_local $18 i32.const 2147483647 i32.and - set_local $4 + set_local $5 get_local $1 i64.reinterpret/f64 tee_local $17 @@ -276,57 +277,57 @@ tee_local $13 i32.const 2147483647 i32.and - set_local $12 - get_local $12 + set_local $11 + get_local $11 get_local $17 i32.wrap/i64 - tee_local $7 + tee_local $21 i32.or i32.eqz if f64.const 1 return end - get_local $4 + get_local $5 i32.const 2146435072 i32.gt_s - tee_local $8 + tee_local $4 i32.eqz if - get_local $4 + get_local $5 i32.const 2146435072 i32.eq - tee_local $8 + tee_local $4 if get_local $20 i32.const 0 i32.ne - set_local $8 + set_local $4 end end - get_local $8 + get_local $4 i32.eqz if - get_local $12 + get_local $11 i32.const 2146435072 i32.gt_s - set_local $8 + set_local $4 end - get_local $8 + get_local $4 i32.eqz if - get_local $12 + get_local $11 i32.const 2146435072 i32.eq - tee_local $8 + tee_local $4 if - get_local $7 + get_local $21 i32.const 0 i32.ne - set_local $8 + set_local $4 end end - get_local $8 + get_local $4 if get_local $0 get_local $1 @@ -337,71 +338,70 @@ i32.const 0 i32.lt_s if - get_local $12 + get_local $11 i32.const 1128267776 i32.ge_s if (result i32) i32.const 2 else - get_local $12 + get_local $11 i32.const 1072693248 i32.ge_s if (result i32) - i32.const 52 - i32.const 20 - get_local $12 + get_local $21 + get_local $11 + get_local $11 i32.const 20 i32.shr_s i32.const 1023 i32.sub - tee_local $10 + tee_local $12 i32.const 20 i32.gt_s - tee_local $5 + tee_local $4 select - get_local $10 - i32.sub - set_local $8 - get_local $7 - get_local $12 - get_local $5 + tee_local $7 + i32.const 52 + i32.const 20 + get_local $4 select - tee_local $10 - get_local $8 + get_local $12 + i32.sub + tee_local $9 i32.shr_s - set_local $5 + set_local $4 i32.const 2 - get_local $5 + get_local $4 i32.const 1 i32.and i32.sub i32.const 0 - get_local $5 - get_local $8 + get_local $4 + get_local $9 i32.shl - get_local $10 + get_local $7 i32.eq select else i32.const 0 end end - set_local $14 + set_local $15 end - get_local $7 + get_local $21 i32.eqz if - get_local $12 + get_local $11 i32.const 2146435072 i32.eq if - get_local $4 + get_local $5 i32.const 1072693248 i32.sub get_local $20 i32.or if - get_local $4 + get_local $5 i32.const 1072693248 i32.ge_s if @@ -431,7 +431,7 @@ end unreachable end - get_local $12 + get_local $11 i32.const 1072693248 i32.eq if @@ -476,25 +476,25 @@ get_local $20 i32.eqz if - get_local $4 - i32.const 2146435072 - i32.eq - tee_local $5 + get_local $5 + i32.eqz + tee_local $4 i32.eqz if - get_local $4 - i32.eqz - set_local $5 + get_local $5 + i32.const 2146435072 + i32.eq + set_local $4 end - get_local $5 + get_local $4 i32.eqz if - get_local $4 + get_local $5 i32.const 1072693248 i32.eq - set_local $5 + set_local $4 end - get_local $5 + get_local $4 if f64.const 1 get_local $2 @@ -509,16 +509,16 @@ i32.const 0 i32.lt_s if (result f64) - get_local $4 + get_local $5 i32.const 1072693248 i32.sub - get_local $14 + get_local $15 i32.or if (result f64) get_local $2 f64.neg get_local $2 - get_local $14 + get_local $15 i32.const 1 i32.eq select @@ -526,8 +526,8 @@ get_local $2 get_local $2 f64.sub - tee_local $0 - get_local $0 + tee_local $14 + get_local $14 f64.div end else @@ -537,39 +537,39 @@ end end f64.const 1 - set_local $11 + set_local $10 get_local $18 i32.const 0 i32.lt_s if - get_local $14 + get_local $15 i32.eqz if get_local $0 get_local $0 f64.sub - tee_local $0 - get_local $0 + tee_local $14 + get_local $14 f64.div return end f64.const -1 f64.const 1 - get_local $14 + get_local $15 i32.const 1 i32.eq select - set_local $11 + set_local $10 end - get_local $12 + get_local $11 i32.const 1105199104 i32.gt_s if (result f64) - get_local $12 + get_local $11 i32.const 1139802112 i32.gt_s if - get_local $4 + get_local $5 i32.const 1072693247 i32.le_s if @@ -581,7 +581,7 @@ select return end - get_local $4 + get_local $5 i32.const 1072693248 i32.ge_s if @@ -594,7 +594,7 @@ return end end - get_local $4 + get_local $5 i32.const 1072693247 i32.lt_s if @@ -602,13 +602,13 @@ i32.const 0 i32.lt_s if (result f64) - get_local $11 + get_local $10 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $11 + get_local $10 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -616,7 +616,7 @@ end return end - get_local $4 + get_local $5 i32.const 1072693248 i32.gt_s if @@ -624,13 +624,13 @@ i32.const 0 i32.gt_s if (result f64) - get_local $11 + get_local $10 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $11 + get_local $10 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -668,21 +668,21 @@ f64.sub tee_local $6 f64.add - set_local $9 + set_local $8 get_local $6 - get_local $9 + get_local $8 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - tee_local $9 + tee_local $8 get_local $16 f64.sub f64.sub else i32.const 0 set_local $7 - get_local $4 + get_local $5 i32.const 1048576 i32.lt_s if (result i32) @@ -694,32 +694,32 @@ i64.const 32 i64.shr_u i32.wrap/i64 - set_local $4 + set_local $5 i32.const -53 else i32.const 0 end - get_local $4 + get_local $5 i32.const 20 i32.shr_s i32.const 1023 i32.sub i32.add set_local $7 - get_local $4 + get_local $5 i32.const 1048575 i32.and - tee_local $5 + tee_local $9 i32.const 1072693248 i32.or - set_local $4 - get_local $5 + set_local $5 + get_local $9 i32.const 235662 i32.le_s if (result i32) i32.const 0 else - get_local $5 + get_local $9 i32.const 767610 i32.lt_s if (result i32) @@ -729,19 +729,19 @@ i32.const 1 i32.add set_local $7 - get_local $4 + get_local $5 i32.const -1048576 i32.add - set_local $4 + set_local $5 i32.const 0 end end - set_local $10 + set_local $12 get_local $2 i64.reinterpret/f64 i64.const 4294967295 i64.and - get_local $4 + get_local $5 i64.extend_s/i32 i64.const 32 i64.shl @@ -750,7 +750,7 @@ tee_local $2 f64.const 1.5 f64.const 1 - get_local $10 + get_local $12 select tee_local $0 f64.sub @@ -762,16 +762,16 @@ f64.div tee_local $6 f64.mul - set_local $9 + set_local $14 get_local $2 - get_local $4 + get_local $5 i32.const 1 i32.shr_s i32.const 536870912 i32.or i32.const 524288 i32.add - get_local $10 + get_local $12 i32.const 18 i32.shl i32.add @@ -779,27 +779,27 @@ i64.const 32 i64.shl f64.reinterpret/i64 - tee_local $3 + tee_local $8 get_local $0 f64.sub f64.sub set_local $2 - get_local $9 - get_local $9 + get_local $14 + get_local $14 f64.mul - tee_local $15 - get_local $15 + tee_local $3 + get_local $3 f64.mul f64.const 0.5999999999999946 - get_local $15 + get_local $3 f64.const 0.4285714285785502 - get_local $15 + get_local $3 f64.const 0.33333332981837743 - get_local $15 + get_local $3 f64.const 0.272728123808534 - get_local $15 + get_local $3 f64.const 0.23066074577556175 - get_local $15 + get_local $3 f64.const 0.20697501780033842 f64.mul f64.add @@ -815,13 +815,13 @@ set_local $19 get_local $6 get_local $16 - get_local $9 + get_local $14 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 tee_local $6 - get_local $3 + get_local $8 f64.mul f64.sub get_local $6 @@ -834,40 +834,40 @@ get_local $6 get_local $6 f64.mul - tee_local $15 + tee_local $3 f64.add get_local $19 get_local $0 get_local $6 - get_local $9 + get_local $14 f64.add f64.mul f64.add tee_local $19 f64.add - set_local $3 + set_local $8 get_local $19 - get_local $3 + get_local $8 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - tee_local $3 + tee_local $8 f64.const 3 f64.sub - get_local $15 + get_local $3 f64.sub f64.sub set_local $2 get_local $6 - get_local $3 + get_local $8 f64.mul tee_local $16 get_local $0 - get_local $3 + get_local $8 f64.mul get_local $2 - get_local $9 + get_local $14 f64.mul f64.add tee_local $6 @@ -897,14 +897,14 @@ f64.add f64.const 1.350039202129749e-08 f64.const 0 - get_local $10 + get_local $12 select f64.add tee_local $2 f64.add f64.const 0.5849624872207642 f64.const 0 - get_local $10 + get_local $12 select tee_local $0 f64.add @@ -912,14 +912,14 @@ f64.convert_s/i32 tee_local $3 f64.add - set_local $9 + set_local $8 get_local $2 - get_local $9 + get_local $8 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - tee_local $9 + tee_local $8 get_local $3 f64.sub get_local $0 @@ -937,7 +937,7 @@ f64.reinterpret/i64 tee_local $0 f64.sub - get_local $9 + get_local $8 f64.mul get_local $1 get_local $2 @@ -945,7 +945,7 @@ f64.add tee_local $6 get_local $0 - get_local $9 + get_local $8 f64.mul tee_local $0 f64.add @@ -953,21 +953,21 @@ i64.reinterpret/f64 tee_local $17 i32.wrap/i64 - set_local $8 + set_local $4 block $folding-inner1 block $folding-inner0 get_local $17 i64.const 32 i64.shr_u i32.wrap/i64 - tee_local $5 + tee_local $9 i32.const 1083179008 i32.ge_s if - get_local $5 + get_local $9 i32.const 1083179008 i32.sub - get_local $8 + get_local $4 i32.or br_if $folding-inner0 get_local $6 @@ -979,16 +979,16 @@ f64.gt br_if $folding-inner0 else - get_local $5 + get_local $9 i32.const 2147483647 i32.and i32.const 1083231232 i32.ge_s if - get_local $5 + get_local $9 i32.const -1064252416 i32.sub - get_local $8 + get_local $4 i32.or br_if $folding-inner1 get_local $6 @@ -999,27 +999,27 @@ br_if $folding-inner1 end end - get_local $5 + get_local $9 i32.const 2147483647 i32.and - tee_local $8 + tee_local $4 i32.const 20 i32.shr_s i32.const 1023 i32.sub - set_local $10 + set_local $12 i32.const 0 set_local $7 - get_local $8 + get_local $4 i32.const 1071644672 i32.gt_s if i32.const 1048576 - get_local $10 + get_local $12 i32.const 1 i32.add i32.shr_s - get_local $5 + get_local $9 i32.add tee_local $7 i32.const 2147483647 @@ -1028,9 +1028,9 @@ i32.shr_s i32.const 1023 i32.sub - set_local $10 + set_local $12 i32.const 1048575 - get_local $10 + get_local $12 i32.shr_s i32.const -1 i32.xor @@ -1047,7 +1047,7 @@ i32.const 1048576 i32.or i32.const 20 - get_local $10 + get_local $12 i32.sub i32.shr_s set_local $7 @@ -1055,7 +1055,7 @@ get_local $7 i32.sub get_local $7 - get_local $5 + get_local $9 i32.const 0 i32.lt_s select @@ -1093,7 +1093,7 @@ get_local $2 f64.mul set_local $3 - get_local $11 + get_local $10 f64.const 1 get_local $2 get_local $2 @@ -1117,9 +1117,9 @@ f64.add f64.mul f64.sub - tee_local $9 + tee_local $8 f64.mul - get_local $9 + get_local $8 f64.const 2 f64.sub f64.div @@ -1146,7 +1146,7 @@ i32.const 20 i32.shl i32.add - tee_local $5 + tee_local $9 i32.const 20 i32.shr_s i32.const 0 @@ -1160,7 +1160,7 @@ i64.reinterpret/f64 i64.const 4294967295 i64.and - get_local $5 + get_local $9 i64.extend_s/i32 i64.const 32 i64.shl @@ -1170,14 +1170,14 @@ f64.mul return end - get_local $11 + get_local $10 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul return end - get_local $11 + get_local $10 f64.const 1e-300 f64.mul f64.const 1e-300 diff --git a/tests/compiler/std/operator-overloading.untouched.wat b/tests/compiler/std/operator-overloading.untouched.wat index 804142cb63..a6edcef338 100644 --- a/tests/compiler/std/operator-overloading.untouched.wat +++ b/tests/compiler/std/operator-overloading.untouched.wat @@ -369,7 +369,7 @@ (local $11 i32) (local $12 i32) (local $13 i32) - (local $14 f64) + (local $14 i32) (local $15 f64) (local $16 f64) (local $17 f64) @@ -381,10 +381,10 @@ (local $23 f64) (local $24 f64) (local $25 f64) - (local $26 i32) - (local $27 i32) - (local $28 f64) - (local $29 f64) + (local $26 f64) + (local $27 f64) + (local $28 i32) + (local $29 i32) (local $30 f64) (local $31 f64) (local $32 f64) @@ -395,7 +395,8 @@ (local $37 f64) (local $38 f64) (local $39 f64) - (local $40 i32) + (local $40 f64) + (local $41 i32) get_local $0 i64.reinterpret/f64 set_local $2 @@ -507,34 +508,34 @@ i32.const 1023 i32.sub set_local $11 - i32.const 52 - i32.const 20 get_local $11 i32.const 20 i32.gt_s + set_local $9 + i32.const 52 + i32.const 20 + get_local $9 select get_local $11 i32.sub - set_local $9 + set_local $12 get_local $6 get_local $8 - get_local $11 - i32.const 20 - i32.gt_s - select - set_local $12 - get_local $12 get_local $9 - i32.shr_s + select set_local $13 get_local $13 - get_local $9 - i32.shl get_local $12 + i32.shr_s + set_local $14 + get_local $14 + get_local $12 + i32.shl + get_local $13 i32.eq if i32.const 2 - get_local $13 + get_local $14 i32.const 1 i32.and i32.sub @@ -633,41 +634,41 @@ end get_local $0 f64.abs - set_local $14 + set_local $15 get_local $4 i32.const 0 i32.eq if get_local $7 - i32.const 2146435072 + i32.const 0 i32.eq - tee_local $13 + tee_local $14 if (result i32) - get_local $13 + get_local $14 else get_local $7 - i32.const 0 + i32.const 2146435072 i32.eq end - tee_local $13 + tee_local $14 if (result i32) - get_local $13 + get_local $14 else get_local $7 i32.const 1072693248 i32.eq end if - get_local $14 - set_local $15 + get_local $15 + set_local $16 get_local $5 i32.const 0 i32.lt_s if f64.const 1 - get_local $15 + get_local $16 f64.div - set_local $15 + set_local $16 end get_local $3 i32.const 0 @@ -681,31 +682,31 @@ i32.const 0 i32.eq if - get_local $15 - get_local $15 - f64.sub - get_local $15 - get_local $15 + get_local $16 + get_local $16 f64.sub + set_local $17 + get_local $17 + get_local $17 f64.div - set_local $15 + set_local $16 else get_local $10 i32.const 1 i32.eq if - get_local $15 + get_local $16 f64.neg - set_local $15 + set_local $16 end end end - get_local $15 + get_local $16 return end end f64.const 1 - set_local $16 + set_local $18 get_local $3 i32.const 0 i32.lt_s @@ -717,9 +718,9 @@ get_local $0 get_local $0 f64.sub - get_local $0 - get_local $0 - f64.sub + set_local $17 + get_local $17 + get_local $17 f64.div return end @@ -728,7 +729,7 @@ i32.eq if f64.const -1 - set_local $16 + set_local $18 end end get_local $8 @@ -784,13 +785,13 @@ i32.const 0 i32.lt_s if (result f64) - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -806,13 +807,13 @@ i32.const 0 i32.gt_s if (result f64) - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul else - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -820,98 +821,98 @@ end return end - get_local $14 + get_local $15 f64.const 1 f64.sub - set_local $22 - get_local $22 - get_local $22 + set_local $24 + get_local $24 + get_local $24 f64.mul f64.const 0.5 - get_local $22 + get_local $24 f64.const 0.3333333333333333 - get_local $22 + get_local $24 f64.const 0.25 f64.mul f64.sub f64.mul f64.sub f64.mul - set_local $25 + set_local $27 f64.const 1.4426950216293335 - get_local $22 + get_local $24 f64.mul - set_local $23 - get_local $22 + set_local $25 + get_local $24 f64.const 1.9259629911266175e-08 f64.mul - get_local $25 + get_local $27 f64.const 1.4426950408889634 f64.mul f64.sub - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.add - set_local $17 - get_local $17 + set_local $19 + get_local $19 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $17 - get_local $24 - get_local $17 - get_local $23 + set_local $19 + get_local $26 + get_local $19 + get_local $25 f64.sub f64.sub - set_local $18 + set_local $20 else i32.const 0 - set_local $27 + set_local $29 get_local $7 i32.const 1048576 i32.lt_s if - get_local $14 + get_local $15 f64.const 9007199254740992 f64.mul - set_local $14 - get_local $27 + set_local $15 + get_local $29 i32.const 53 i32.sub - set_local $27 - get_local $14 + set_local $29 + get_local $15 i64.reinterpret/f64 i64.const 32 i64.shr_u i32.wrap/i64 set_local $7 end - get_local $27 + get_local $29 get_local $7 i32.const 20 i32.shr_s i32.const 1023 i32.sub i32.add - set_local $27 + set_local $29 get_local $7 i32.const 1048575 i32.and - set_local $26 - get_local $26 + set_local $28 + get_local $28 i32.const 1072693248 i32.or set_local $7 - get_local $26 + get_local $28 i32.const 235662 i32.le_s if i32.const 0 set_local $11 else - get_local $26 + get_local $28 i32.const 767610 i32.lt_s if @@ -920,17 +921,17 @@ else i32.const 0 set_local $11 - get_local $27 + get_local $29 i32.const 1 i32.add - set_local $27 + set_local $29 get_local $7 i32.const 1048576 i32.sub set_local $7 end end - get_local $14 + get_local $15 i64.reinterpret/f64 i64.const 4294967295 i64.and @@ -940,34 +941,34 @@ i64.shl i64.or f64.reinterpret/i64 - set_local $14 + set_local $15 f64.const 1.5 f64.const 1 get_local $11 select - set_local $34 - get_local $14 - get_local $34 + set_local $35 + get_local $15 + get_local $35 f64.sub - set_local $23 + set_local $25 f64.const 1 - get_local $14 - get_local $34 + get_local $15 + get_local $35 f64.add f64.div - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.mul - set_local $28 - get_local $28 - set_local $30 - get_local $30 + set_local $17 + get_local $17 + set_local $31 + get_local $31 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $30 + set_local $31 get_local $7 i32.const 1 i32.shr_s @@ -983,42 +984,42 @@ i64.const 32 i64.shl f64.reinterpret/i64 - set_local $32 - get_local $14 - get_local $32 - get_local $34 + set_local $33 + get_local $15 + get_local $33 + get_local $35 f64.sub f64.sub - set_local $33 - get_local $24 - get_local $23 - get_local $30 - get_local $32 + set_local $34 + get_local $26 + get_local $25 + get_local $31 + get_local $33 f64.mul f64.sub - get_local $30 - get_local $33 + get_local $31 + get_local $34 f64.mul f64.sub f64.mul - set_local $31 - get_local $28 - get_local $28 + set_local $32 + get_local $17 + get_local $17 f64.mul - set_local $29 - get_local $29 - get_local $29 + set_local $30 + get_local $30 + get_local $30 f64.mul f64.const 0.5999999999999946 - get_local $29 + get_local $30 f64.const 0.4285714285785502 - get_local $29 + get_local $30 f64.const 0.33333332981837743 - get_local $29 + get_local $30 f64.const 0.272728123808534 - get_local $29 + get_local $30 f64.const 0.23066074577556175 - get_local $29 + get_local $30 f64.const 0.20697501780033842 f64.mul f64.add @@ -1031,184 +1032,184 @@ f64.mul f64.add f64.mul - set_local $21 - get_local $21 + set_local $23 + get_local $23 + get_local $32 get_local $31 - get_local $30 - get_local $28 + get_local $17 f64.add f64.mul f64.add - set_local $21 - get_local $30 - get_local $30 + set_local $23 + get_local $31 + get_local $31 f64.mul - set_local $29 + set_local $30 f64.const 3 - get_local $29 + get_local $30 f64.add - get_local $21 + get_local $23 f64.add - set_local $32 - get_local $32 + set_local $33 + get_local $33 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $32 - get_local $21 - get_local $32 + set_local $33 + get_local $23 + get_local $33 f64.const 3 f64.sub - get_local $29 + get_local $30 f64.sub f64.sub - set_local $33 - get_local $30 - get_local $32 - f64.mul - set_local $23 + set_local $34 get_local $31 - get_local $32 + get_local $33 f64.mul + set_local $25 + get_local $32 get_local $33 - get_local $28 + f64.mul + get_local $34 + get_local $17 f64.mul f64.add - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.add - set_local $19 - get_local $19 + set_local $21 + get_local $21 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $19 - get_local $24 - get_local $19 - get_local $23 + set_local $21 + get_local $26 + get_local $21 + get_local $25 f64.sub f64.sub - set_local $20 + set_local $22 f64.const 0.9617967009544373 - get_local $19 + get_local $21 f64.mul - set_local $35 + set_local $36 f64.const 1.350039202129749e-08 f64.const 0 get_local $11 select - set_local $36 + set_local $37 f64.const -7.028461650952758e-09 - get_local $19 + get_local $21 f64.mul - get_local $20 + get_local $22 f64.const 0.9617966939259756 f64.mul f64.add - get_local $36 + get_local $37 f64.add - set_local $37 - get_local $27 + set_local $38 + get_local $29 f64.convert_s/i32 - set_local $22 + set_local $24 f64.const 0.5849624872207642 f64.const 0 get_local $11 select - set_local $38 - get_local $35 - get_local $37 - f64.add + set_local $39 + get_local $36 get_local $38 f64.add - get_local $22 + get_local $39 f64.add - set_local $17 - get_local $17 + get_local $24 + f64.add + set_local $19 + get_local $19 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $17 - get_local $37 - get_local $17 - get_local $22 - f64.sub + set_local $19 get_local $38 + get_local $19 + get_local $24 f64.sub - get_local $35 + get_local $39 f64.sub + get_local $36 f64.sub - set_local $18 + f64.sub + set_local $20 end get_local $1 - set_local $39 - get_local $39 + set_local $40 + get_local $40 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $39 + set_local $40 get_local $1 - get_local $39 + get_local $40 f64.sub - get_local $17 + get_local $19 f64.mul get_local $1 - get_local $18 + get_local $20 f64.mul f64.add - set_local $20 - get_local $39 - get_local $17 - f64.mul - set_local $19 - get_local $20 + set_local $22 + get_local $40 get_local $19 + f64.mul + set_local $21 + get_local $22 + get_local $21 f64.add - set_local $15 - get_local $15 + set_local $16 + get_local $16 i64.reinterpret/f64 set_local $2 get_local $2 i64.const 32 i64.shr_u i32.wrap/i64 - set_local $26 + set_local $28 get_local $2 i32.wrap/i64 - set_local $40 - get_local $26 + set_local $41 + get_local $28 i32.const 1083179008 i32.ge_s if - get_local $26 + get_local $28 i32.const 1083179008 i32.sub - get_local $40 + get_local $41 i32.or i32.const 0 i32.ne if - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 f64.mul return end - get_local $20 + get_local $22 f64.const 8.008566259537294e-17 f64.add - get_local $15 - get_local $19 + get_local $16 + get_local $21 f64.sub f64.gt if - get_local $16 + get_local $18 f64.const 1.e+300 f64.mul f64.const 1.e+300 @@ -1216,34 +1217,34 @@ return end else - get_local $26 + get_local $28 i32.const 2147483647 i32.and i32.const 1083231232 i32.ge_s if - get_local $26 + get_local $28 i32.const -1064252416 i32.sub - get_local $40 + get_local $41 i32.or i32.const 0 i32.ne if - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 f64.mul return end - get_local $20 - get_local $15 - get_local $19 + get_local $22 + get_local $16 + get_local $21 f64.sub f64.le if - get_local $16 + get_local $18 f64.const 1e-300 f64.mul f64.const 1e-300 @@ -1252,31 +1253,31 @@ end end end - get_local $26 + get_local $28 i32.const 2147483647 i32.and - set_local $40 - get_local $40 + set_local $41 + get_local $41 i32.const 20 i32.shr_s i32.const 1023 i32.sub set_local $11 i32.const 0 - set_local $27 - get_local $40 + set_local $29 + get_local $41 i32.const 1071644672 i32.gt_s if - get_local $26 + get_local $28 i32.const 1048576 get_local $11 i32.const 1 i32.add i32.shr_s i32.add - set_local $27 - get_local $27 + set_local $29 + get_local $29 i32.const 2147483647 i32.and i32.const 20 @@ -1285,8 +1286,8 @@ i32.sub set_local $11 f64.const 0 - set_local $22 - get_local $27 + set_local $24 + get_local $29 i32.const 1048575 get_local $11 i32.shr_s @@ -1297,8 +1298,8 @@ i64.const 32 i64.shl f64.reinterpret/i64 - set_local $22 - get_local $27 + set_local $24 + get_local $29 i32.const 1048575 i32.and i32.const 1048576 @@ -1307,71 +1308,71 @@ get_local $11 i32.sub i32.shr_s - set_local $27 - get_local $26 + set_local $29 + get_local $28 i32.const 0 i32.lt_s if i32.const 0 - get_local $27 + get_local $29 i32.sub - set_local $27 + set_local $29 end - get_local $19 - get_local $22 + get_local $21 + get_local $24 f64.sub - set_local $19 + set_local $21 end - get_local $20 - get_local $19 - f64.add - set_local $22 get_local $22 + get_local $21 + f64.add + set_local $24 + get_local $24 i64.reinterpret/f64 i64.const -4294967296 i64.and f64.reinterpret/i64 - set_local $22 - get_local $22 + set_local $24 + get_local $24 f64.const 0.6931471824645996 f64.mul - set_local $23 - get_local $20 + set_local $25 get_local $22 - get_local $19 + get_local $24 + get_local $21 f64.sub f64.sub f64.const 0.6931471805599453 f64.mul - get_local $22 + get_local $24 f64.const -1.904654299957768e-09 f64.mul f64.add - set_local $24 - get_local $23 - get_local $24 + set_local $26 + get_local $25 + get_local $26 f64.add - set_local $15 - get_local $24 - get_local $15 - get_local $23 + set_local $16 + get_local $26 + get_local $16 + get_local $25 f64.sub f64.sub - set_local $25 - get_local $15 - get_local $15 + set_local $27 + get_local $16 + get_local $16 f64.mul - set_local $22 - get_local $15 - get_local $22 + set_local $24 + get_local $16 + get_local $24 f64.const 0.16666666666666602 - get_local $22 + get_local $24 f64.const -2.7777777777015593e-03 - get_local $22 + get_local $24 f64.const 6.613756321437934e-05 - get_local $22 + get_local $24 f64.const -1.6533902205465252e-06 - get_local $22 + get_local $24 f64.const 4.1381367970572385e-08 f64.mul f64.add @@ -1383,64 +1384,64 @@ f64.add f64.mul f64.sub - set_local $17 - get_local $15 - get_local $17 + set_local $19 + get_local $16 + get_local $19 f64.mul - get_local $17 + get_local $19 f64.const 2 f64.sub f64.div - get_local $25 - get_local $15 - get_local $25 + get_local $27 + get_local $16 + get_local $27 f64.mul f64.add f64.sub - set_local $21 + set_local $23 f64.const 1 - get_local $21 - get_local $15 + get_local $23 + get_local $16 f64.sub f64.sub - set_local $15 - get_local $15 + set_local $16 + get_local $16 i64.reinterpret/f64 i64.const 32 i64.shr_u i32.wrap/i64 - set_local $26 - get_local $26 - get_local $27 + set_local $28 + get_local $28 + get_local $29 i32.const 20 i32.shl i32.add - set_local $26 - get_local $26 + set_local $28 + get_local $28 i32.const 20 i32.shr_s i32.const 0 i32.le_s if - get_local $15 - get_local $27 + get_local $16 + get_local $29 call $~lib/math/NativeMath.scalbn - set_local $15 + set_local $16 else - get_local $15 + get_local $16 i64.reinterpret/f64 i64.const 4294967295 i64.and - get_local $26 + get_local $28 i64.extend_s/i32 i64.const 32 i64.shl i64.or f64.reinterpret/i64 - set_local $15 + set_local $16 end + get_local $18 get_local $16 - get_local $15 f64.mul ) (func $std/operator-overloading/Tester.pow (; 11 ;) (type $iii) (param $0 i32) (param $1 i32) (result i32) diff --git a/tests/compiler/std/typedarray.untouched.wat b/tests/compiler/std/typedarray.untouched.wat index 3b8cab95e8..0e3bc819a6 100644 --- a/tests/compiler/std/typedarray.untouched.wat +++ b/tests/compiler/std/typedarray.untouched.wat @@ -11738,8 +11738,9 @@ (local $6 i32) (local $7 i32) (local $8 i32) - (local $9 i32) + (local $9 f32) (local $10 i32) + (local $11 i32) get_local $0 i32.reinterpret/f32 set_local $2 @@ -11791,21 +11792,21 @@ get_local $0 get_local $1 f32.mul - get_local $0 - get_local $1 - f32.mul + set_local $9 + get_local $9 + get_local $9 f32.div return end get_local $2 i32.const 1 i32.shl - set_local $9 - get_local $9 + set_local $10 + get_local $10 get_local $7 i32.le_u if - get_local $9 + get_local $10 get_local $7 i32.eq if @@ -11941,13 +11942,13 @@ i32.const 8 i32.shl i32.clz - set_local $10 + set_local $11 get_local $4 - get_local $10 + get_local $11 i32.sub set_local $4 get_local $2 - get_local $10 + get_local $11 i32.shl set_local $2 get_local $4 @@ -12128,8 +12129,9 @@ (local $6 i64) (local $7 i64) (local $8 i32) - (local $9 i64) + (local $9 f64) (local $10 i64) + (local $11 i64) get_local $0 i64.reinterpret/f64 set_local $2 @@ -12181,21 +12183,21 @@ get_local $0 get_local $1 f64.mul - get_local $0 - get_local $1 - f64.mul + set_local $9 + get_local $9 + get_local $9 f64.div return end get_local $2 i64.const 1 i64.shl - set_local $9 - get_local $9 + set_local $10 + get_local $10 get_local $7 i64.le_u if - get_local $9 + get_local $10 get_local $7 i64.eq if @@ -12331,13 +12333,13 @@ i64.const 11 i64.shl i64.clz - set_local $10 + set_local $11 get_local $4 - get_local $10 + get_local $11 i64.sub set_local $4 get_local $2 - get_local $10 + get_local $11 i64.shl set_local $2 get_local $4