-
Notifications
You must be signed in to change notification settings - Fork 830
Generalize transforms for #3153 #3193
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
Conversation
|
Quick fuzzed: Will fuzz it more carefully tomorrow. |
|
refuzzed |
tlively
left a comment
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.
Can you remind me why it's not enough to just do x % -C_pot --> x & (abs(C_pot) - 1)? Why does the comparison with zero need to be part of the pattern?
Co-authored-by: Thomas Lively <7121787+tlively@users.noreply.github.com>
|
tlively
left a comment
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.
LGTM with that one last comment addressed :)
tlively
left a comment
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.
Awesome, thanks :)
It's more general (additional) version of #3153 which also handle negative constant dividers:
(int32)x % -4 == 0-->(x & 3) == 0x % -C_pot == 0-->(x & (abs(C_pot) - 1)) == 0and special two-complement values as well:
(int32)x % 0x80000000 == 0-->(x & 0x7fffffff) == 0(int64)x % 0x8000000000000000 == 0-->(x & 0x7fffffffffffffff) == 0as separete rules:
(int32)x % 0x80000000-->x & 0x7fffffff(int64)x % 0x8000000000000000-->x & 0x7fffffffffffffffThe previous pr didn't use these possibilities.
cc @kripken @tlively