aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2023-12-14 17:26:26 +0900
committerMITSUNARI Shigeo <[email protected]>2023-12-14 17:26:58 +0900
commit5315658ad67791f56296c202fe2acefa9b95d3ae (patch)
treed9c3ad352410049bced8731c72c3668b8551644d
parent835f6d2e6d5309d6b3a34f35c486df25317154b4 (diff)
downloadxbyak-5315658ad67791f56296c202fe2acefa9b95d3ae.tar.gz
xbyak-5315658ad67791f56296c202fe2acefa9b95d3ae.zip
add detection of avx10/apx_f
-rw-r--r--sample/test_util.cpp5
-rw-r--r--xbyak/xbyak_util.h11
2 files changed, 16 insertions, 0 deletions
diff --git a/sample/test_util.cpp b/sample/test_util.cpp
index 35c2fa8..66869ee 100644
--- a/sample/test_util.cpp
+++ b/sample/test_util.cpp
@@ -103,12 +103,17 @@ void putCPUinfo(bool onlyCpuidFeature)
{ Cpu::tSM3, "sm3" },
{ Cpu::tSM4, "sm4" },
{ 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++) {
if (cpu.has(tbl[i].type)) printf(" %s", tbl[i].str);
}
printf("\n");
if (onlyCpuidFeature) return;
+ if (cpu.has(Cpu::tAVX10)) {
+ printf("AVX10 version %d\n", cpu.getAVX10version());
+ }
if (cpu.has(Cpu::tPOPCNT)) {
const int n = 0x12345678; // bitcount = 13
const int ok = 13;
diff --git a/xbyak/xbyak_util.h b/xbyak/xbyak_util.h
index 0bcc134..950cc2d 100644
--- a/xbyak/xbyak_util.h
+++ b/xbyak/xbyak_util.h
@@ -144,6 +144,7 @@ private:
uint32_t dataCacheSize_[maxNumberCacheLevels];
uint32_t coresSharignDataCache_[maxNumberCacheLevels];
uint32_t dataCacheLevels_;
+ uint32_t avx10version_;
uint32_t get32bitAsBE(const char *x) const
{
@@ -470,6 +471,8 @@ public:
XBYAK_DEFINE_TYPE(79, tSM3);
XBYAK_DEFINE_TYPE(80, tSM4);
XBYAK_DEFINE_TYPE(81, tAVX_VNNI_INT16);
+ XBYAK_DEFINE_TYPE(82, tAPX_F);
+ XBYAK_DEFINE_TYPE(83, tAVX10);
#undef XBYAK_SPLIT_ID
#undef XBYAK_DEFINE_TYPE
@@ -481,6 +484,7 @@ public:
, dataCacheSize_()
, coresSharignDataCache_()
, dataCacheLevels_(0)
+ , avx10version_(0)
{
uint32_t data[4] = {};
const uint32_t& EAX = data[0];
@@ -627,8 +631,14 @@ public:
if (EDX & (1U << 5)) type_ |= tAVX_NE_CONVERT;
if (EDX & (1U << 10)) type_ |= tAVX_VNNI_INT16;
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();
setNumCores();
setCacheHierarchy();
@@ -645,6 +655,7 @@ public:
{
return (type & type_) == type;
}
+ int getAVX10version() const { return avx10version_; }
};
#ifndef XBYAK_ONLY_CLASS_CPU