aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2024-10-07 10:59:08 +0900
committerMITSUNARI Shigeo <[email protected]>2024-10-07 10:59:08 +0900
commitee42b66543b7a416eff50540cc20221beb3e7739 (patch)
treebb54ca2e20d250d00918a1cb079a3c493afc5327
parent4856dcca61daaea808a4e8050e4ecf678cabd93e (diff)
downloadxbyak-ee42b66543b7a416eff50540cc20221beb3e7739.tar.gz
xbyak-ee42b66543b7a416eff50540cc20221beb3e7739.zip
add {rd,wr}{fs,gs}base
-rw-r--r--gen/gen_code.cpp9
-rw-r--r--test/misc.cpp52
-rw-r--r--xbyak/xbyak_mnemonic.h4
3 files changed, 64 insertions, 1 deletions
diff --git a/gen/gen_code.cpp b/gen/gen_code.cpp
index e43c9b2..ee8494f 100644
--- a/gen/gen_code.cpp
+++ b/gen/gen_code.cpp
@@ -2057,6 +2057,15 @@ void put64()
// encodekey
puts("void encodekey128(const Reg32& r1, const Reg32& r2) { opEncodeKey(r1, r2, 0xFA, 0xDA); }");
puts("void encodekey256(const Reg32& r1, const Reg32& r2) { opEncodeKey(r1, r2, 0xFB, 0xDB); }");
+ // read/write fs/gs
+ {
+ const char *tbl[] = {
+ "rdfs", "rdgs", "wrfs", "wrgs"
+ };
+ for (int i = 0; i < 4; i++) {
+ printf("void %sbase(const Reg32e& r) { opRR(%s, r, T_F3|T_0F, 0xAE); }\n", tbl[i], Reg(i, Operand::REG, 32).toString());
+ }
+ }
}
void putAMX_TILE()
diff --git a/test/misc.cpp b/test/misc.cpp
index 1457691..a15721f 100644
--- a/test/misc.cpp
+++ b/test/misc.cpp
@@ -2284,5 +2284,55 @@ CYBOZU_TEST_AUTO(avx_vnni_int)
CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
}
-
+CYBOZU_TEST_AUTO(rdfsbase)
+{
+ struct Code : Xbyak::CodeGenerator {
+ Code()
+ {
+ rdfsbase(rax);
+ rdfsbase(r15d);
+ rdfsbase(r30d);
+ rdfsbase(r31);
+
+ rdgsbase(rax);
+ rdgsbase(r15d);
+ rdgsbase(r30d);
+ rdgsbase(r31);
+
+ wrfsbase(rax);
+ wrfsbase(r15d);
+ wrfsbase(r30d);
+ wrfsbase(r31);
+
+ wrgsbase(rax);
+ wrgsbase(r15d);
+ wrgsbase(r30d);
+ wrgsbase(r31);
+ }
+ } c;
+ const uint8_t tbl[] = {
+ 0xf3, 0x48, 0x0f, 0xae, 0xc0,
+ 0xf3, 0x41, 0x0f, 0xae, 0xc7,
+ 0xf3, 0xd5, 0x91, 0xae, 0xc6,
+ 0xf3, 0xd5, 0x99, 0xae, 0xc7,
+
+ 0xf3, 0x48, 0x0f, 0xae, 0xc8,
+ 0xf3, 0x41, 0x0f, 0xae, 0xcf,
+ 0xf3, 0xd5, 0x91, 0xae, 0xce,
+ 0xf3, 0xd5, 0x99, 0xae, 0xcf,
+
+ 0xf3, 0x48, 0x0f, 0xae, 0xd0,
+ 0xf3, 0x41, 0x0f, 0xae, 0xd7,
+ 0xf3, 0xd5, 0x91, 0xae, 0xd6,
+ 0xf3, 0xd5, 0x99, 0xae, 0xd7,
+
+ 0xf3, 0x48, 0x0f, 0xae, 0xd8,
+ 0xf3, 0x41, 0x0f, 0xae, 0xdf,
+ 0xf3, 0xd5, 0x91, 0xae, 0xde,
+ 0xf3, 0xd5, 0x99, 0xae, 0xdf,
+ };
+ const size_t n = sizeof(tbl) / sizeof(tbl[0]);
+ CYBOZU_TEST_EQUAL(c.getSize(), n);
+ CYBOZU_TEST_EQUAL_ARRAY(c.getCode(), tbl, n);
+}
#endif
diff --git a/xbyak/xbyak_mnemonic.h b/xbyak/xbyak_mnemonic.h
index 6eb3d63..af6652f 100644
--- a/xbyak/xbyak_mnemonic.h
+++ b/xbyak/xbyak_mnemonic.h
@@ -1937,6 +1937,10 @@ void aesencwide128kl(const Address& addr) { opSSE_APX(xmm0, addr, T_F3|T_0F38, 0
void aesencwide256kl(const Address& addr) { opSSE_APX(xmm2, addr, T_F3|T_0F38, 0xD8, T_F3|T_MUST_EVEX, 0xD8); }
void encodekey128(const Reg32& r1, const Reg32& r2) { opEncodeKey(r1, r2, 0xFA, 0xDA); }
void encodekey256(const Reg32& r1, const Reg32& r2) { opEncodeKey(r1, r2, 0xFB, 0xDB); }
+void rdfsbase(const Reg32e& r) { opRR(eax, r, T_F3|T_0F, 0xAE); }
+void rdgsbase(const Reg32e& r) { opRR(ecx, r, T_F3|T_0F, 0xAE); }
+void wrfsbase(const Reg32e& r) { opRR(edx, r, T_F3|T_0F, 0xAE); }
+void wrgsbase(const Reg32e& r) { opRR(ebx, r, T_F3|T_0F, 0xAE); }
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); }