aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorlimeidan <limeidan@loongson.cn>2025-09-19 11:18:13 +0800
committerabner chenc <chenguoqi@loongson.cn>2025-09-27 05:02:58 -0700
commitaf6999e60d498887fceaeca89f4aa88ff35c91df (patch)
treef3a76706b883a23539817c53cbc4dab709318705 /test/codegen
parent63cd9120836fe935bf39dc9b3a19ad44eab7f063 (diff)
downloadgo-af6999e60d498887fceaeca89f4aa88ff35c91df.tar.xz
cmd/compile: implement jump table on loong64
Following CL 357330, use jump tables on Loong64. goos: linux goarch: loong64 pkg: cmd/compile/internal/test cpu: Loongson-3A6000-HV @ 2500.00MHz │ old │ new │ │ sec/op │ sec/op vs base │ Switch8Predictable 2.352n ± 0% 2.101n ± 0% -10.65% (p=0.000 n=10) Switch8Unpredictable 11.99n ± 0% 10.25n ± 0% -14.51% (p=0.000 n=10) Switch32Predictable 3.153n ± 0% 1.887n ± 1% -40.14% (p=0.000 n=10) Switch32Unpredictable 12.47n ± 0% 10.22n ± 0% -18.00% (p=0.000 n=10) SwitchStringPredictable 3.162n ± 0% 3.352n ± 0% +6.01% (p=0.000 n=10) SwitchStringUnpredictable 14.70n ± 0% 13.31n ± 0% -9.46% (p=0.000 n=10) SwitchTypePredictable 3.702n ± 0% 2.201n ± 0% -40.55% (p=0.000 n=10) SwitchTypeUnpredictable 16.18n ± 0% 14.48n ± 0% -10.51% (p=0.000 n=10) SwitchInterfaceTypePredictable 7.654n ± 0% 9.680n ± 0% +26.47% (p=0.000 n=10) SwitchInterfaceTypeUnpredictable 22.04n ± 0% 22.44n ± 0% +1.81% (p=0.000 n=10) geomean 7.441n 6.469n -13.07% Change-Id: Id6f30fa73349c60fac17670084daee56973a955f Reviewed-on: https://go-review.googlesource.com/c/go/+/705396 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Diffstat (limited to 'test/codegen')
-rw-r--r--test/codegen/switch.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/codegen/switch.go b/test/codegen/switch.go
index 509343110a..1a66a5ddf8 100644
--- a/test/codegen/switch.go
+++ b/test/codegen/switch.go
@@ -25,6 +25,7 @@ func f(x string) int {
func square(x int) int {
// amd64:`JMP\s\(.*\)\(.*\)$`
// arm64:`MOVD\s\(R.*\)\(R.*<<3\)`,`JMP\s\(R.*\)$`
+ // loong64: `ALSLV`,`MOVV`,`JMP`
switch x {
case 1:
return 1
@@ -51,6 +52,7 @@ func square(x int) int {
func length(x string) int {
// amd64:`JMP\s\(.*\)\(.*\)$`
// arm64:`MOVD\s\(R.*\)\(R.*<<3\)`,`JMP\s\(R.*\)$`
+ // loong64:`ALSLV`,`MOVV`,`JMP`
switch x {
case "a":
return 1