support cldemote

This commit is contained in:
MITSUNARI Shigeo 2022-05-11 17:01:10 +09:00
parent 3a6cc626e8
commit a84ddc12dd
2 changed files with 22 additions and 0 deletions

View file

@ -1089,6 +1089,7 @@ void put()
puts("void umonitor(const Reg& r) { int idx = r.getIdx(); if (idx > 7) XBYAK_THROW(ERR_BAD_PARAMETER) int bit = r.getBit(); if (BIT != bit) { if ((BIT == 32 && bit == 16) || (BIT == 64 && bit == 32)) { db(0x67); } else { XBYAK_THROW(ERR_BAD_SIZE_OF_REGISTER) } } db(0xF3); db(0x0F); db(0xAE); setModRM(3, 6, idx); }");
puts("void umwait(const Reg32& r) { int idx = r.getIdx(); if (idx > 7) XBYAK_THROW(ERR_BAD_PARAMETER) db(0xF2); db(0x0F); db(0xAE); setModRM(3, 6, idx); }");
puts("void clwb(const Address& addr) { db(0x66); opMIB(addr, esi, 0x0F, 0xAE); }");
puts("void cldemote(const Address& addr) { opMIB(addr, eax, 0x0F, 0x1C); }");
}
{
const struct Tbl {

View file

@ -1924,3 +1924,24 @@ CYBOZU_TEST_AUTO(waitpkg)
CYBOZU_TEST_EQUAL(c.getSize(), n);
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}
CYBOZU_TEST_AUTO(misc)
{
struct Code : Xbyak::CodeGenerator {
Code()
{
cldemote(ptr[eax+esi*4+0x12]);
#ifdef XBYAK64
cldemote(ptr[rax+rdi*8+0x123]);
#endif
}
} c;
const uint8_t tbl[] = {
// cldemote
0x67, 0x0f, 0x1c, 0x44, 0xb0, 0x12,
0x0f, 0x1c, 0x84, 0xf8, 0x23, 0x01, 0x00, 0x00
};
const size_t n = sizeof(tbl) / sizeof(tbl[0]);
CYBOZU_TEST_EQUAL(c.getSize(), n);
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}