-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: rotate instructions are not always emitted when they could be #18254
Comments
/cc @randall77 |
This issue is a side effect of doing rotate detection in walk instead of the SSA rewriter. |
I might try to tackle this. |
CL https://golang.org/cl/34232 mentions this issue. |
This function does not generate a rotation, even after CL 34232 is applied: func testRotate(op uint32) uint32 {
rot := uint((op >> 7) & 0x1E)
return ((op & 0xFF) >> rot) | ((op & 0xFF) << (32 - rot))
} Should I open a different issue? |
@rasky Yes, if you could please open a different issue. |
go version devel +41908a5453 Thu Dec 1 02:54:21 2016 +0000 linux/amd64
(1.8beta1)
What did you do?
https://play.golang.org/p/eyIlsgnmc4
What did you expect to see?
Both of the rotate functions can be inlined. For
rot7
, aROLL
instruction is generated:However, the constant propagation is incomplete for
rot
:Rotate instructions are common in crypto code and hashing algorithms. Here's an example of a significant speedup by forcing the compiler to emit the ROLQ:
cespare/xxhash@4a66a12
The text was updated successfully, but these errors were encountered: