cpu_detect.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. // Detect the CPU, so we'll know which optimizations to use
  5. #pragma once
  6. #include <string>
  7. namespace Common {
  8. enum CPUVendor
  9. {
  10. VENDOR_INTEL = 0,
  11. VENDOR_AMD = 1,
  12. VENDOR_ARM = 2,
  13. VENDOR_OTHER = 3,
  14. };
  15. struct CPUInfo
  16. {
  17. CPUVendor vendor;
  18. char cpu_string[0x21];
  19. char brand_string[0x41];
  20. bool OS64bit;
  21. bool CPU64bit;
  22. bool Mode64bit;
  23. bool HTT;
  24. int num_cores;
  25. int logical_cpu_count;
  26. bool bSSE;
  27. bool bSSE2;
  28. bool bSSE3;
  29. bool bSSSE3;
  30. bool bPOPCNT;
  31. bool bSSE4_1;
  32. bool bSSE4_2;
  33. bool bLZCNT;
  34. bool bSSE4A;
  35. bool bAVX;
  36. bool bAVX2;
  37. bool bBMI1;
  38. bool bBMI2;
  39. bool bFMA;
  40. bool bFMA4;
  41. bool bAES;
  42. // FXSAVE/FXRSTOR
  43. bool bFXSR;
  44. bool bMOVBE;
  45. // This flag indicates that the hardware supports some mode
  46. // in which denormal inputs _and_ outputs are automatically set to (signed) zero.
  47. bool bFlushToZero;
  48. bool bLAHFSAHF64;
  49. bool bLongMode;
  50. bool bAtom;
  51. // ARMv8 specific
  52. bool bFP;
  53. bool bASIMD;
  54. bool bCRC32;
  55. bool bSHA1;
  56. bool bSHA2;
  57. // Call Detect()
  58. explicit CPUInfo();
  59. // Turn the cpu info into a string we can show
  60. std::string Summarize();
  61. private:
  62. // Detects the various cpu features
  63. void Detect();
  64. };
  65. extern CPUInfo cpu_info;
  66. } // namespace Common