mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
goarch: amd64
cpu: 12th Gen Intel(R) Core(TM) i7-12700
│ base │ exp │
│ sec/op │ sec/op vs base │
MemclrKnownSize112-20 1.270n ± 14% 1.006n ± 0% -20.72% (p=0.000 n=10)
MemclrKnownSize128-20 1.266n ± 0% 1.005n ± 0% -20.58% (p=0.000 n=10)
MemclrKnownSize192-20 1.771n ± 0% 1.579n ± 1% -10.84% (p=0.000 n=10)
MemclrKnownSize248-20 4.034n ± 0% 3.520n ± 0% -12.75% (p=0.000 n=10)
MemclrKnownSize256-20 2.269n ± 0% 2.014n ± 0% -11.26% (p=0.000 n=10)
MemclrKnownSize512-20 4.280n ± 0% 4.030n ± 0% -5.84% (p=0.000 n=10)
MemclrKnownSize1024-20 8.309n ± 1% 8.057n ± 0% -3.03% (p=0.000 n=10)
Change-Id: I8f1627e2a1e981ff351dc7178932b32a2627f765
Reviewed-on: https://go-review.googlesource.com/c/go/+/678937
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
53 lines
1 KiB
Go
53 lines
1 KiB
Go
// asmcheck
|
|
|
|
// Copyright 2022 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.
|
|
|
|
// Test that optimized range memclr works with pointers to arrays.
|
|
// The clears get inlined, see https://github.com/golang/go/issues/56997
|
|
|
|
package codegen
|
|
|
|
type T struct {
|
|
a *[10]int
|
|
b [10]int
|
|
s []int
|
|
}
|
|
|
|
func (t *T) f() {
|
|
// amd64:-".*runtime.memclrNoHeapPointers"
|
|
// amd64:`MOVUPS\tX15,`
|
|
for i := range t.a {
|
|
t.a[i] = 0
|
|
}
|
|
|
|
// amd64:-".*runtime.memclrNoHeapPointers"
|
|
// amd64:`MOVUPS\tX15,`
|
|
for i := range *t.a {
|
|
t.a[i] = 0
|
|
}
|
|
|
|
// amd64:-".*runtime.memclrNoHeapPointers"
|
|
// amd64:`MOVUPS\tX15,`
|
|
for i := range t.a {
|
|
(*t.a)[i] = 0
|
|
}
|
|
|
|
// amd64:-".*runtime.memclrNoHeapPointers"
|
|
// amd64:`MOVUPS\tX15,`
|
|
for i := range *t.a {
|
|
(*t.a)[i] = 0
|
|
}
|
|
|
|
// amd64:-".*runtime.memclrNoHeapPointers"
|
|
// amd64:`MOVUPS\tX15,`
|
|
for i := range t.b {
|
|
t.b[i] = 0
|
|
}
|
|
|
|
// amd64:".*runtime.memclrNoHeapPointers"
|
|
for i := range t.s {
|
|
t.s[i] = 0
|
|
}
|
|
}
|