You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

39 lines
1.7 KiB

  1. // Copyright 2018 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 for
  5. // various CPU architectures.
  6. package cpu
  7. // CacheLinePad is used to pad structs to avoid false sharing.
  8. type CacheLinePad struct{ _ [cacheLineSize]byte }
  9. // X86 contains the supported CPU features of the
  10. // current X86/AMD64 platform. If the current platform
  11. // is not X86/AMD64 then all feature flags are false.
  12. //
  13. // X86 is padded to avoid false sharing. Further the HasAVX
  14. // and HasAVX2 are only set if the OS supports XMM and YMM
  15. // registers in addition to the CPUID feature bit being set.
  16. var X86 struct {
  17. _ CacheLinePad
  18. HasAES bool // AES hardware implementation (AES NI)
  19. HasADX bool // Multi-precision add-carry instruction extensions
  20. HasAVX bool // Advanced vector extension
  21. HasAVX2 bool // Advanced vector extension 2
  22. HasBMI1 bool // Bit manipulation instruction set 1
  23. HasBMI2 bool // Bit manipulation instruction set 2
  24. HasERMS bool // Enhanced REP for MOVSB and STOSB
  25. HasFMA bool // Fused-multiply-add instructions
  26. HasOSXSAVE bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers.
  27. HasPCLMULQDQ bool // PCLMULQDQ instruction - most often used for AES-GCM
  28. HasPOPCNT bool // Hamming weight instruction POPCNT.
  29. HasSSE2 bool // Streaming SIMD extension 2 (always available on amd64)
  30. HasSSE3 bool // Streaming SIMD extension 3
  31. HasSSSE3 bool // Supplemental streaming SIMD extension 3
  32. HasSSE41 bool // Streaming SIMD extension 4 and 4.1
  33. HasSSE42 bool // Streaming SIMD extension 4 and 4.2
  34. _ CacheLinePad
  35. }