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: Unnecessary register shifts in ppc64/ppc64le generated code #14943

Closed
laboger opened this issue Mar 24, 2016 · 2 comments
Closed

Comments

@laboger
Copy link
Contributor

laboger commented Mar 24, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go version devel +570a2b0 Thu Mar 24 14:15:17 2016 +0000 linux/ppc64le
  2. What operating system and processor architecture are you using (go env)?
    linux ppc64le
  3. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.

In looking at gc generated code, I have seen many examples where there are several extra shift instructions, shifting the same registers back and forth unnecessarily.

  1. What did you expect to see?

Only the shifts needed to perform the operation.

  1. What did you see instead?

Multiple extra unnecessary shift instructions.

Here is an example from the compile of runtime.scanobject. This one has more shifts than I usually see, probably because of what the bits() function is doing.

/home/boger/golang/plain/go/src/runtime/mgcmark.go:997
}
// During checkmarking, 1-word objects store the checkmark
// in the type bit for the one word. The only one-word objects
// are pointers, or else they'd be merged with other non-pointer
// data into larger allocations.
bits := hbits.bits()
.........

2f32c: 28 00 64 78 rldic r4,r3,0,32
2f330: 28 00 82 78 rldic r2,r4,0,32
2f334: 28 00 43 78 rldic r3,r2,0,32
2f338: 28 00 62 78 rldic r2,r3,0,32
2f33c: 28 00 44 78 rldic r4,r2,0,32

@laboger
Copy link
Contributor Author

laboger commented Mar 25, 2016

Michael Munday has provided me with his patch for something similar, I am going to try it out.

@bradfitz bradfitz added this to the Unplanned milestone Apr 9, 2016
@laboger
Copy link
Contributor Author

laboger commented Sep 6, 2016

This appears to be resolved with SSA in master so I will close.

@laboger laboger closed this as completed Sep 6, 2016
@golang golang locked and limited conversation to collaborators Sep 6, 2017
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