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/arm: suboptimal handling of "MOVW $-N(Rx), Ry" #13280

Closed
mdempsky opened this issue Nov 16, 2015 · 0 comments
Closed

cmd/internal/obj/arm: suboptimal handling of "MOVW $-N(Rx), Ry" #13280

mdempsky opened this issue Nov 16, 2015 · 0 comments

Comments

@mdempsky
Copy link
Member

Currently, cmd/internal/obj/arm optimizes this instruction in sys_linux_arm.s:

sys_linux_arm.s:202          MOVW    $8(R13), R1  // timespec

into this ADD instruction:

    sys_linux_arm.s:202     0xe87b4 e28d1008        ADD $8, R13, R1

but misses an opportunity to optimize this move:

sys_linux_arm.s:261          MOVW    $-16(R1), R1

into a SUB instruction:

    sys_linux_arm.s:261     0xe8870 e59fb0b4        MOVW 0xb4(R15), R11
    sys_linux_arm.s:261     0xe8874 e081100b        ADD R11, R1, R1
    ...
    sys_linux_arm.s:324     0xe892c fffffff0        ?

Alternatively, there's not a lot of explicit "MOVW $-N(Rx), Ry" instructions in the ARM assembly, and the only compiler generated ones I've found are from cmd/internal/obj/arm's stacksplit function, so it's feasible to just change them all to use explicit SUB instructions instead.

Changing just stacksplit to use ASUB instead of AMOVW shaves ~5kB of text off cmd/go:

   text    data     bss     dec     hex filename
6666309  103960   85812 6856081  689d91 go.after
6671670  103960   85812 6861442  68b282 go.before
@mdempsky mdempsky added this to the Unplanned milestone Nov 16, 2015
@golang golang locked and limited conversation to collaborators Sep 29, 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

2 participants