From 11d12d0b84452b93e3b1efb46b3cec68cf5a970a Mon Sep 17 00:00:00 2001 From: Merry Date: Sun, 5 Jun 2022 13:58:07 +0100 Subject: [PATCH] x64_cpu_info: Update test for latest xbyak --- tests/x64_cpu_info.cpp | 132 +++++++++++++++++++++++------------------ 1 file changed, 75 insertions(+), 57 deletions(-) diff --git a/tests/x64_cpu_info.cpp b/tests/x64_cpu_info.cpp index b65de18e..70ab41c2 100644 --- a/tests/x64_cpu_info.cpp +++ b/tests/x64_cpu_info.cpp @@ -10,7 +10,8 @@ #include TEST_CASE("Host CPU supports", "[a64]") { - Xbyak::util::Cpu cpu_info; + using Cpu = Xbyak::util::Cpu; + Cpu cpu_info; std::array cpu_name; for (uint32_t i = 2; i < 5; ++i) { @@ -20,62 +21,79 @@ TEST_CASE("Host CPU supports", "[a64]") { std::putchar('\n'); cpu_info.putFamily(); - static constexpr std::array types{ - std::make_pair(Xbyak::util::Cpu::t3DN, "3DN"), - std::make_pair(Xbyak::util::Cpu::tADX, "ADX"), - std::make_pair(Xbyak::util::Cpu::tAESNI, "AESNI"), - std::make_pair(Xbyak::util::Cpu::tAMD, "AMD"), - std::make_pair(Xbyak::util::Cpu::tAVX, "AVX"), - std::make_pair(Xbyak::util::Cpu::tAVX2, "AVX2"), - std::make_pair(Xbyak::util::Cpu::tAVX512_4FMAPS, "AVX5124FMAPS"), - std::make_pair(Xbyak::util::Cpu::tAVX512_4VNNIW, "AVX5124VNNIW"), - std::make_pair(Xbyak::util::Cpu::tAVX512_BITALG, "AVX512BITALG"), - std::make_pair(Xbyak::util::Cpu::tAVX512_VBMI2, "AVX512VBMI2"), - std::make_pair(Xbyak::util::Cpu::tAVX512_VNNI, "AVX512VNNI"), - std::make_pair(Xbyak::util::Cpu::tAVX512_VPOPCNTDQ, "AVX512VPOPCNTDQ"), - std::make_pair(Xbyak::util::Cpu::tAVX512BW, "AVX512BW"), - std::make_pair(Xbyak::util::Cpu::tAVX512CD, "AVX512CD"), - std::make_pair(Xbyak::util::Cpu::tAVX512DQ, "AVX512DQ"), - std::make_pair(Xbyak::util::Cpu::tAVX512ER, "AVX512ER"), - std::make_pair(Xbyak::util::Cpu::tAVX512F, "AVX512F"), - std::make_pair(Xbyak::util::Cpu::tAVX512IFMA, "AVX512IFMA"), - std::make_pair(Xbyak::util::Cpu::tAVX512PF, "AVX512PF"), - std::make_pair(Xbyak::util::Cpu::tAVX512VBMI, "AVX512VBMI"), - std::make_pair(Xbyak::util::Cpu::tAVX512VL, "AVX512VL"), - std::make_pair(Xbyak::util::Cpu::tBMI1, "BMI1"), - std::make_pair(Xbyak::util::Cpu::tBMI2, "BMI2"), - std::make_pair(Xbyak::util::Cpu::tCMOV, "CMOV"), - std::make_pair(Xbyak::util::Cpu::tE3DN, "E3DN"), - std::make_pair(Xbyak::util::Cpu::tENHANCED_REP, "ENHANCED_REP"), - std::make_pair(Xbyak::util::Cpu::tF16C, "F16C"), - std::make_pair(Xbyak::util::Cpu::tFMA, "FMA"), - std::make_pair(Xbyak::util::Cpu::tGFNI, "GFNI"), - std::make_pair(Xbyak::util::Cpu::tHLE, "HLE"), - std::make_pair(Xbyak::util::Cpu::tINTEL, "INTEL"), - std::make_pair(Xbyak::util::Cpu::tLZCNT, "LZCNT"), - std::make_pair(Xbyak::util::Cpu::tMMX, "MMX"), - std::make_pair(Xbyak::util::Cpu::tMMX2, "MMX2"), - std::make_pair(Xbyak::util::Cpu::tMOVBE, "MOVBE"), - std::make_pair(Xbyak::util::Cpu::tMPX, "MPX"), - std::make_pair(Xbyak::util::Cpu::tOSXSAVE, "OSXSAVE"), - std::make_pair(Xbyak::util::Cpu::tPCLMULQDQ, "PCLMULQDQ"), - std::make_pair(Xbyak::util::Cpu::tPOPCNT, "POPCNT"), - std::make_pair(Xbyak::util::Cpu::tPREFETCHW, "PREFETCHW"), - std::make_pair(Xbyak::util::Cpu::tPREFETCHWT1, "PREFETCHWT1"), - std::make_pair(Xbyak::util::Cpu::tRDRAND, "RDRAND"), - std::make_pair(Xbyak::util::Cpu::tRDSEED, "RDSEED"), - std::make_pair(Xbyak::util::Cpu::tRDTSCP, "RDTSCP"), - std::make_pair(Xbyak::util::Cpu::tRTM, "RTM"), - std::make_pair(Xbyak::util::Cpu::tSHA, "SHA"), - std::make_pair(Xbyak::util::Cpu::tSMAP, "SMAP"), - std::make_pair(Xbyak::util::Cpu::tSSE, "SSE"), - std::make_pair(Xbyak::util::Cpu::tSSE2, "SSE2"), - std::make_pair(Xbyak::util::Cpu::tSSE3, "SSE3"), - std::make_pair(Xbyak::util::Cpu::tSSE41, "SSE41"), - std::make_pair(Xbyak::util::Cpu::tSSE42, "SSE42"), - std::make_pair(Xbyak::util::Cpu::tSSSE3, "SSSE3"), - std::make_pair(Xbyak::util::Cpu::tVAES, "VAES"), - std::make_pair(Xbyak::util::Cpu::tVPCLMULQDQ, "VPCLMULQDQ"), + const std::array types{ +#define X(NAME) std::make_pair(Cpu::Type{Cpu::NAME}, &#NAME[1]) + X(t3DN), + X(tADX), + X(tAESNI), + X(tAMD), + X(tAMX_BF16), + X(tAMX_INT8), + X(tAMX_TILE), + X(tAVX), + X(tAVX2), + X(tAVX512_4FMAPS), + X(tAVX512_4VNNIW), + X(tAVX512_BF16), + X(tAVX512_BITALG), + X(tAVX512_FP16), + X(tAVX512_IFMA), + X(tAVX512_VBMI), + X(tAVX512_VBMI2), + X(tAVX512_VNNI), + X(tAVX512_VP2INTERSECT), + X(tAVX512_VPOPCNTDQ), + X(tAVX512BW), + X(tAVX512CD), + X(tAVX512DQ), + X(tAVX512ER), + X(tAVX512F), + X(tAVX512IFMA), + X(tAVX512PF), + X(tAVX512VBMI), + X(tAVX512VL), + X(tAVX_VNNI), + X(tBMI1), + X(tBMI2), + X(tCLDEMOTE), + X(tCLFLUSHOPT), + X(tCLZERO), + X(tCMOV), + X(tE3DN), + X(tENHANCED_REP), + X(tF16C), + X(tFMA), + X(tGFNI), + X(tHLE), + X(tINTEL), + X(tLZCNT), + X(tMMX), + X(tMMX2), + X(tMOVBE), + X(tMOVDIR64B), + X(tMOVDIRI), + X(tMPX), + X(tOSXSAVE), + X(tPCLMULQDQ), + X(tPOPCNT), + X(tPREFETCHW), + X(tPREFETCHWT1), + X(tRDRAND), + X(tRDSEED), + X(tRDTSCP), + X(tRTM), + X(tSHA), + X(tSMAP), + X(tSSE), + X(tSSE2), + X(tSSE3), + X(tSSE41), + X(tSSE42), + X(tSSSE3), + X(tVAES), + X(tVPCLMULQDQ), + X(tWAITPKG), +#undef X }; constexpr size_t line_max = 80;