cpu_detect.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Copyright 2013 Dolphin Emulator Project
  2. // Licensed under GPLv2
  3. // Refer to the license.txt file included.
  4. // Detect the cpu, so we'll know which optimizations to use
  5. #ifndef _CPUDETECT_H_
  6. #define _CPUDETECT_H_
  7. #include <string>
  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 bAES;
  37. bool bLAHFSAHF64;
  38. bool bLongMode;
  39. // ARM specific CPUInfo
  40. bool bSwp;
  41. bool bHalf;
  42. bool bThumb;
  43. bool bFastMult;
  44. bool bVFP;
  45. bool bEDSP;
  46. bool bThumbEE;
  47. bool bNEON;
  48. bool bVFPv3;
  49. bool bTLS;
  50. bool bVFPv4;
  51. bool bIDIVa;
  52. bool bIDIVt;
  53. bool bArmV7; // enable MOVT, MOVW etc
  54. // ARMv8 specific
  55. bool bFP;
  56. bool bASIMD;
  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. #endif // _CPUDETECT_H_