[dev.simd] cmd/compile: more support for cpufeatures

add hasFeature, also record maximum feature for a function

Change-Id: I68dd063aad1c1dc0ef5310a9f5d970c03dd31a0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/710695
Reviewed-by: Junyang Shao <shaojunyang@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
David Chase 2025-10-09 14:39:59 -04:00 committed by Junyang Shao
parent be57d94c4c
commit ba72ee0f30
3 changed files with 7 additions and 0 deletions

View file

@ -473,6 +473,10 @@ const (
CPUsve2 CPUsve2
) )
func (f CPUfeatures) hasFeature(x CPUfeatures) bool {
return f&x == x
}
func (f CPUfeatures) String() string { func (f CPUfeatures) String() string {
if f == CPUNone { if f == CPUNone {
return "none" return "none"

View file

@ -201,6 +201,7 @@ func cpufeatures(f *Func) {
} }
b.CPUfeatures = feat b.CPUfeatures = feat
f.maxCPUFeatures |= feat // not necessary to refine this estimate below
} }
// If the flow graph is irreducible, things can still change on backedges. // If the flow graph is irreducible, things can still change on backedges.

View file

@ -41,6 +41,8 @@ type Func struct {
ABISelf *abi.ABIConfig // ABI for function being compiled ABISelf *abi.ABIConfig // ABI for function being compiled
ABIDefault *abi.ABIConfig // ABI for rtcall and other no-parsed-signature/pragma functions. ABIDefault *abi.ABIConfig // ABI for rtcall and other no-parsed-signature/pragma functions.
maxCPUFeatures CPUfeatures // union of all the CPU features in all the blocks.
scheduled bool // Values in Blocks are in final order scheduled bool // Values in Blocks are in final order
laidout bool // Blocks are ordered laidout bool // Blocks are ordered
NoSplit bool // true if function is marked as nosplit. Used by schedule check pass. NoSplit bool // true if function is marked as nosplit. Used by schedule check pass.