mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-23 03:31:44 +00:00
Improve per-bit divmod loop for mod & rem (#307)
This commit is contained in:
@ -1697,7 +1697,6 @@
|
||||
(local $8 i32)
|
||||
(local $9 i32)
|
||||
(local $10 i32)
|
||||
(local $11 i32)
|
||||
(set_local $2
|
||||
(i32.reinterpret/f32
|
||||
(get_local $0)
|
||||
@ -1909,79 +1908,68 @@
|
||||
)
|
||||
)
|
||||
(block $break|0
|
||||
(loop $repeat|0
|
||||
(br_if $break|0
|
||||
(i32.eqz
|
||||
(i32.gt_s
|
||||
(get_local $4)
|
||||
(get_local $5)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i32.gt_s
|
||||
(get_local $4)
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(set_local $10
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.shr_u
|
||||
(get_local $10)
|
||||
(i32.const 31)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(if
|
||||
(i32.eqz
|
||||
(get_local $10)
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(return
|
||||
(f32.mul
|
||||
(f32.const 0)
|
||||
(get_local $0)
|
||||
(block
|
||||
(if
|
||||
(i32.eq
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(return
|
||||
(f32.mul
|
||||
(f32.const 0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(get_local $10)
|
||||
(i32.shl
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(i32.sub
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.shl
|
||||
(get_local $2)
|
||||
(i32.const 1)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(i32.sub
|
||||
(get_local $4)
|
||||
(i32.const 1)
|
||||
)
|
||||
)
|
||||
(br $repeat|0)
|
||||
)
|
||||
)
|
||||
(set_local $10
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.shr_u
|
||||
(get_local $10)
|
||||
(i32.const 31)
|
||||
)
|
||||
(i32.ge_u
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(block
|
||||
(if
|
||||
(i32.eqz
|
||||
(get_local $10)
|
||||
(i32.eq
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(return
|
||||
(f32.mul
|
||||
@ -1991,11 +1979,14 @@
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(get_local $10)
|
||||
(i32.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $11
|
||||
(set_local $10
|
||||
(i32.clz
|
||||
(i32.shl
|
||||
(get_local $2)
|
||||
@ -2006,13 +1997,13 @@
|
||||
(set_local $4
|
||||
(i32.sub
|
||||
(get_local $4)
|
||||
(get_local $11)
|
||||
(get_local $10)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i32.shl
|
||||
(get_local $2)
|
||||
(get_local $11)
|
||||
(get_local $10)
|
||||
)
|
||||
)
|
||||
(if
|
||||
@ -3525,7 +3516,6 @@
|
||||
(local $8 i32)
|
||||
(local $9 i64)
|
||||
(local $10 i64)
|
||||
(local $11 i64)
|
||||
(set_local $2
|
||||
(i64.reinterpret/f64
|
||||
(get_local $0)
|
||||
@ -3737,79 +3727,68 @@
|
||||
)
|
||||
)
|
||||
(block $break|0
|
||||
(loop $repeat|0
|
||||
(br_if $break|0
|
||||
(i32.eqz
|
||||
(i64.gt_s
|
||||
(get_local $4)
|
||||
(get_local $5)
|
||||
)
|
||||
(loop $continue|0
|
||||
(if
|
||||
(i64.gt_s
|
||||
(get_local $4)
|
||||
(get_local $5)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(set_local $10
|
||||
(i64.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.eqz
|
||||
(i64.shr_u
|
||||
(get_local $10)
|
||||
(i64.const 63)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(block
|
||||
(if
|
||||
(i64.eqz
|
||||
(get_local $10)
|
||||
(i64.ge_u
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(return
|
||||
(f64.mul
|
||||
(f64.const 0)
|
||||
(get_local $0)
|
||||
(block
|
||||
(if
|
||||
(i64.eq
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(return
|
||||
(f64.mul
|
||||
(f64.const 0)
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(get_local $10)
|
||||
(i64.shl
|
||||
(get_local $2)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(i64.sub
|
||||
(get_local $4)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.shl
|
||||
(get_local $2)
|
||||
(i64.const 1)
|
||||
)
|
||||
(br $continue|0)
|
||||
)
|
||||
)
|
||||
(set_local $4
|
||||
(i64.sub
|
||||
(get_local $4)
|
||||
(i64.const 1)
|
||||
)
|
||||
)
|
||||
(br $repeat|0)
|
||||
)
|
||||
)
|
||||
(set_local $10
|
||||
(i64.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
(if
|
||||
(i64.eqz
|
||||
(i64.shr_u
|
||||
(get_local $10)
|
||||
(i64.const 63)
|
||||
)
|
||||
(i64.ge_u
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(block
|
||||
(if
|
||||
(i64.eqz
|
||||
(get_local $10)
|
||||
(i64.eq
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
(return
|
||||
(f64.mul
|
||||
@ -3819,11 +3798,14 @@
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(get_local $10)
|
||||
(i64.sub
|
||||
(get_local $2)
|
||||
(get_local $3)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set_local $11
|
||||
(set_local $10
|
||||
(i64.clz
|
||||
(i64.shl
|
||||
(get_local $2)
|
||||
@ -3834,13 +3816,13 @@
|
||||
(set_local $4
|
||||
(i64.sub
|
||||
(get_local $4)
|
||||
(get_local $11)
|
||||
(get_local $10)
|
||||
)
|
||||
)
|
||||
(set_local $2
|
||||
(i64.shl
|
||||
(get_local $2)
|
||||
(get_local $11)
|
||||
(get_local $10)
|
||||
)
|
||||
)
|
||||
(if
|
||||
|
Reference in New Issue
Block a user