Add support for checking for F16C support (https://en.wikipedia.org/wiki/F16C). (#212)

This commit is contained in:
Jesse Benson 2018-12-19 09:25:25 -08:00 committed by Weixing Zhang
parent ab350fa4c7
commit 0248390e4d
2 changed files with 3 additions and 0 deletions

View file

@ -56,6 +56,7 @@ CPUIDInfo::CPUIDInfo() noexcept {
int value = XGETBV();
bool has_avx = (data[2] & (1 << 28)) && ((value & AVX_MASK) == AVX_MASK);
bool has_avx512 = (value & AVX512_MASK) == AVX512_MASK;
has_f16c_ = has_avx && (data[2] & (1 << 29)) && (data[3] & (1 << 26));
if (num_IDs >= 7) {
GetCPUID(7, data);

View file

@ -14,11 +14,13 @@ public:
bool HasAVX2() const { return has_avx2_; }
bool HasAVX512f() const { return has_avx512f_; }
bool HasF16C() const { return has_f16c_; }
private:
CPUIDInfo() noexcept;
bool has_avx2_{false};
bool has_avx512f_{false};
bool has_f16c_{false};
};
}