add evex tests

This commit is contained in:
MITSUNARI Shigeo 2023-11-30 14:15:05 +09:00
parent 05a66d2c0b
commit 6d21c7389a
2 changed files with 22 additions and 10 deletions

View file

@ -1684,3 +1684,23 @@ CYBOZU_TEST_AUTO(cfcmov)
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}
CYBOZU_TEST_AUTO(evex_misc)
{
struct Code : Xbyak::CodeGenerator {
Code()
{
vmovaps(xmm31, ptr [r30+r26*8+0x40]);
vaddps(zmm30, zmm21, ptr [r20+r30*1]);
vcvtsd2si(r30d, ptr [r17+r31*4]);
}
} c;
const uint8_t tbl[] = {
0x62, 0x09, 0x78, 0x08, 0x28, 0x7c, 0xd6, 0x04,
0x62, 0x29, 0x50, 0x40, 0x58, 0x34, 0x34, 0x62,
0x29, 0x7b, 0x08, 0x2d, 0x34, 0xb9,
};
const size_t n = sizeof(tbl);
CYBOZU_TEST_EQUAL(c.getSize(), n);
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}

View file

@ -1882,13 +1882,6 @@ private:
bool R = reg.isExtIdx();
bool X3 = (x && x->isExtIdx()) || (base.isSIMD() && base.isExtIdx2());
bool B4 = base.isREG() && 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 = x && (x->isREG() && x->isExtIdx2());
bool B = base.isExtIdx();
bool Rp = reg.isExtIdx2();
@ -1921,15 +1914,14 @@ if (x) printf("x=%s\n", x->toString());
}
}
}
bool Vp = ((v ? v->isExtIdx2() : 0) || Hi16Vidx);
//if (v) printf("v=%s Vp=%d Hi16Vidx=%d\n", v->toString(), Vp, Hi16Vidx);
bool V4 = ((v ? v->isExtIdx2() : 0) || 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 ? 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 ? 0 : 8) | (aaa & 7));
db((z ? 0x80 : 0) | ((LL & 3) << 5) | (b ? 0x10 : 0) | (V4 ? 0 : 8) | (aaa & 7));
db(code);
return disp8N;
}