Skip to content

Commit

Permalink
support V4 in evex
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Nov 30, 2023
1 parent e228e73 commit 33017d4
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions xbyak/xbyak.h
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ class Operand {
XBYAK_CONSTEXPR bool isXMM() const { return is(XMM); }
XBYAK_CONSTEXPR bool isYMM() const { return is(YMM); }
XBYAK_CONSTEXPR bool isZMM() const { return is(ZMM); }
XBYAK_CONSTEXPR bool isSIMD() const { return is(XMM|YMM|ZMM); }
XBYAK_CONSTEXPR bool isTMM() const { return is(TMM); }
XBYAK_CONSTEXPR bool isXMEM() const { return is(XMM | MEM); }
XBYAK_CONSTEXPR bool isYMEM() const { return is(YMM | MEM); }
Expand Down Expand Up @@ -1878,10 +1879,19 @@ class CodeGenerator : public CodeArray {
int idx = v ? v->getIdx() : 0;
uint32_t vvvv = ~idx;

bool R = !reg.isExtIdx();
bool X = (x && x->isExtIdx()) ? false : !base.isExtIdx2();
bool B = !base.isExtIdx();
bool Rp = !reg.isExtIdx2();
bool R = reg.isExtIdx();
bool X3 = (x && x->isExtIdx()) || (base.isSIMD() && base.isExtIdx2());
bool B4 = !base.isSIMD() && base.isExtIdx2();
#if 0
printf("X3=%d B4=%d\n", X3, B4);
printf("reg=%s\n", reg.toString());
printf("base=%s\n", base.toString());
if (v) printf("v=%s\n", v->toString());
if (x) printf("x=%s\n", x->toString());
#endif
bool X4 = false;//(x && x->isExtIdx2()) ? false : !(!base.isSIMD() && base.isExtIdx2());
bool B = base.isExtIdx();
bool Rp = reg.isExtIdx2();
int LL;
int rounding = verifyDuplicate(reg.getRounding(), base.getRounding(), v ? v->getRounding() : 0, ERR_ROUNDING_IS_ALREADY_SET);
int disp8N = 1;
Expand Down Expand Up @@ -1912,12 +1922,13 @@ class CodeGenerator : public CodeArray {
}
}
bool Vp = !((v ? v->isExtIdx2() : 0) | Hi16Vidx);
//printf("Vp=%d Hi16Vidx=%d\n", Vp, Hi16Vidx);
bool z = reg.hasZero() || base.hasZero() || (v ? v->hasZero() : false);
if (aaa == 0) aaa = verifyDuplicate(base.getOpmaskIdx(), reg.getOpmaskIdx(), (v ? v->getOpmaskIdx() : 0), ERR_OPMASK_IS_ALREADY_SET);
if (aaa == 0) z = 0; // clear T_z if mask is not set
db(0x62);
db((R ? 0x80 : 0) | (X ? 0x40 : 0) | (B ? 0x20 : 0) | (Rp ? 0x10 : 0) | /*(base.isExtIdx2() ? 0x40 : 0) |*/ mmm);
db((w == 1 ? 0x80 : 0) | ((vvvv & 15) << 3) | (/*x && x->isExtIdx2() ? 0 :*/ 4) | (pp & 3));
db((R ? 0 : 0x80) | (X3 ? 0 : 0x40) | (B ? 0 : 0x20) | (Rp ? 0 : 0x10) | (B4 ? 8 : 0) | mmm);
db((w == 1 ? 0x80 : 0) | ((vvvv & 15) << 3) | (X4 ? 0 : 4) | (pp & 3));
db((z ? 0x80 : 0) | ((LL & 3) << 5) | (b ? 0x10 : 0) | (Vp ? 8 : 0) | (aaa & 7));
db(code);
return disp8N;
Expand Down

0 comments on commit 33017d4

Please sign in to comment.