add detection of clzero

This commit is contained in:
Ryan Houdek 2022-05-23 15:56:01 -07:00
parent c88007b03e
commit 0281129493
2 changed files with 10 additions and 1 deletions

View file

@ -88,6 +88,7 @@ void putCPUinfo()
{ Cpu::tCLDEMOTE, "cldemote" },
{ Cpu::tMOVDIRI, "movdiri" },
{ Cpu::tMOVDIR64B, "movdir64b" },
{ Cpu::tCLZERO, "clzero" },
};
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
if (cpu.has(tbl[i].type)) printf(" %s", tbl[i].str);

View file

@ -415,6 +415,7 @@ public:
static const Type tCLDEMOTE;
static const Type tMOVDIRI;
static const Type tMOVDIR64B;
static const Type tCLZERO;
CpuT()
: type_(NONE)
@ -453,7 +454,8 @@ public:
// Extended flags information
getCpuid(0x80000000, data);
if (EAX >= 0x80000001) {
const unsigned int maxExtendedNum = EAX;
if (maxExtendedNum >= 0x80000001) {
getCpuid(0x80000001, data);
if (EDX & (1U << 31)) type_ |= t3DN;
@ -465,6 +467,11 @@ public:
if (ECX & (1U << 8)) type_ |= tPREFETCHW;
}
if (maxExtendedNum >= 0x80000008) {
getCpuid(0x80000008, data);
if (EBX & (1U << 0)) type_ |= tCLZERO;
}
getCpuid(1, data);
if (ECX & (1U << 0)) type_ |= tSSE3;
if (ECX & (1U << 9)) type_ |= tSSSE3;
@ -642,6 +649,7 @@ template<int dummy> const Type CpuT<dummy>::tCLFLUSHOPT = uint64_t(1) << 63;
template<int dummy> const Type CpuT<dummy>::tCLDEMOTE = Type(0, 1 << 0);
template<int dummy> const Type CpuT<dummy>::tMOVDIRI = Type(0, 1 << 1);
template<int dummy> const Type CpuT<dummy>::tMOVDIR64B = Type(0, 1 << 2);
template<int dummy> const Type CpuT<dummy>::tCLZERO = Type(0, 1 << 3);
} // local