aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2022-04-05 15:08:12 +0900
committerMITSUNARI Shigeo <[email protected]>2022-04-05 15:08:12 +0900
commita220fd69a20255de3ef046507beee4850dab84e4 (patch)
tree88c0d0e5ca915bf85fb2867bec0dc64df15af56b
parent64ec053e6177e7b2cbeca80aaf6bd6f68573cf15 (diff)
downloadxbyak-a220fd69a20255de3ef046507beee4850dab84e4.tar.gz
xbyak-a220fd69a20255de3ef046507beee4850dab84e4.zip
add umwait
-rw-r--r--gen/gen_code.cpp1
-rw-r--r--test/misc.cpp7
-rw-r--r--xbyak/xbyak_mnemonic.h1
3 files changed, 8 insertions, 1 deletions
diff --git a/gen/gen_code.cpp b/gen/gen_code.cpp
index 069ae32..e23b552 100644
--- a/gen/gen_code.cpp
+++ b/gen/gen_code.cpp
@@ -1087,6 +1087,7 @@ void put()
puts("void crc32(const Reg32e& reg, const Operand& op) { if (reg.isBit(32) && op.isBit(16)) db(0x66); db(0xF2); opModRM(reg, op, op.isREG(), op.isMEM(), 0x0F, 0x38, 0xF0 | (op.isBit(8) ? 0 : 1)); }");
puts("void tpause(const Reg32& r) { int idx = r.getIdx(); if (idx > 7) XBYAK_THROW(ERR_BAD_PARAMETER) db(0x66); db(0x0F); db(0xAE); setModRM(3, 6, idx); }");
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); }");
}
{
const struct Tbl {
diff --git a/test/misc.cpp b/test/misc.cpp
index 0b664ef..f46239b 100644
--- a/test/misc.cpp
+++ b/test/misc.cpp
@@ -1891,7 +1891,7 @@ CYBOZU_TEST_AUTO(vaddph)
}
#endif
-CYBOZU_TEST_AUTO(misc)
+CYBOZU_TEST_AUTO(waitpkg)
{
struct Code : Xbyak::CodeGenerator {
Code()
@@ -1905,6 +1905,8 @@ CYBOZU_TEST_AUTO(misc)
umonitor(ecx);
umonitor(rcx);
#endif
+ umwait(eax);
+ umwait(ebx);
}
} c;
const uint8_t tbl[] = {
@@ -1914,6 +1916,9 @@ CYBOZU_TEST_AUTO(misc)
// umonitor
0x67, 0xf3, 0x0f, 0xae, 0xf1,
0xf3, 0x0f, 0xae, 0xf1,
+ // tpause
+ 0xf2, 0x0f, 0xae, 0xf0,
+ 0xf2, 0x0f, 0xae, 0xf3,
};
const size_t n = sizeof(tbl) / sizeof(tbl[0]);
CYBOZU_TEST_EQUAL(c.getSize(), n);
diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h
index e4e623c..5096c36 100644
--- a/xbyak/xbyak_mnemonic.h
+++ b/xbyak/xbyak_mnemonic.h
@@ -819,6 +819,7 @@ void ucomisd(const Xmm& xmm, const Operand& op) { opGen(xmm, op, 0x2E, 0x66, isX
void ucomiss(const Xmm& xmm, const Operand& op) { opGen(xmm, op, 0x2E, 0x100, isXMM_XMMorMEM); }
void ud2() { db(0x0F); db(0x0B); }
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); }
+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); }
void unpckhpd(const Xmm& xmm, const Operand& op) { opGen(xmm, op, 0x15, 0x66, isXMM_XMMorMEM); }
void unpckhps(const Xmm& xmm, const Operand& op) { opGen(xmm, op, 0x15, 0x100, isXMM_XMMorMEM); }
void unpcklpd(const Xmm& xmm, const Operand& op) { opGen(xmm, op, 0x14, 0x66, isXMM_XMMorMEM); }