cpu_detect.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. enum CPUVendor
  8. {
  9. VENDOR_INTEL = 0,
  10. VENDOR_AMD = 1,
  11. VENDOR_ARM = 2,
  12. VENDOR_OTHER = 3,
  13. };
  14. struct CPUInfo
  15. {
  16. CPUVendor vendor;
  17. char cpu_string[0x21];
  18. char brand_string[0x41];
  19. bool OS64bit;
  20. bool CPU64bit;
  21. bool Mode64bit;
  22. bool HTT;
  23. int num_cores;
  24. int logical_cpu_count;
  25. bool bSSE;
  26. bool bSSE2;
  27. bool bSSE3;
  28. bool bSSSE3;
  29. bool bPOPCNT;
  30. bool bSSE4_1;
  31. bool bSSE4_2;
  32. bool bLZCNT;
  33. bool bSSE4A;
  34. bool bAVX;
  35. bool bAES;
  36. bool bLAHFSAHF64;
  37. bool bLongMode;
  38. // ARM specific CPUInfo
  39. bool bSwp;
  40. bool bHalf;
  41. bool bThumb;
  42. bool bFastMult;
  43. bool bVFP;
  44. bool bEDSP;
  45. bool bThumbEE;
  46. bool bNEON;
  47. bool bVFPv3;
  48. bool bTLS;
  49. bool bVFPv4;
  50. bool bIDIVa;
  51. bool bIDIVt;
  52. bool bArmV7; // enable MOVT, MOVW etc
  53. // ARMv8 specific
  54. bool bFP;
  55. bool bASIMD;
  56. // Call Detect()
  57. explicit CPUInfo();
  58. // Turn the cpu info into a string we can show
  59. std::string Summarize();
  60. private:
  61. // Detects the various cpu features
  62. void Detect();
  63. };
  64. extern CPUInfo cpu_info;