mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-19 18:01:31 +00:00
optimize logical and/or, initial null checking in flows
This commit is contained in:
@ -20,10 +20,9 @@
|
||||
(local $3 i64)
|
||||
(local $4 i64)
|
||||
(local $5 i64)
|
||||
(local $6 i32)
|
||||
(local $6 i64)
|
||||
(local $7 i64)
|
||||
(local $8 i64)
|
||||
(local $9 i64)
|
||||
local.get $0
|
||||
i64.reinterpret_f64
|
||||
local.tee $2
|
||||
@ -43,31 +42,26 @@
|
||||
local.get $2
|
||||
i64.const 63
|
||||
i64.shr_u
|
||||
local.set $8
|
||||
block (result i32)
|
||||
local.get $3
|
||||
i64.const 1
|
||||
i64.shl
|
||||
local.tee $7
|
||||
i64.const 0
|
||||
local.set $7
|
||||
local.get $3
|
||||
i64.const 1
|
||||
i64.shl
|
||||
local.tee $6
|
||||
i64.const 0
|
||||
i64.eq
|
||||
if (result i32)
|
||||
i32.const 1
|
||||
else
|
||||
local.get $4
|
||||
i64.const 2047
|
||||
i64.eq
|
||||
local.tee $6
|
||||
i32.eqz
|
||||
if
|
||||
local.get $4
|
||||
i64.const 2047
|
||||
i64.eq
|
||||
local.set $6
|
||||
end
|
||||
local.get $6
|
||||
i32.eqz
|
||||
end
|
||||
if (result i32)
|
||||
i32.const 1
|
||||
else
|
||||
local.get $1
|
||||
local.get $1
|
||||
f64.ne
|
||||
else
|
||||
local.get $6
|
||||
end
|
||||
if
|
||||
local.get $0
|
||||
@ -82,12 +76,12 @@
|
||||
local.get $2
|
||||
i64.const 1
|
||||
i64.shl
|
||||
local.tee $9
|
||||
local.get $7
|
||||
local.tee $8
|
||||
local.get $6
|
||||
i64.le_u
|
||||
if
|
||||
local.get $7
|
||||
local.get $9
|
||||
local.get $6
|
||||
local.get $8
|
||||
i64.eq
|
||||
br_if $folding-inner0
|
||||
local.get $0
|
||||
@ -214,7 +208,7 @@
|
||||
i64.add
|
||||
i64.shr_u
|
||||
end
|
||||
local.get $8
|
||||
local.get $7
|
||||
i64.const 63
|
||||
i64.shl
|
||||
i64.or
|
||||
@ -253,22 +247,20 @@
|
||||
f64.eq
|
||||
)
|
||||
(func $std/mod/test_fmod (; 4 ;) (type $FUNCSIG$iddd) (param $0 f64) (param $1 f64) (param $2 f64) (result i32)
|
||||
(local $3 i32)
|
||||
local.get $0
|
||||
local.get $1
|
||||
call $~lib/math/NativeMath.mod
|
||||
local.get $2
|
||||
call $std/mod/check<f64>
|
||||
local.tee $3
|
||||
if
|
||||
if (result i32)
|
||||
local.get $0
|
||||
local.get $1
|
||||
call $std/mod/mod
|
||||
local.get $2
|
||||
call $std/mod/check<f64>
|
||||
local.set $3
|
||||
else
|
||||
i32.const 0
|
||||
end
|
||||
local.get $3
|
||||
)
|
||||
(func $~lib/math/NativeMathf.mod (; 5 ;) (type $FUNCSIG$fff) (param $0 f32) (param $1 f32) (result f32)
|
||||
(local $2 i32)
|
||||
@ -280,7 +272,7 @@
|
||||
(local $8 i32)
|
||||
local.get $0
|
||||
i32.reinterpret_f32
|
||||
local.tee $3
|
||||
local.tee $2
|
||||
i32.const 23
|
||||
i32.shr_u
|
||||
i32.const 255
|
||||
@ -288,39 +280,33 @@
|
||||
local.set $4
|
||||
local.get $1
|
||||
i32.reinterpret_f32
|
||||
local.tee $5
|
||||
local.tee $3
|
||||
i32.const 23
|
||||
i32.shr_u
|
||||
i32.const 255
|
||||
i32.and
|
||||
local.set $6
|
||||
local.get $3
|
||||
local.set $5
|
||||
local.get $2
|
||||
i32.const -2147483648
|
||||
i32.and
|
||||
local.set $8
|
||||
block (result i32)
|
||||
local.get $5
|
||||
local.set $7
|
||||
local.get $3
|
||||
i32.const 1
|
||||
i32.shl
|
||||
local.tee $6
|
||||
if (result i32)
|
||||
local.get $4
|
||||
i32.const 255
|
||||
i32.eq
|
||||
else
|
||||
i32.const 1
|
||||
i32.shl
|
||||
local.tee $7
|
||||
i32.eqz
|
||||
local.tee $2
|
||||
i32.eqz
|
||||
if
|
||||
local.get $4
|
||||
i32.const 255
|
||||
i32.eq
|
||||
local.set $2
|
||||
end
|
||||
local.get $2
|
||||
i32.eqz
|
||||
end
|
||||
if (result i32)
|
||||
i32.const 1
|
||||
else
|
||||
local.get $1
|
||||
local.get $1
|
||||
f32.ne
|
||||
else
|
||||
local.get $2
|
||||
end
|
||||
if
|
||||
local.get $0
|
||||
@ -332,15 +318,15 @@
|
||||
return
|
||||
end
|
||||
block $folding-inner0
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.const 1
|
||||
i32.shl
|
||||
local.tee $2
|
||||
local.get $7
|
||||
local.tee $8
|
||||
local.get $6
|
||||
i32.le_u
|
||||
if
|
||||
local.get $2
|
||||
local.get $7
|
||||
local.get $6
|
||||
local.get $8
|
||||
i32.eq
|
||||
br_if $folding-inner0
|
||||
local.get $0
|
||||
@ -348,16 +334,16 @@
|
||||
end
|
||||
local.get $4
|
||||
if (result i32)
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.const 8388607
|
||||
i32.and
|
||||
i32.const 8388608
|
||||
i32.or
|
||||
else
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.const 1
|
||||
local.get $4
|
||||
local.get $3
|
||||
local.get $2
|
||||
i32.const 9
|
||||
i32.shl
|
||||
i32.clz
|
||||
@ -367,30 +353,30 @@
|
||||
i32.shl
|
||||
end
|
||||
local.set $2
|
||||
local.get $6
|
||||
local.get $5
|
||||
if (result i32)
|
||||
local.get $5
|
||||
local.get $3
|
||||
i32.const 8388607
|
||||
i32.and
|
||||
i32.const 8388608
|
||||
i32.or
|
||||
else
|
||||
local.get $5
|
||||
local.get $3
|
||||
i32.const 1
|
||||
local.get $6
|
||||
local.get $5
|
||||
local.get $3
|
||||
i32.const 9
|
||||
i32.shl
|
||||
i32.clz
|
||||
i32.sub
|
||||
local.tee $6
|
||||
local.tee $5
|
||||
i32.sub
|
||||
i32.shl
|
||||
end
|
||||
local.set $3
|
||||
loop $continue|0
|
||||
local.get $4
|
||||
local.get $6
|
||||
local.get $5
|
||||
i32.gt_s
|
||||
if
|
||||
local.get $2
|
||||
@ -459,7 +445,7 @@
|
||||
i32.sub
|
||||
i32.shr_u
|
||||
end
|
||||
local.get $8
|
||||
local.get $7
|
||||
i32.or
|
||||
f32.reinterpret_i32
|
||||
return
|
||||
|
Reference in New Issue
Block a user