aboutsummaryrefslogtreecommitdiff
path: root/test/codegen
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2022-04-25 17:18:19 -0400
committerCherry Mui <cherryyz@google.com>2022-05-13 19:51:03 +0000
commit540f8c2b50f5def060244853673ccfc94d2d3e43 (patch)
tree0531fd6dca6c187b190c8e81c7db1b4b3449377b /test/codegen
parentba8310cf29ee78576a3da8a3ce8e87075df834df (diff)
downloadgo-540f8c2b50f5def060244853673ccfc94d2d3e43.tar.xz
cmd/compile: use jump table on ARM64
Following CL 357330, use jump tables on ARM64. name old time/op new time/op delta Switch8Predictable-4 3.41ns ± 0% 3.21ns ± 0% ~ (p=0.079 n=4+5) Switch8Unpredictable-4 12.0ns ± 0% 9.5ns ± 0% -21.17% (p=0.000 n=5+4) Switch32Predictable-4 3.06ns ± 0% 2.82ns ± 0% -7.78% (p=0.008 n=5+5) Switch32Unpredictable-4 13.3ns ± 0% 9.5ns ± 0% -28.87% (p=0.016 n=4+5) SwitchStringPredictable-4 3.71ns ± 0% 3.21ns ± 0% -13.43% (p=0.000 n=5+4) SwitchStringUnpredictable-4 14.8ns ± 0% 15.1ns ± 0% +2.37% (p=0.008 n=5+5) Change-Id: Ia0b85df7ca9273cf70c05eb957225c6e61822fa6 Reviewed-on: https://go-review.googlesource.com/c/go/+/403979 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com>
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 a6566834a8..af3762869a 100644
--- a/test/codegen/switch.go
+++ b/test/codegen/switch.go
@@ -24,6 +24,7 @@ func f(x string) int {
// use jump tables for 8+ int cases
func square(x int) int {
// amd64:`JMP\s\(.*\)\(.*\)$`
+ // arm64:`MOVD\s\(R.*\)\(R.*<<3\)`,`JMP\s\(R.*\)$`
switch x {
case 1:
return 1
@@ -49,6 +50,7 @@ func square(x int) int {
// use jump tables for 8+ string lengths
func length(x string) int {
// amd64:`JMP\s\(.*\)\(.*\)$`
+ // arm64:`MOVD\s\(R.*\)\(R.*<<3\)`,`JMP\s\(R.*\)$`
switch x {
case "a":
return 1