aboutsummaryrefslogtreecommitdiff
path: root/src/strings/strings_test.go
diff options
context:
space:
mode:
authorerifan01 <eric.fang@arm.com>2022-10-25 12:08:05 +0800
committerEric Fang <eric.fang@arm.com>2022-10-29 04:48:07 +0000
commite09bbaec69a8ff960110e13eabb3bef5331ecb0c (patch)
tree87cb47a464ae27caf59c463547ed55f1b92e146a /src/strings/strings_test.go
parent8a9e2d9d49a9d5234b52a0360ed6a0f91753c291 (diff)
downloadgo-e09bbaec69a8ff960110e13eabb3bef5331ecb0c.tar.xz
cmd/compile: enable address folding for global symbols of shared library
Address folding is disabled in CL42172, the commit message of which said that "In shared library, load/store of global is rewritten to using GOT and temp register, which conflicts with the use of temp register for assembling large offset.". Actually this doesn't happen because the sequence of instructions when rewritten to use Got looks like this: MOVD $sym, Rx becomes MOVD sym@GOT, Rx If there is an offset off, there will be one more instruction: ADD $off, Rx, Rx And MOVD sym, Rx becomes MOVD sym@GOT, REGTMP MOVx (REGTMP), Ry If there is a small offset off, it becomes: MOVD sym@GOT, REGTMP MOVx (REGTMP)off, Ry If off is very large, it becomes: MOVD sym@GOT, REGTMP MOVD $off, Rt ADD Rt, REGTMP MOVx (REGTMP), Ry We can see that the address can be calculated correctly, and testing on darwin/arm64 confirms this. Removing this restriction is beneficial to further optimize the sequence of "ADRP+ADD+LD/ST" to "ADRP+LD/ST(offset), so this CL removes it. Change-Id: I0e9f7bc1723e0a027f32cf0ae2c41cd6df49defe Reviewed-on: https://go-review.googlesource.com/c/go/+/445535 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Eric Fang <eric.fang@arm.com> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/strings/strings_test.go')
0 files changed, 0 insertions, 0 deletions