-
-
Notifications
You must be signed in to change notification settings - Fork 65
Added __*shift_nz routines (for shifting by non-zero or a constant amount)
#756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,7 @@ __dtoull: | |
| ld l, a | ||
| ex (sp), hl | ||
| ; shift is non-zero and [1, 11] in the non-UB case | ||
| call c, __llshl | ||
| call c, __llshl_nz | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Proof: A is [1, 204] here, and |
||
| jr .finish | ||
| .shift_right: | ||
| ; A is [-1, -52] | ||
|
|
@@ -85,5 +85,5 @@ __dtoull: | |
| jr .finish_zero_or_one | ||
|
|
||
| .extern __llneg | ||
| .extern __llshl | ||
| .extern __llshl_nz | ||
| .extern __llshru | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,9 +71,9 @@ __ftod: | |
| .L.subnormal: | ||
| ; since this is subnormal, the LSB of the exponent is already zero | ||
| call __ictlz | ||
| ld c, a | ||
| ld c, a ; A is [1, 23] | ||
| ; shift until the MSB of the mantissa is the LSB of the exponent | ||
| call __ishl | ||
| call __ishl_nz | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Proof: |
||
| ; (Float64_bias - Float32_bias) = $0380 | ||
| ; expon = (Float64_bias - Float32_bias) - clz_result | ||
| add hl, hl | ||
|
|
@@ -101,4 +101,4 @@ __ftod: | |
| jr .L.shift_28 | ||
|
|
||
| .extern __ictlz | ||
| .extern __ishl | ||
| .extern __ishl_nz | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,7 +69,7 @@ __lltod: | |
| pop bc | ||
|
|
||
| ex (sp), hl ; (SP) = shift | ||
| call __llshru | ||
| call __llshru_nz | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Proof: Shift amount is [1, 11], and the exact same shift amount was used for |
||
| add a, 51 - 1 ; compensate for the implicit mantissa bit | ||
|
|
||
| ; BC/exponent = [$434*, $43E*] | ||
|
|
@@ -174,7 +174,7 @@ __ltod: | |
| .extern __lctlz | ||
| .extern __llctlz | ||
| .extern __llshl | ||
| .extern __llshru | ||
| .extern __llshru_nz | ||
| .extern __llneg | ||
| .extern __lladd_1 | ||
| .extern ___fe_cur_env | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proof: Shift amount should be 5-29, and the same shift amount was used in
DJNZ(which would break if the shift amount could be zero)