mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-12 22:41:27 +00:00
Improve per-bit divmod loop for mod & rem (#307)
This commit is contained in:
@ -33,7 +33,6 @@
|
||||
(local $8 i32)
|
||||
(local $9 i64)
|
||||
(local $10 i64)
|
||||
(local $11 i64)
|
||||
(set_local $2
|
||||
(i64.reinterpret/f64
|
||||
(get_local $0)
|
||||
@ -245,79 +244,68 @@
|
||||
)
|
||||
)
|
||||
(block $break|0
|
||||
(loop $repeat|0
|
||||
(br_if $break|0
|
||||
(i32.eqz
|
||||
(i64.gt_s
|
||||
(get_local $4)
|
||||
(get_local $5)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i64.gt_s
|
||||
(get_local $4)
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(set_local $10
|
||||
(i64.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.eqz
|
||||
(i64.shr_u
|
||||
(get_local $10)
|
||||
(i64.const 63)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(if
|
||||
(i64.eqz
|
||||
(get_local $10)
|
||||
(i64.ge_u
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(return
|
||||
(f64.mul
|
||||
(f64.const 0)
|
||||
(get_local $0)
|
||||
(block
|
||||
(if
|
||||
(i64.eq
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(return
|
||||
(f64.mul
|
||||
(f64.const 0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(get_local $10)
|
||||
(i64.shl
|
||||
(get_local $2)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(i64.sub
|
||||
(get_local $4)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.shl
|
||||
(get_local $2)
|
||||
(i64.const 1)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(i64.sub
|
||||
(get_local $4)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(br $repeat|0)
|
||||
)
|
||||
)
|
||||
(set_local $10
|
||||
(i64.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.eqz
|
||||
(i64.shr_u
|
||||
(get_local $10)
|
||||
(i64.const 63)
|
||||
)
|
||||
(i64.ge_u
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(block
|
||||
(if
|
||||
(i64.eqz
|
||||
(get_local $10)
|
||||
(i64.eq
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(return
|
||||
(f64.mul
|
||||
@ -327,11 +315,14 @@
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(get_local $10)
|
||||
(i64.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $11
|
||||
(set_local $10
|
||||
(i64.clz
|
||||
(i64.shl
|
||||
(get_local $2)
|
||||
@ -342,13 +333,13 @@
|
||||
(set_local $4
|
||||
(i64.sub
|
||||
(get_local $4)
|
||||
(get_local $11)
|
||||
(get_local $10)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.shl
|
||||
(get_local $2)
|
||||
(get_local $11)
|
||||
(get_local $10)
|
||||
)
|
||||
)
|
||||
(if
|
||||
@ -484,7 +475,6 @@
|
||||
(local $8 i32)
|
||||
(local $9 i32)
|
||||
(local $10 i32)
|
||||
(local $11 i32)
|
||||
(set_local $2
|
||||
(i32.reinterpret/f32
|
||||
(get_local $0)
|
||||
@ -696,79 +686,68 @@
|
||||
)
|
||||
)
|
||||
(block $break|0
|
||||
(loop $repeat|0
|
||||
(br_if $break|0
|
||||
(i32.eqz
|
||||
(i32.gt_s
|
||||
(get_local $4)
|
||||
(get_local $5)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.gt_s
|
||||
(get_local $4)
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(set_local $10
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.shr_u
|
||||
(get_local $10)
|
||||
(i32.const 31)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(if
|
||||
(i32.eqz
|
||||
(get_local $10)
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(return
|
||||
(f32.mul
|
||||
(f32.const 0)
|
||||
(get_local $0)
|
||||
(block
|
||||
(if
|
||||
(i32.eq
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(return
|
||||
(f32.mul
|
||||
(f32.const 0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(get_local $10)
|
||||
(i32.shl
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(i32.sub
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.shl
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(i32.sub
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $repeat|0)
|
||||
)
|
||||
)
|
||||
(set_local $10
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.shr_u
|
||||
(get_local $10)
|
||||
(i32.const 31)
|
||||
)
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(block
|
||||
(if
|
||||
(i32.eqz
|
||||
(get_local $10)
|
||||
(i32.eq
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(return
|
||||
(f32.mul
|
||||
@ -778,11 +757,14 @@
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(get_local $10)
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $11
|
||||
(set_local $10
|
||||
(i32.clz
|
||||
(i32.shl
|
||||
(get_local $2)
|
||||
@ -793,13 +775,13 @@
|
||||
(set_local $4
|
||||
(i32.sub
|
||||
(get_local $4)
|
||||
(get_local $11)
|
||||
(get_local $10)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.shl
|
||||
(get_local $2)
|
||||
(get_local $11)
|
||||
(get_local $10)
|
||||
)
|
||||
)
|
||||
(if
|
||||
|
Reference in New Issue
Block a user