]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/ssa: inline small memmove for arm64
authorBalaram Makam <bmakam.qdt@qualcommdatacenter.com>
Mon, 5 Mar 2018 20:51:54 +0000 (15:51 -0500)
committerCherry Zhang <cherryyz@google.com>
Tue, 6 Mar 2018 18:37:19 +0000 (18:37 +0000)
This patch enables the optimization for arm64 target.

Performance results on Amberwing for strconv benchmark:
name             old time/op  new time/op  delta
Quote             721ns ± 0%   617ns ± 0%  -14.40%  (p=0.016 n=5+4)
QuoteRune         118ns ± 0%   117ns ± 0%   -0.85%  (p=0.008 n=5+5)
AppendQuote       436ns ± 2%   321ns ± 0%  -26.31%  (p=0.008 n=5+5)
AppendQuoteRune  34.7ns ± 0%  28.4ns ± 0%  -18.16%  (p=0.000 n=5+4)
[Geo mean]        189ns        160ns       -15.41%

Change-Id: I5714c474e7483d07ca338fbaf49beb4bbcc11c44
Reviewed-on: https://go-review.googlesource.com/98735
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Giovanni Bajo <rasky@develer.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/ssa/rewrite.go
test/codegen/movesmall.go [new file with mode: 0644]

index c55685f91f508a123584c7ee2f6906abe0d468ca..971c21554ac3e614d8dc13a996b741b2220c9479 100644 (file)
@@ -830,7 +830,7 @@ func isInlinableMemmoveSize(sz int64, c *Config) bool {
        switch c.arch {
        case "amd64", "amd64p32":
                return sz <= 16
-       case "386", "ppc64", "s390x", "ppc64le":
+       case "386", "ppc64", "s390x", "ppc64le", "arm64":
                return sz <= 8
        case "arm", "mips", "mips64", "mipsle", "mips64le":
                return sz <= 4
diff --git a/test/codegen/movesmall.go b/test/codegen/movesmall.go
new file mode 100644 (file)
index 0000000..59b2a16
--- /dev/null
@@ -0,0 +1,13 @@
+// asmcheck
+
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package codegen
+
+func movesmall() {
+       // arm64:-"memmove"
+       x := [...]byte{1, 2, 3, 4, 5, 6, 7}
+       copy(x[1:], x[:])
+}