[dev.simd] simd, cmd/compile, go build, go/doc: test tweaks

these are for CL 675618
simd package exists and imports internal/cpu
tweak tests to deal with goexperiment/not

Change-Id: I2de99d048f0a228d5f3cd750c39ee5925107556e
Reviewed-on: https://go-review.googlesource.com/c/go/+/677260
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Junyang Shao <shaojunyang@google.com>
This commit is contained in:
David Chase 2025-05-29 14:55:01 -04:00 committed by Junyang Shao
parent 71c0e550cd
commit eba2430c16
5 changed files with 32 additions and 2 deletions

20
src/simd/cpu.go Normal file
View file

@ -0,0 +1,20 @@
// Copyright 2025 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.
//go:build goexperiment.simd
// the build condition == if the experiment is not on, cmd/api TestCheck will see this and complain
// see also go/doc/comment, where "simd" is inserted to the package list of the experiment is not on.
package simd
import "internal/cpu"
func HasAVX512BW() bool {
return cpu.X86.HasAVX512BW
}
func HasAVX512VL() bool {
return cpu.X86.HasAVX512VL
}