Skip to content
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 Integer.bit_reverse, exposing the llvm.bitreverse intrinsic. #2710

Merged
merged 2 commits into from
Jun 8, 2018

Conversation

jemc
Copy link
Member

@jemc jemc commented May 24, 2018

I had a need for bit reverse semantics, noticed that Integer has bswap which exposes the llvm.bswap intrinsic, but the llvm.bitreverse intrinsic was missing.

So this PR adds the exposure of that missing intrinsic.

@jemc jemc added the changelog - added Automatically add "Added" CHANGELOG entry on merge label May 24, 2018
@jemc jemc force-pushed the feature/integer-bit-reverse branch from 7711b88 to 956da92 Compare May 24, 2018 05:19
Copy link
Contributor

@mfelsche mfelsche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

I am just afraid, when we use llvm-intrinsics, that they might not be available on 32 bit platforms as e.g. mulc (__muloti4).

Can anyone with a 32 bit system try to test this?

@@ -257,6 +257,7 @@ trait val Integer[A: Integer[A] val] is Real[A]
fun op_xor(y: A): A => this xor y
fun op_not(): A => not this

fun bit_reverse(): A
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may i ask you for a little docstring, maybe even with an example? :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call. Added in b85220b.

@mfelsche
Copy link
Contributor

mfelsche commented Jun 2, 2018

travis OSX build seemed to have been hanging. I restarted.

@SeanTAllen
Copy link
Member

Is this ready to be added?

@SeanTAllen SeanTAllen merged commit a4abcef into master Jun 8, 2018
@SeanTAllen SeanTAllen deleted the feature/integer-bit-reverse branch June 8, 2018 10:53
ponylang-main added a commit that referenced this pull request Jun 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - added Automatically add "Added" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants