cpu.go 888 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2017 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Package cpu implements processor feature detection
  5. // used by the Go standard libary.
  6. package cpufeat
  7. var X86 x86
  8. // The booleans in x86 contain the correspondingly named cpuid feature bit.
  9. // HasAVX and HasAVX2 are only set if the OS does support XMM and YMM registers
  10. // in addition to the cpuid feature bit being set.
  11. // The struct is padded to avoid false sharing.
  12. type x86 struct {
  13. _ [CacheLineSize]byte
  14. HasAES bool
  15. HasAVX bool
  16. HasAVX2 bool
  17. HasBMI1 bool
  18. HasBMI2 bool
  19. HasERMS bool
  20. HasOSXSAVE bool
  21. HasPCLMULQDQ bool
  22. HasPOPCNT bool
  23. HasSSE2 bool
  24. HasSSE3 bool
  25. HasSSSE3 bool
  26. HasSSE41 bool
  27. HasSSE42 bool
  28. _ [CacheLineSize]byte
  29. }