-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: use conditional execution in place of branches for small blocks on arm #10382
Comments
This is only applicable to 5g. arm64 doesn't have conditionally executed
instructions except conditional branches.
On arm64, we need to use CSEL and others (C(S)INC, C(S)INV, etc).
|
Do we generate conditional move instructions on i386/amd64? |
As far as I know, gc don't generate conditional move I think josh has a change to make bgen use setcc on I imagine it will be easier to use condition move |
Note that on arm64 we get a 68kB reduction in godoc, which is significant. |
I watched Aram write a bunch of peephole rules this afternoon, each On Thu, Apr 9, 2015 at 7:03 AM, Aram Hăvărneanu notifications@github.com
|
No, although as @minux said, we will hopefully soon generate SETcc. I'm working on reviving that CL now. Also, ARM can attach conditions to most instructions, not just MOVs. CMOV also has the pitfall that it unconditionally loads the source from memory; it is only the resulting store than is conditional. These are probably good reasons to make this happen after the initial codegen.
Thanks! I'll take a look, although if this will all be eclipsed by SSA in 1.6, it might not be worth the effort and risk right now. (I'm worried about the same issue w.r.t. to the SETcc work, but I've already done a lot of the work, so I'll see it through.)
Pretty awesome. |
For example, consider max:
This compiles roughly to:
But it could be:
The general guidance from ARM is that it is worth branching instead of using conditional instructions when you reach 4-6 conditional instructions.
It's unclear to me when this should be done:
Not urgent.
/cc @davecheney @4ad @minux
The text was updated successfully, but these errors were encountered: