add detection of avx10/apx_f

This commit is contained in:
MITSUNARI Shigeo 2023-12-14 17:26:26 +09:00
parent 835f6d2e6d
commit 5315658ad6
2 changed files with 16 additions and 0 deletions

View file

@ -103,12 +103,17 @@ void putCPUinfo(bool onlyCpuidFeature)
{ Cpu::tSM3, "sm3" }, { Cpu::tSM3, "sm3" },
{ Cpu::tSM4, "sm4" }, { Cpu::tSM4, "sm4" },
{ Cpu::tAVX_VNNI_INT16, "avx_vnni_int16" }, { Cpu::tAVX_VNNI_INT16, "avx_vnni_int16" },
{ Cpu::tAPX_F, "apx_f" },
{ Cpu::tAVX10, "avx10" },
}; };
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) { for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
if (cpu.has(tbl[i].type)) printf(" %s", tbl[i].str); if (cpu.has(tbl[i].type)) printf(" %s", tbl[i].str);
} }
printf("\n"); printf("\n");
if (onlyCpuidFeature) return; if (onlyCpuidFeature) return;
if (cpu.has(Cpu::tAVX10)) {
printf("AVX10 version %d\n", cpu.getAVX10version());
}
if (cpu.has(Cpu::tPOPCNT)) { if (cpu.has(Cpu::tPOPCNT)) {
const int n = 0x12345678; // bitcount = 13 const int n = 0x12345678; // bitcount = 13
const int ok = 13; const int ok = 13;

View file

@ -144,6 +144,7 @@ private:
uint32_t dataCacheSize_[maxNumberCacheLevels]; uint32_t dataCacheSize_[maxNumberCacheLevels];
uint32_t coresSharignDataCache_[maxNumberCacheLevels]; uint32_t coresSharignDataCache_[maxNumberCacheLevels];
uint32_t dataCacheLevels_; uint32_t dataCacheLevels_;
uint32_t avx10version_;
uint32_t get32bitAsBE(const char *x) const uint32_t get32bitAsBE(const char *x) const
{ {
@ -470,6 +471,8 @@ public:
XBYAK_DEFINE_TYPE(79, tSM3); XBYAK_DEFINE_TYPE(79, tSM3);
XBYAK_DEFINE_TYPE(80, tSM4); XBYAK_DEFINE_TYPE(80, tSM4);
XBYAK_DEFINE_TYPE(81, tAVX_VNNI_INT16); XBYAK_DEFINE_TYPE(81, tAVX_VNNI_INT16);
XBYAK_DEFINE_TYPE(82, tAPX_F);
XBYAK_DEFINE_TYPE(83, tAVX10);
#undef XBYAK_SPLIT_ID #undef XBYAK_SPLIT_ID
#undef XBYAK_DEFINE_TYPE #undef XBYAK_DEFINE_TYPE
@ -481,6 +484,7 @@ public:
, dataCacheSize_() , dataCacheSize_()
, coresSharignDataCache_() , coresSharignDataCache_()
, dataCacheLevels_(0) , dataCacheLevels_(0)
, avx10version_(0)
{ {
uint32_t data[4] = {}; uint32_t data[4] = {};
const uint32_t& EAX = data[0]; const uint32_t& EAX = data[0];
@ -627,8 +631,14 @@ public:
if (EDX & (1U << 5)) type_ |= tAVX_NE_CONVERT; if (EDX & (1U << 5)) type_ |= tAVX_NE_CONVERT;
if (EDX & (1U << 10)) type_ |= tAVX_VNNI_INT16; if (EDX & (1U << 10)) type_ |= tAVX_VNNI_INT16;
if (EDX & (1U << 14)) type_ |= tPREFETCHITI; if (EDX & (1U << 14)) type_ |= tPREFETCHITI;
if (EDX & (1U << 19)) type_ |= tAVX10;
if (EDX & (1U << 21)) type_ |= tAPX_F;
} }
} }
if (has(tAVX10) && maxNum >= 24) {
getCpuidEx(0x24, 0, data);
avx10version_ = EBX & mask(7);
}
setFamily(); setFamily();
setNumCores(); setNumCores();
setCacheHierarchy(); setCacheHierarchy();
@ -645,6 +655,7 @@ public:
{ {
return (type & type_) == type; return (type & type_) == type;
} }
int getAVX10version() const { return avx10version_; }
}; };
#ifndef XBYAK_ONLY_CLASS_CPU #ifndef XBYAK_ONLY_CLASS_CPU