aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/asm
diff options
context:
space:
mode:
authorWayne Zuo <wdvxdr@golangcn.org>2022-11-08 15:39:27 +0800
committerJoel Sing <joel@sing.id.au>2023-02-21 18:34:13 +0000
commit481a6beba5a76403cd1c4be2fe7a6662439984c7 (patch)
tree21a9e386b2efd5093dddc47dfb7d74c550540761 /src/cmd/asm
parent51225f6fc648ba3e833f3493700c2996a816bdaa (diff)
downloadgo-481a6beba5a76403cd1c4be2fe7a6662439984c7.tar.xz
cmd/internal/obj/riscv: optimize loading large immediate with trailing zeros
This CL can avoid a memory load for some immediate. Reduce binary size slightly. compilecmp HEAD~1 -> HEAD HEAD~1 (9860faa512): math/big: remove underscores from Binomial docs HEAD (ac85312f10): cmd/internal/obj/riscv: optimize loading large immediate with many trailing zeros platform: linux/riscv64 file before after Δ % addr2line 3892904 3889844 -3060 -0.079% api 5558527 5555073 -3454 -0.062% asm 5191725 5187853 -3872 -0.075% buildid 2631958 2629356 -2602 -0.099% cgo 4722642 4718516 -4126 -0.087% compile 25579930 25564496 -15434 -0.060% cover 4989560 4985580 -3980 -0.080% dist 3538991 3536299 -2692 -0.076% doc 3990845 3987605 -3240 -0.081% fix 3410945 3407097 -3848 -0.113% link 6701702 6697926 -3776 -0.056% nm 3802030 3798664 -3366 -0.089% objdump 4211373 4207651 -3722 -0.088% pack 2423248 2421048 -2200 -0.091% pprof 14302052 14296714 -5338 -0.037% test2json 2724359 2721881 -2478 -0.091% trace 13598607 13590879 -7728 -0.057% vet 7612108 7607722 -4386 -0.058% go 15092773 15087323 -5450 -0.036% total 133976279 133891527 -84752 -0.063% Change-Id: I8615c7830ebfee0386f95d0c0fc4d29dc0b4c7fb Reviewed-on: https://go-review.googlesource.com/c/go/+/448635 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Joel Sing <joel@sing.id.au>
Diffstat (limited to 'src/cmd/asm')
-rw-r--r--src/cmd/asm/internal/asm/testdata/riscv64.s4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/asm/internal/asm/testdata/riscv64.s b/src/cmd/asm/internal/asm/testdata/riscv64.s
index 79d6054869..6f303858b4 100644
--- a/src/cmd/asm/internal/asm/testdata/riscv64.s
+++ b/src/cmd/asm/internal/asm/testdata/riscv64.s
@@ -318,7 +318,9 @@ start:
MOV $-2147483647, X5 // b70200809b821200
// Converted to load of symbol (AUIPC + LD)
- MOV $4294967296, X5 // 9702000083b20200
+ MOV $4294967295, X5 // 9702000083b20200
+ // Converted to MOV $1, X5 + SLLI $32, X5
+ MOV $4294967296, X5 // 9302100093920202
MOV (X5), X6 // 03b30200
MOV 4(X5), X6 // 03b34200