-
Notifications
You must be signed in to change notification settings - Fork 160
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
Add leading/trailing ones and zero count instructions (part 2) #1179
Conversation
6db6e1d
to
193048e
Compare
509f93a
to
4ca468e
Compare
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.
Thank you! Looks good! I left some potential optimization comments inline.
d6b7450
to
0e7b44b
Compare
3fff4c5
to
6f49946
Compare
6f49946
to
a82dc87
Compare
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.
Looks good! Thank you! I left one comment re updating cycle counts in the docs - but this is something we may need to revisit after #1133 is finalized.
| clz | Counts the number of leading zeros of one unsigned 64-bit integer.<br /> The input value is assumed to be represented using 32 bit limbs, but this is not checked.<br /> The stack transition looks as follows: `[n_hi, n_lo, ...] -> [clz, ...]`, where `clz` is a number of leading zeros of value `n`.<br /> This takes 59 cycles if $n < 2^{32}$ and 32 cycles otherwise. | | ||
| ctz | Counts the number of trailing zeros of one unsigned 64-bit integer.<br /> The input value is assumed to be represented using 32 bit limbs, but this is not checked.<br /> The stack transition looks as follows: `[n_hi, n_lo, ...] -> [ctz, ...]`, where `ctz` is a number of trailing zeros of value `n`.<br /> This takes 60 cycles if $n < 2^{32}$ and 33 cycles otherwise. | | ||
| clo | Counts the number of leading ones of one unsigned 64-bit integer.<br /> The input value is assumed to be represented using 32 bit limbs, but this is not checked.<br /> The stack transition looks as follows: `[n_hi, n_lo, ...] -> [clo, ...]`, where `clo` is a number of leading ones of value `n`.<br /> This takes 69 cycles if $n < 2^{32}$ and 37 cycles otherwise. | | ||
| cto | Counts the number of trailing ones of one unsigned 64-bit integer.<br /> The input value is assumed to be represented using 32 bit limbs, but this is not checked.<br /> The stack transition looks as follows: `[n_hi, n_lo, ...] -> [cto, ...]`, where `cto` is a number of trailing ones of value `n`.<br /> This takes 70 cycles if $n < 2^{32}$ and 38 cycles otherwise. | |
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.
Cycle counts here need to be updated.
ea080b2
to
6fd200e
Compare
b4da798
to
f4c5c5f
Compare
6fd200e
to
9b75f1d
Compare
f4c5c5f
to
6e985d8
Compare
6e985d8
to
945663c
Compare
This PR adds 4 new instructions for
std::math::u64
module:This PR partially implements features mentioned in #1133 issue. This PR should be merged after #1176.