add aesdec128kl

This commit is contained in:
MITSUNARI Shigeo 2023-12-19 16:28:40 +09:00
parent 85709ace75
commit fcb3d0dbb8
4 changed files with 52 additions and 1 deletions

View file

@ -2013,6 +2013,30 @@ void put64()
printf("void cmp%sxadd(const Address& addr, const Reg32e& r1, const Reg32e& r2) { opRRO(r1, r2, addr, T_APX|T_66|T_0F38, 0x%02X); }\n", p->name, p->code);
}
}
// aes
{
const struct Tbl {
const char *name;
uint64_t type1;
uint64_t type2;
uint8_t code;
int n;
} tbl[] = {
{ "aesdec128kl", T_F3|T_0F38, T_MUST_EVEX|T_F3, 0xDD, 2 },
};
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
const Tbl *p = &tbl[i];
std::string s1 = type2String(p->type1);
std::string s2 = type2String(p->type2);
switch (p->n) {
case 1:
break;
case 2:
printf("void %s(const Xmm& x, const Address& addr) { opAESKL(&x, addr, %s, %s, 0x%02X); }\n", p->name, s1.c_str(), s2.c_str(), p->code);
break;
}
}
}
}
void putAMX_TILE()

View file

@ -1753,7 +1753,6 @@ CYBOZU_TEST_AUTO(kmov)
CYBOZU_TEST_EQUAL(c.getSize(), n);
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}
CYBOZU_TEST_AUTO(amx)
{
struct Code : Xbyak::CodeGenerator {
@ -1775,3 +1774,21 @@ CYBOZU_TEST_AUTO(amx)
CYBOZU_TEST_EQUAL(c.getSize(), n);
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}
CYBOZU_TEST_AUTO(aeskl)
{
struct Code : Xbyak::CodeGenerator {
Code()
{
aesdec128kl(xmm15, ptr[rax+rcx*4+0x12]);
aesdec128kl(xmm15, ptr[r30+r29*8+0x34]);
}
} c;
const uint8_t tbl[] = {
0xf3, 0x44, 0x0f, 0x38, 0xdd, 0x7c, 0x88, 0x12,
0x62, 0x1c, 0x7a, 0x08, 0xdd, 0x7c, 0xee, 0x34,
};
const size_t n = sizeof(tbl);
CYBOZU_TEST_EQUAL(c.getSize(), n);
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}

View file

@ -2736,6 +2736,15 @@ private:
if (opROO(Reg(), *p2, *p1, T_MAP1|type, code)) return;
opVex(static_cast<const Reg&>(*p1), 0, *p2, T_L0|T_0F|type, code);
}
void opAESKL(const Xmm *x, const Address& addr, uint64_t type1, uint64_t type2, uint8_t code)
{
if (x && x->getIdx() >= 16) XBYAK_THROW(ERR_BAD_COMBINATION)
if (addr.hasRex2()) {
opROO(Reg(), addr, *x, type2, code);
return;
}
opRO(*x, addr, type1, code);
}
public:
unsigned int getVersion() const { return VERSION; }
using CodeArray::db;

View file

@ -1926,6 +1926,7 @@ void cmpoxadd(const Address& addr, const Reg32e& r1, const Reg32e& r2) { opRRO(r
void cmppxadd(const Address& addr, const Reg32e& r1, const Reg32e& r2) { opRRO(r1, r2, addr, T_APX|T_66|T_0F38, 0xEA); }
void cmpsxadd(const Address& addr, const Reg32e& r1, const Reg32e& r2) { opRRO(r1, r2, addr, T_APX|T_66|T_0F38, 0xE8); }
void cmpzxadd(const Address& addr, const Reg32e& r1, const Reg32e& r2) { opRRO(r1, r2, addr, T_APX|T_66|T_0F38, 0xE4); }
void aesdec128kl(const Xmm& x, const Address& addr) { opAESKL(&x, addr, T_F3|T_0F38, T_F3|T_MUST_EVEX, 0xDD); }
void ldtilecfg(const Address& addr) { if (opROO(Reg(), addr, tmm0, T_APX|T_0F38|T_W0, 0x49)) return; opVex(tmm0, &tmm0, addr, T_0F38|T_W0, 0x49); }
void sttilecfg(const Address& addr) { if (opROO(Reg(), addr, tmm0, T_APX|T_66|T_0F38|T_W0, 0x49)) return; opVex(tmm0, &tmm0, addr, T_66|T_0F38 | T_W0, 0x49); }
void tileloadd(const Tmm& tm, const Address& addr) { opAMX(tm, addr, T_F2|T_0F38|T_W0, 0x4B); }