diff options
author | MITSUNARI Shigeo <[email protected]> | 2022-06-14 14:36:57 +0900 |
---|---|---|
committer | MITSUNARI Shigeo <[email protected]> | 2022-06-14 14:36:57 +0900 |
commit | 72c4b8ad501450070b0c846ccf26c5598a4ef824 (patch) | |
tree | 0e51c4c6468bdaa0e0a4e39205cd1df59824141a | |
parent | e649372b6bc74729f059538edf25b726e48d6c1f (diff) | |
download | xbyak-72c4b8ad501450070b0c846ccf26c5598a4ef824.tar.gz xbyak-72c4b8ad501450070b0c846ccf26c5598a4ef824.zip |
refactoring
-rw-r--r-- | xbyak/xbyak_util.h | 157 |
1 files changed, 78 insertions, 79 deletions
diff --git a/xbyak/xbyak_util.h b/xbyak/xbyak_util.h index 8682c98..4b94d37 100644 --- a/xbyak/xbyak_util.h +++ b/xbyak/xbyak_util.h @@ -330,89 +330,88 @@ public: #endif } -#if (__cplusplus >= 201103) || (defined(_MSC_VER) && (_MSC_VER >= 1700)) /* Visual Studio 2012 or later */ - #define XBYAK_TYPE_CONST const constexpr - #define XBYAK_BRACE {} +#define XBYAK_SPLIT_ID(id) ((0 <= id && id < 64) ? (1ull << (id % 64)) : 0), (id >= 64 ? (1ull << (id % 64)) : 0) +#if (__cplusplus >= 201103) || (defined(_MSC_VER) && (_MSC_VER >= 1700)) /* VS2012 */ + #define XBYAK_DEFINE_TYPE(id, NAME) static const constexpr local::TypeT<XBYAK_SPLIT_ID(id)> NAME{} #else - #define XBYAK_TYPE_CONST const - #define XBYAK_BRACE + #define XBYAK_DEFINE_TYPE(id, NAME) static const local::TypeT<XBYAK_SPLIT_ID(id)> NAME #endif - static XBYAK_TYPE_CONST local::TypeT<0> NONE XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 0> tMMX XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 1> tMMX2 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 2> tCMOV XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 3> tSSE XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 4> tSSE2 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 5> tSSE3 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 6> tSSSE3 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 7> tSSE41 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 8> tSSE42 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 9> tPOPCNT XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 10> tAESNI XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 11> tAVX512_FP16 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 12> tOSXSAVE XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 13> tPCLMULQDQ XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 14> tAVX XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 15> tFMA XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 16> t3DN XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 17> tE3DN XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 18> tWAITPKG XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 19> tRDTSCP XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 20> tAVX2 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 21> tBMI1 XBYAK_BRACE; // andn, bextr, blsi, blsmsk, blsr, tzcnt - static XBYAK_TYPE_CONST local::TypeT<1 << 22> tBMI2 XBYAK_BRACE; // bzhi, mulx, pdep, pext, rorx, sarx, shlx, shrx - static XBYAK_TYPE_CONST local::TypeT<1 << 23> tLZCNT XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 24> tINTEL XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 25> tAMD XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 26> tENHANCED_REP XBYAK_BRACE; // enhanced rep movsb/stosb - static XBYAK_TYPE_CONST local::TypeT<1 << 27> tRDRAND XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<1 << 28> tADX XBYAK_BRACE; // adcx, adox - static XBYAK_TYPE_CONST local::TypeT<1 << 29> tRDSEED XBYAK_BRACE; // rdseed - static XBYAK_TYPE_CONST local::TypeT<1 << 30> tSMAP XBYAK_BRACE; // stac - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 31> tHLE XBYAK_BRACE; // xacquire, xrelease, xtest - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 32> tRTM XBYAK_BRACE; // xbegin, xend, xabort - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 33> tF16C XBYAK_BRACE; // vcvtph2ps, vcvtps2ph - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 34> tMOVBE XBYAK_BRACE; // mobve - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 35> tAVX512F XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 36> tAVX512DQ XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 37> tAVX512_IFMA XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 37> tAVX512IFMA XBYAK_BRACE;// = tAVX512_IFMA; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 38> tAVX512PF XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 39> tAVX512ER XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 40> tAVX512CD XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 41> tAVX512BW XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 42> tAVX512VL XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 43> tAVX512_VBMI XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 43> tAVX512VBMI XBYAK_BRACE; // = tAVX512_VBMI; // changed by Intel's manual - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 44> tAVX512_4VNNIW XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 45> tAVX512_4FMAPS XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 46> tPREFETCHWT1 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 47> tPREFETCHW XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 48> tSHA XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 49> tMPX XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 50> tAVX512_VBMI2 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 51> tGFNI XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 52> tVAES XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 53> tVPCLMULQDQ XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 54> tAVX512_VNNI XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 55> tAVX512_BITALG XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 56> tAVX512_VPOPCNTDQ XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 57> tAVX512_BF16 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 58> tAVX512_VP2INTERSECT XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 59> tAMX_TILE XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 60> tAMX_INT8 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 61> tAMX_BF16 XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 62> tAVX_VNNI XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<uint64_t(1) << 63> tCLFLUSHOPT XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<0, 1 << 0> tCLDEMOTE XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<0, 1 << 1> tMOVDIRI XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<0, 1 << 2> tMOVDIR64B XBYAK_BRACE; - static XBYAK_TYPE_CONST local::TypeT<0, 1 << 3> tCLZERO XBYAK_BRACE; // AMD Zen -#undef XBYAK_TYPE_CONST -#undef XBYAK_BRACE + XBYAK_DEFINE_TYPE(0, tMMX); + XBYAK_DEFINE_TYPE(1, tMMX2); + XBYAK_DEFINE_TYPE(2, tCMOV); + XBYAK_DEFINE_TYPE(3, tSSE); + XBYAK_DEFINE_TYPE(4, tSSE2); + XBYAK_DEFINE_TYPE(5, tSSE3); + XBYAK_DEFINE_TYPE(6, tSSSE3); + XBYAK_DEFINE_TYPE(7, tSSE41); + XBYAK_DEFINE_TYPE(8, tSSE42); + XBYAK_DEFINE_TYPE(9, tPOPCNT); + XBYAK_DEFINE_TYPE(10, tAESNI); + XBYAK_DEFINE_TYPE(11, tAVX512_FP16); + XBYAK_DEFINE_TYPE(12, tOSXSAVE); + XBYAK_DEFINE_TYPE(13, tPCLMULQDQ); + XBYAK_DEFINE_TYPE(14, tAVX); + XBYAK_DEFINE_TYPE(15, tFMA); + XBYAK_DEFINE_TYPE(16, t3DN); + XBYAK_DEFINE_TYPE(17, tE3DN); + XBYAK_DEFINE_TYPE(18, tWAITPKG); + XBYAK_DEFINE_TYPE(19, tRDTSCP); + XBYAK_DEFINE_TYPE(20, tAVX2); + XBYAK_DEFINE_TYPE(21, tBMI1); // andn, bextr, blsi, blsmsk, blsr, tzcnt + XBYAK_DEFINE_TYPE(22, tBMI2); // bzhi, mulx, pdep, pext, rorx, sarx, shlx, shrx + XBYAK_DEFINE_TYPE(23, tLZCNT); + XBYAK_DEFINE_TYPE(24, tINTEL); + XBYAK_DEFINE_TYPE(25, tAMD); + XBYAK_DEFINE_TYPE(26, tENHANCED_REP); // enhanced rep movsb/stosb + XBYAK_DEFINE_TYPE(27, tRDRAND); + XBYAK_DEFINE_TYPE(28, tADX); // adcx, adox + XBYAK_DEFINE_TYPE(29, tRDSEED); // rdseed + XBYAK_DEFINE_TYPE(30, tSMAP); // stac + XBYAK_DEFINE_TYPE(31, tHLE); // xacquire, xrelease, xtest + XBYAK_DEFINE_TYPE(32, tRTM); // xbegin, xend, xabort + XBYAK_DEFINE_TYPE(33, tF16C); // vcvtph2ps, vcvtps2ph + XBYAK_DEFINE_TYPE(34, tMOVBE); // mobve + XBYAK_DEFINE_TYPE(35, tAVX512F); + XBYAK_DEFINE_TYPE(36, tAVX512DQ); + XBYAK_DEFINE_TYPE(37, tAVX512_IFMA); + XBYAK_DEFINE_TYPE(37, tAVX512IFMA);// = tAVX512_IFMA; + XBYAK_DEFINE_TYPE(38, tAVX512PF); + XBYAK_DEFINE_TYPE(39, tAVX512ER); + XBYAK_DEFINE_TYPE(40, tAVX512CD); + XBYAK_DEFINE_TYPE(41, tAVX512BW); + XBYAK_DEFINE_TYPE(42, tAVX512VL); + XBYAK_DEFINE_TYPE(43, tAVX512_VBMI); + XBYAK_DEFINE_TYPE(43, tAVX512VBMI); // = tAVX512_VBMI; // changed by Intel's manual + XBYAK_DEFINE_TYPE(44, tAVX512_4VNNIW); + XBYAK_DEFINE_TYPE(45, tAVX512_4FMAPS); + XBYAK_DEFINE_TYPE(46, tPREFETCHWT1); + XBYAK_DEFINE_TYPE(47, tPREFETCHW); + XBYAK_DEFINE_TYPE(48, tSHA); + XBYAK_DEFINE_TYPE(49, tMPX); + XBYAK_DEFINE_TYPE(50, tAVX512_VBMI2); + XBYAK_DEFINE_TYPE(51, tGFNI); + XBYAK_DEFINE_TYPE(52, tVAES); + XBYAK_DEFINE_TYPE(53, tVPCLMULQDQ); + XBYAK_DEFINE_TYPE(54, tAVX512_VNNI); + XBYAK_DEFINE_TYPE(55, tAVX512_BITALG); + XBYAK_DEFINE_TYPE(56, tAVX512_VPOPCNTDQ); + XBYAK_DEFINE_TYPE(57, tAVX512_BF16); + XBYAK_DEFINE_TYPE(58, tAVX512_VP2INTERSECT); + XBYAK_DEFINE_TYPE(59, tAMX_TILE); + XBYAK_DEFINE_TYPE(60, tAMX_INT8); + XBYAK_DEFINE_TYPE(61, tAMX_BF16); + XBYAK_DEFINE_TYPE(62, tAVX_VNNI); + XBYAK_DEFINE_TYPE(63, tCLFLUSHOPT); + XBYAK_DEFINE_TYPE(64, tCLDEMOTE); + XBYAK_DEFINE_TYPE(65, tMOVDIRI); + XBYAK_DEFINE_TYPE(66, tMOVDIR64B); + XBYAK_DEFINE_TYPE(67, tCLZERO); // AMD Zen + +#undef XBYAK_SPLIT_ID +#undef XBYAK_DEFINE_TYPE Cpu() - : type_(NONE) + : type_() , x2APIC_supported_(false) , numCores_() , dataCacheSize_() |