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/internal/obj/arm64: support more efficient relocations #10112

Closed
4ad opened this issue Mar 8, 2015 · 0 comments
Closed

cmd/internal/obj/arm64: support more efficient relocations #10112

4ad opened this issue Mar 8, 2015 · 0 comments
Milestone

Comments

@4ad
Copy link
Member

4ad commented Mar 8, 2015

We might want to investigate a R_ADDRARM64 relocation that would not
require pool literals.

Right now MOV g(SB), R is

MOV pool(PC), TMP
MOV (TMP), R
...
DWORD   g(SB)

So it uses 8 bytes of instructions and 8 bytes of pool. Note that the
pool literals are not coalesced (perhaps this can be implemented). We
can say that the cost of using R_ADDR is:

Cost(n * R_ADDR) = {2n+2n bytes, 2n loads}

A potential R_ADDRARM64 might do this instead:

ADRP    g(SB), TMP
MOV off(TMP), R

The ADRP instruction calculates the 4k page which holds g(SB), the final
MOV can just encode an immediate offset since it's in C_ADDCON0 class.

For MOV g(SB), R the generated code is:

ADRP    g(SB), R
ADR g(SB), R

Note that we don't even need the temporary register, and we don't even do any loads.

In both cases we don't need pool literals at all, and they only do one
or zero loads!

Cost(n * R_ADDRARM64) = {2n bytes, 0.5n loads}

Related to issue #10108.
Replaces 4ad/go#66.

@4ad 4ad assigned minux Mar 8, 2015
@4ad 4ad added this to the Go1.5Maybe milestone Mar 8, 2015
@4ad 4ad added the arch-arm64 label Mar 8, 2015
@minux minux modified the milestones: Go1.5, Go1.5Maybe Apr 3, 2015
@minux minux closed this as completed in 6e3a2a3 Apr 8, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
@rsc rsc unassigned minux Jun 23, 2022
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