github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/platform/cpuid.go (about)

     1  package platform
     2  
     3  // CpuFeatureFlags exposes methods for querying CPU capabilities
     4  type CpuFeatureFlags interface {
     5  	// Has returns true when the specified flag (represented as uint64) is supported
     6  	Has(cpuFeature CpuFeature) bool
     7  	// HasExtra returns true when the specified extraFlag (represented as uint64) is supported
     8  	HasExtra(cpuFeature CpuFeature) bool
     9  }
    10  
    11  type CpuFeature uint64
    12  
    13  const (
    14  	// CpuFeatureAmd64SSE3 is the flag to query CpuFeatureFlags.Has for SSEv3 capabilities on amd64
    15  	CpuFeatureAmd64SSE3 CpuFeature = 1
    16  	// CpuFeatureAmd64SSE4_1 is the flag to query CpuFeatureFlags.Has for SSEv4.1 capabilities on amd64
    17  	CpuFeatureAmd64SSE4_1 CpuFeature = 1 << 19
    18  	// CpuFeatureAmd64SSE4_2 is the flag to query CpuFeatureFlags.Has for SSEv4.2 capabilities on amd64
    19  	CpuFeatureAmd64SSE4_2 CpuFeature = 1 << 20
    20  )
    21  
    22  const (
    23  	// CpuExtraFeatureAmd64ABM is the flag to query CpuFeatureFlags.HasExtra for Advanced Bit Manipulation capabilities (e.g. LZCNT) on amd64
    24  	CpuExtraFeatureAmd64ABM CpuFeature = 1 << 5
    25  )