diff options
author | Ryan Houdek <[email protected]> | 2022-05-23 15:56:01 -0700 |
---|---|---|
committer | Ryan Houdek <[email protected]> | 2022-05-23 15:57:32 -0700 |
commit | 0281129493eec9ed444537f4694be146eedbe9f4 (patch) | |
tree | 6e8843d2b026083648839aef2769ebf37c4bcf1c | |
parent | c88007b03e9eaac2d1671e61202f3272f24099c9 (diff) | |
download | xbyak-0281129493eec9ed444537f4694be146eedbe9f4.tar.gz xbyak-0281129493eec9ed444537f4694be146eedbe9f4.zip |
add detection of clzero
-rw-r--r-- | sample/test_util.cpp | 1 | ||||
-rw-r--r-- | xbyak/xbyak_util.h | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/sample/test_util.cpp b/sample/test_util.cpp index 7c930f0..0e9387e 100644 --- a/sample/test_util.cpp +++ b/sample/test_util.cpp @@ -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); diff --git a/xbyak/xbyak_util.h b/xbyak/xbyak_util.h index 8274ebe..a43d98a 100644 --- a/xbyak/xbyak_util.h +++ b/xbyak/xbyak_util.h @@ -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 |