From: Cherry Zhang Date: Sat, 31 Oct 2020 21:21:40 +0000 (-0400) Subject: runtime: use indexed load/store in ARM64 assembly X-Git-Tag: go1.16beta1~356 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=202aa085abfc2aa7f3095102b9d47c83e177fb84;p=gostls13.git runtime: use indexed load/store in ARM64 assembly Minor optimization. Spotted while working on that code. Change-Id: Ia02dee10d74bce79a0bef1eaba7fac1bfc27df38 Reviewed-on: https://go-review.googlesource.com/c/go/+/266899 Trust: Cherry Zhang Run-TryBot: Cherry Zhang TryBot-Result: Go Bot Reviewed-by: fannie zhang Reviewed-by: David Chase --- diff --git a/src/runtime/race_arm64.s b/src/runtime/race_arm64.s index 5b1a1cb89a..6bc389f69f 100644 --- a/src/runtime/race_arm64.s +++ b/src/runtime/race_arm64.s @@ -38,8 +38,7 @@ MRS_TPIDR_R0 \ TP_ALIGN \ MOVD runtime·tls_g(SB), R11 \ - ADD R11, R0 \ - MOVD 0(R0), g + MOVD (R0)(R11), g // func runtime·raceread(addr uintptr) // Called from instrumented code. diff --git a/src/runtime/tls_arm64.s b/src/runtime/tls_arm64.s index 701abae105..3f02974d5b 100644 --- a/src/runtime/tls_arm64.s +++ b/src/runtime/tls_arm64.s @@ -20,8 +20,7 @@ TEXT runtime·load_g(SB),NOSPLIT,$0 AND $0xfffffffffffffff8, R0 #endif MOVD runtime·tls_g(SB), R27 - ADD R27, R0 - MOVD 0(R0), g + MOVD (R0)(R27), g nocgo: RET @@ -38,8 +37,7 @@ TEXT runtime·save_g(SB),NOSPLIT,$0 AND $0xfffffffffffffff8, R0 #endif MOVD runtime·tls_g(SB), R27 - ADD R27, R0 - MOVD g, 0(R0) + MOVD g, (R0)(R27) nocgo: RET