mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-18 09:21:35 +00:00
Minor math tweaks + ipow32f/ipow64f (#428)
This commit is contained in:
@ -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
|
||||
tee_local $7
|
||||
i32.const 52
|
||||
i32.const 20
|
||||
get_local $4
|
||||
select
|
||||
get_local $10
|
||||
i32.sub
|
||||
set_local $8
|
||||
get_local $7
|
||||
get_local $12
|
||||
get_local $5
|
||||
select
|
||||
tee_local $10
|
||||
get_local $8
|
||||
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
|
||||
i32.eqz
|
||||
if
|
||||
get_local $4
|
||||
i32.eqz
|
||||
set_local $5
|
||||
end
|
||||
get_local $5
|
||||
i32.eqz
|
||||
tee_local $4
|
||||
i32.eqz
|
||||
if
|
||||
get_local $4
|
||||
get_local $5
|
||||
i32.const 2146435072
|
||||
i32.eq
|
||||
set_local $4
|
||||
end
|
||||
get_local $4
|
||||
i32.eqz
|
||||
if
|
||||
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
|
||||
|
Reference in New Issue
Block a user