aboutsummaryrefslogtreecommitdiffhomepage
path: root/gen
diff options
context:
space:
mode:
Diffstat (limited to 'gen')
-rw-r--r--gen/avx_type.hpp25
-rw-r--r--gen/gen_code.cpp6
2 files changed, 17 insertions, 14 deletions
diff --git a/gen/avx_type.hpp b/gen/avx_type.hpp
index 4462499..083f646 100644
--- a/gen/avx_type.hpp
+++ b/gen/avx_type.hpp
@@ -12,9 +12,10 @@
//
T_N_VL = 1 << 3, // N * (1, 2, 4) for VL
T_DUP = 1 << 4, // N = (8, 32, 64)
- T_66 = 1 << 5,
- T_F3 = 1 << 6,
- T_F2 = 1 << 7,
+ T_66 = 1 << 5, // pp = 1
+ T_F3 = 1 << 6, // pp = 2
+ T_F2 = T_66 | T_F3, // pp = 3
+ // 1 << 7, not used
T_0F = 1 << 8,
T_0F38 = 1 << 9,
T_0F3A = 1 << 10,
@@ -44,6 +45,9 @@
T_MAP6 = T_FP16 | T_0F38,
T_XXX
};
+ // T_66 = 1, T_F3 = 2, T_F2 = 3
+ uint32_t getPP(int type) { return (type >> 5) & 3; }
+
const int NONE = 256; // same as Xbyak::CodeGenerator::NONE
@@ -66,17 +70,14 @@ std::string type2String(int type)
if (!str.empty()) str += " | ";
str += "T_DUP";
}
- if (type & T_66) {
- if (!str.empty()) str += " | ";
- str += "T_66";
- }
- if (type & T_F3) {
- if (!str.empty()) str += " | ";
- str += "T_F3";
- }
if (type & T_F2) {
if (!str.empty()) str += " | ";
- str += "T_F2";
+ switch (type & T_F2) {
+ 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 (!str.empty()) str += " | ";
diff --git a/gen/gen_code.cpp b/gen/gen_code.cpp
index 19022e6..2ad8c59 100644
--- a/gen/gen_code.cpp
+++ b/gen/gen_code.cpp
@@ -1303,7 +1303,8 @@ void put()
if (p->mode & 1) {
const char *immS1 = p->hasIMM ? ", uint8_t imm" : "";
const char *immS2 = p->hasIMM ? ", imm" : ", NONE";
- const char *pref = p->type & T_66 ? "0x66" : p->type & T_F2 ? "0xF2" : p->type & T_F3 ? "0xF3" : "NONE";
+ const char *prefTbl[5] = { "NONE", "0x66", "0xF3", "0xF2" };
+ const char *pref = prefTbl[getPP(p->type)];
const char *suf = p->type & T_0F38 ? "0x38" : p->type & T_0F3A ? "0x3A" : "NONE";
printf("void %s(const Xmm& xmm, const Operand& op%s) { opGen(xmm, op, 0x%02X, %s, isXMM_XMMorMEM%s, %s); }\n", p->name, immS1, p->code, pref, immS2, suf);
}
@@ -1354,11 +1355,12 @@ void put()
{ 0xDE, "aesdec", T_0F38 | T_66 | T_YMM | T_EVEX, 3 },
{ 0xDF, "aesdeclast", T_0F38 | T_66 | T_YMM | T_EVEX, 3 },
};
+ const uint8_t ppTbl[] = { 0, 0x66, 0xf3, 0xf2 };
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
const Tbl *p = &tbl[i];
std::string type = type2String(p->type);
if (p->mode & 1) {
- uint8_t pref = p->type & T_66 ? 0x66 : p->type & T_F2 ? 0xF2 : p->type & T_F3 ? 0xF3 : 0;
+ uint8_t pref = ppTbl[getPP(p->type)];
printf("void %s(const Xmm& xmm, const Operand& op) { opGen(xmm, op, 0x%02X, 0x%02X, isXMM_XMMorMEM%s); }\n", p->name, p->code, pref, p->type & T_0F38 ? ", NONE, 0x38" : "");
}
if (p->mode & 2) {