add test of 3op apx

This commit is contained in:
MITSUNARI Shigeo 2023-11-09 11:16:40 +09:00
parent 9b21727ba0
commit b1f0fef4d0
4 changed files with 61 additions and 26 deletions

View file

@ -796,24 +796,25 @@ void put()
uint8_t ext; // (reg, imm)
const char *name;
bool support3op;
bool allowNF;
uint64_t type;
} tbl[] = {
{ 0x10, 2, "adc", true, false },
{ 0x00, 0, "add", true, true },
{ 0x20, 4, "and_", true, true },
{ 0x38, 7, "cmp", false, false },
{ 0x08, 1, "or_", true, true },
{ 0x18, 3, "sbb", true, false },
{ 0x28, 5, "sub", true, true },
{ 0x30, 6, "xor_", true, true },
{ 0x10, 2, "adc", true, T_NONE },
{ 0x00, 0, "add", true, T_NF },
{ 0x20, 4, "and_", true, T_NF },
{ 0x38, 7, "cmp", false, T_NONE },
{ 0x08, 1, "or_", true, T_NF },
{ 0x18, 3, "sbb", true, T_NONE },
{ 0x28, 5, "sub", true, T_NF },
{ 0x30, 6, "xor_", true, T_NF },
};
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
const Tbl *p = &tbl[i];
printf("void %s(const Operand& op1, const Operand& op2) { opRO_MR(op1, op2, 0x%02X); }\n", p->name, p->code);
printf("void %s(const Operand& op, uint32_t imm) { opOI(op, imm, 0x%02X, %d); }\n", p->name, p->code, p->ext);
if (!p->support3op) continue;
printf("void %s(const Reg& d, const Operand& op1, const Operand& op2) { opROO(d, op1, op2, 0, 0x%02X); }\n", p->name, p->code);
printf("void %s(const Reg& d, const Operand& op, uint32_t imm) { opROI(d, op, imm, 0, %d); }\n", p->name, p->ext);
std::string type = type2String(0);//p->type);
printf("void %s(const Reg& d, const Operand& op1, const Operand& op2) { opROO(d, op1, op2, %s, 0x%02X); }\n", p->name, type.c_str(), p->code);
printf("void %s(const Reg& d, const Operand& op, uint32_t imm) { opROI(d, op, imm, %s, %d); }\n", p->name, type.c_str(), p->ext);
}
}
{