Navigation Menu

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

cmd/compile: ctz rules on s390x #19551

Closed
randall77 opened this issue Mar 14, 2017 · 2 comments
Closed

cmd/compile: ctz rules on s390x #19551

randall77 opened this issue Mar 14, 2017 · 2 comments
Milestone

Comments

@randall77
Copy link
Contributor

I don't think these rules do the right thing if the input argument is 0.
What does FLOGR return if the input is 0?
Ctz64 should return 64 if the input is 0, and Ctz32 should return 32 if the input is 0. But FLOGR is used for both, one of them at least has to be wrong.

It probably doesn't matter at the moment as the runtime probably never calls Ctz with a 0 argument. But I'm about to make math/bits use the intrinsic, and there it matters.

@mundaym

@randall77 randall77 added this to the Go1.9 milestone Mar 14, 2017
@mundaym
Copy link
Member

mundaym commented Mar 15, 2017

I can see why the rules looks dubious but they are correct. I've created a little program to demonstrate:

https://play.golang.org/p/LFdFii1YQC

Thanks for opening the issue though, always worth double checking these things :).

@randall77
Copy link
Contributor Author

Ok, I was confused about the bit twiddling. (CtzX 0) doesn't actually pass 0 to FLOGR.
Thanks for looking into it.

@golang golang locked and limited conversation to collaborators Mar 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants