mvoe opKmov in private

This commit is contained in:
MITSUNARI Shigeo 2023-12-19 16:02:00 +09:00
parent 5315658ad6
commit 85709ace75

View file

@ -2712,6 +2712,30 @@ private:
opVex(t1, &tmm0, addr2, type, code);
}
#endif
// (reg32e/mem, k) if rev else (k, k/mem/reg32e)
// size = 8, 16, 32, 64
void opKmov(const Opmask& k, const Operand& op, bool rev, int size)
{
int code = 0;
bool isReg = op.isREG(size < 64 ? 32 : 64);
if (rev) {
code = isReg ? 0x93 : op.isMEM() ? 0x91 : 0;
} else {
code = op.isOPMASK() || op.isMEM() ? 0x90 : isReg ? 0x92 : 0;
}
if (code == 0) XBYAK_THROW(ERR_BAD_COMBINATION)
uint64_t type = 0;
switch (size) {
case 8: type = T_W0|T_66; break;
case 16: type = T_W0; break;
case 32: type = isReg ? T_W0|T_F2 : T_W1|T_66; break;
case 64: type = isReg ? T_W1|T_F2 : T_W1; break;
}
const Operand *p1 = &k, *p2 = &op;
if (code == 0x93) { std::swap(p1, p2); }
if (opROO(Reg(), *p2, *p1, T_MAP1|type, code)) return;
opVex(static_cast<const Reg&>(*p1), 0, *p2, T_L0|T_0F|type, code);
}
public:
unsigned int getVersion() const { return VERSION; }
using CodeArray::db;
@ -3096,30 +3120,6 @@ public:
// set default encoding to select Vex or Evex
void setDefaultEncoding(PreferredEncoding encoding) { defaultEncoding_ = encoding; }
// (reg32e/mem, k) if rev else (k, k/mem/reg32e)
// size = 8, 16, 32, 64
void opKmov(const Opmask& k, const Operand& op, bool rev, int size)
{
int code = 0;
bool isReg = op.isREG(size < 64 ? 32 : 64);
if (rev) {
code = isReg ? 0x93 : op.isMEM() ? 0x91 : 0;
} else {
code = op.isOPMASK() || op.isMEM() ? 0x90 : isReg ? 0x92 : 0;
}
if (code == 0) XBYAK_THROW(ERR_BAD_COMBINATION)
uint64_t type = 0;
switch (size) {
case 8: type = T_W0|T_66; break;
case 16: type = T_W0; break;
case 32: type = isReg ? T_W0|T_F2 : T_W1|T_66; break;
case 64: type = isReg ? T_W1|T_F2 : T_W1; break;
}
const Operand *p1 = &k, *p2 = &op;
if (code == 0x93) { std::swap(p1, p2); }
if (opROO(Reg(), *p2, *p1, T_MAP1|type, code)) return;
opVex(static_cast<const Reg&>(*p1), 0, *p2, T_L0|T_0F|type, code);
}
/*
use single byte nop if useMultiByteNop = false
*/