mmcloughlin/meow

Use golang.org/x/sys/cpu for CPU feature detection?

mengzhuo opened this issue · 3 comments

Thanks for filing this issue. There are two reasons why I didn't do this.

Firstly I need to check for CPUID flags that are unsupported by x/sys/cpu.

meow/dispatch_amd64.go

Lines 5 to 16 in 871e507

// cpu contains feature flags relevant to selecting a Meow implementation.
var cpu struct {
HasOSXSAVE bool
HasAES bool
HasVAES bool
HasAVX bool
HasAVX512F bool
HasAVX512VL bool
HasAVX512DQ bool
EnabledAVX bool
EnabledAVX512 bool
}

Second, for a library such as this, I prefer to avoid dependencies unless strictly necessary.

I see.
I'm trying porting meow's ARMv8( arm64 ).
However it will be painful that implement arm64's CPU feature detection on its own.

I would welcome an ARMv8 pull request. If golang.org/x/sys/cpu provides the feature detection you need, it would be fine to use it. We would still need to use custom code for x86.