package x86
import (
"github.com/segmentio/asm/cpu/cpuid"
. "golang.org/x/sys/cpu"
)
type CPU cpuid .CPU
func (cpu CPU ) Has (feature Feature ) bool {
return cpuid .CPU (cpu ).Has (cpuid .Feature (feature ))
}
func (cpu *CPU ) set (feature Feature , enable bool ) {
(*cpuid .CPU )(cpu ).Set (cpuid .Feature (feature ), enable )
}
type Feature cpuid .Feature
const (
SSE Feature = 1 << iota
SSE2
SSE3
SSE41
SSE42
SSE4A
SSSE3
AVX
AVX2
AVX512BF16
AVX512BITALG
AVX512BW
AVX512CD
AVX512DQ
AVX512ER
AVX512F
AVX512IFMA
AVX512PF
AVX512VBMI
AVX512VBMI2
AVX512VL
AVX512VNNI
AVX512VP2INTERSECT
AVX512VPOPCNTDQ
CMOV
)
func ABI () CPU {
cpu := CPU (0 )
cpu .set (SSE , true )
cpu .set (SSE2 , X86 .HasSSE2 )
cpu .set (SSE3 , X86 .HasSSE3 )
cpu .set (SSE41 , X86 .HasSSE41 )
cpu .set (SSE42 , X86 .HasSSE42 )
cpu .set (SSE4A , false )
cpu .set (SSSE3 , X86 .HasSSSE3 )
cpu .set (AVX , X86 .HasAVX )
cpu .set (AVX2 , X86 .HasAVX2 )
cpu .set (AVX512BF16 , X86 .HasAVX512BF16 )
cpu .set (AVX512BITALG , X86 .HasAVX512BITALG )
cpu .set (AVX512BW , X86 .HasAVX512BW )
cpu .set (AVX512CD , X86 .HasAVX512CD )
cpu .set (AVX512DQ , X86 .HasAVX512DQ )
cpu .set (AVX512ER , X86 .HasAVX512ER )
cpu .set (AVX512F , X86 .HasAVX512F )
cpu .set (AVX512IFMA , X86 .HasAVX512IFMA )
cpu .set (AVX512PF , X86 .HasAVX512PF )
cpu .set (AVX512VBMI , X86 .HasAVX512VBMI )
cpu .set (AVX512VBMI2 , X86 .HasAVX512VBMI2 )
cpu .set (AVX512VL , X86 .HasAVX512VL )
cpu .set (AVX512VNNI , X86 .HasAVX512VNNI )
cpu .set (AVX512VP2INTERSECT , false )
cpu .set (AVX512VPOPCNTDQ , X86 .HasAVX512VPOPCNTDQ )
cpu .set (CMOV , true )
return cpu
}
The pages are generated with Golds v0.6.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds .