xbyak/gen/avx_type.hpp
MITSUNARI Shigeo 0a8ea9edf7 fix type
2023-11-09 13:31:24 +09:00

73 lines
1.9 KiB
C++

#include <assert.h>
#include "avx_type_def.h"
const int NONE = 256; // same as Xbyak::CodeGenerator::NONE
std::string type2String(uint64_t type)
{
if (type == 0) return "T_NONE";
std::string str;
int low = type & T_NX_MASK;
if (0 < low && low < 7) {
const char *tbl[8] = {
"T_N1", "T_N2", "T_N4", "T_N8", "T_N16", "T_N32"
};
assert(low < int(sizeof(tbl) / sizeof(tbl[0])));
str = tbl[low - 1];
}
if (type & T_N_VL) str += "|T_N_VL";
if (type & T_VEX) str += "|T_VEX";
if ((type & T_NX_MASK) == T_DUP) str += "|T_DUP";
switch (type & T_F2) { // T_F2 = T_66|T_F3
case T_66: str += "|T_66"; break;
case T_F3: str += "|T_F3"; break;
case T_F2: str += "|T_F2"; break;
default: break;
}
if (type & T_0F) {
if (type & T_FP16) {
str += "|T_MAP5";
} else {
str += "|T_0F";
}
}
if (type & T_0F38) {
if (type & T_FP16) {
str += "|T_MAP6";
} else {
str += "|T_0F38";
}
}
if (type & T_0F3A) str += "|T_0F3A";
if (type & T_L0) str += "|T_L0";
if (type & T_L1) str += "|T_L1";
if (type & T_W0) str += "|T_W0";
if (type & T_W1) str += "|T_W1";
if (type & T_EW0) str += "|T_EW0";
if (type & T_EW1) str += "|T_EW1";
if (type & T_YMM) str += "|T_YMM";
if (type & T_EVEX) str += "|T_EVEX";
if (type & T_ER_X) str += "|T_ER_X";
if (type & T_ER_Y) str += "|T_ER_Y";
if (type & T_ER_Z) str += "|T_ER_Z";
if (type & T_ER_R) str += "|T_ER_R";
if (type & T_SAE_X) str += "|T_SAE_X";
if (type & T_SAE_Y) str += "|T_SAE_Y";
if (type & T_SAE_Z) str += "|T_SAE_Z";
if (type & T_MUST_EVEX) str += "|T_MUST_EVEX";
switch (type & T_B16) { // T_B16 = T_B32 | T_B64
case T_B16: str += "|T_B16"; break;
case T_B32: str += "|T_B32"; break;
case T_B64: str += "|T_B64"; break;
default: break;
}
if (type & T_M_K) str += "|T_M_K";
if (type & T_VSIB) str += "|T_VSIB";
if (type & T_MEM_EVEX) str += "|T_MEM_EVEX";
if (type & T_NF) str += "|T_NF";
if (type & T_NO_OR1) str += "|T_NO_OR1";
if (str[0] == '|') str = str.substr(1);
return str;
}