This commit is contained in:
Roman Glinskikh 2024-01-08 15:06:34 +03:00
parent 1b517105db
commit e7465eb4a3

View File

@ -93,7 +93,8 @@ inline bool cpuid(UInt32 op, UInt32 * res) noexcept /// NOLINT
OP(CLFLUSHOPT) \
OP(CLWB) \
OP(XSAVE) \
OP(OSXSAVE)
OP(OSXSAVE) \
OP(AMX)
union CpuInfo
{
@ -313,6 +314,15 @@ bool haveRDRAND() noexcept
return CpuInfo(0x0).registers.eax >= 0x7 && ((CpuInfo(0x1).registers.ecx >> 30) & 1u);
}
bool haveAMX() noexcept
{
#if defined(__x86_64__) || defined(__i386__)
return (CpuInfo(0x1).registers.ecx >> 22) & 1u;
#else
return false;
#endif
}
struct CpuFlagsCache
{
#define DEF_NAME(X) static inline bool have_##X = have##X();