2013-12-25 14:21:21 +09:00
|
|
|
// WTFPL
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <array>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#if defined(__i386__) || defined(_M_IX86)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
namespace spades {
|
|
|
|
|
|
|
|
enum class CpuFeature {
|
|
|
|
MMX,
|
|
|
|
SSE,
|
|
|
|
SSE2,
|
|
|
|
SSE3,
|
|
|
|
SSSE3,
|
|
|
|
FMA,
|
|
|
|
AVX,
|
|
|
|
AVX2,
|
|
|
|
AVX512CD,
|
|
|
|
AVX512ER,
|
|
|
|
AVX512PF,
|
|
|
|
AVX512F,
|
|
|
|
SimultaneousMT
|
|
|
|
};
|
|
|
|
|
2014-03-02 17:47:12 +01:00
|
|
|
#if defined(__i386__) || defined(_M_IX86) || defined(__amd64__)
|
2013-12-25 14:21:21 +09:00
|
|
|
|
|
|
|
class CpuID {
|
|
|
|
std::string vendor;
|
|
|
|
std::string brand;
|
|
|
|
uint32_t featureEcx;
|
|
|
|
uint32_t featureEdx;
|
|
|
|
uint32_t subfeature;
|
|
|
|
std::string info;
|
|
|
|
public:
|
|
|
|
CpuID();
|
|
|
|
|
|
|
|
bool Supports(CpuFeature feature);
|
|
|
|
|
|
|
|
const std::string& GetVendorId() { return vendor; }
|
|
|
|
const std::string& GetBrand() { return brand; }
|
|
|
|
|
|
|
|
const std::string& GetMiscInfo() { return info; }
|
|
|
|
|
|
|
|
};
|
|
|
|
#else
|
|
|
|
|
|
|
|
class CpuID {
|
|
|
|
public:
|
|
|
|
CpuID() {
|
|
|
|
}
|
|
|
|
bool Supports(CpuFeature feature) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string GetVendorId() { return "Unknown"; }
|
|
|
|
std::string GetBrand() { return "Unknown"; }
|
|
|
|
std::string GetMiscInfo() { return "(none)"; }
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|