[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 49/53] target/i386: implement VLDMXCSR/VSTMXCSR
From: |
Paolo Bonzini |
Subject: |
[PULL 49/53] target/i386: implement VLDMXCSR/VSTMXCSR |
Date: |
Tue, 18 Oct 2022 15:30:38 +0200 |
These are exactly the same as the non-VEX version, but one has to be careful
that only VEX.L=0 is allowed.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/tcg/decode-new.c.inc | 25 +++++++++++++++++++++++++
target/i386/tcg/emit.c.inc | 20 ++++++++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/target/i386/tcg/decode-new.c.inc b/target/i386/tcg/decode-new.c.inc
index a5d5428260..5f4268bdfb 100644
--- a/target/i386/tcg/decode-new.c.inc
+++ b/target/i386/tcg/decode-new.c.inc
@@ -82,6 +82,10 @@
#define X86_OP_ENTRY2(op, op0, s0, op1, s1, ...) \
X86_OP_ENTRY3(op, op0, s0, 2op, s0, op1, s1, ## __VA_ARGS__)
+#define X86_OP_ENTRYw(op, op0, s0, ...) \
+ X86_OP_ENTRY3(op, op0, s0, None, None, None, None, ## __VA_ARGS__)
+#define X86_OP_ENTRYr(op, op0, s0, ...) \
+ X86_OP_ENTRY3(op, None, None, None, None, op0, s0, ## __VA_ARGS__)
#define X86_OP_ENTRY0(op, ...) \
X86_OP_ENTRY3(op, None, None, None, None, None, None, ## __VA_ARGS__)
@@ -149,6 +153,25 @@ static inline const X86OpEntry
*decode_by_prefix(DisasContext *s, const X86OpEnt
}
}
+static void decode_group15(DisasContext *s, CPUX86State *env, X86OpEntry
*entry, uint8_t *b)
+{
+ /* only includes ldmxcsr and stmxcsr, because they have AVX variants. */
+ static const X86OpEntry group15_reg[8] = {
+ };
+
+ static const X86OpEntry group15_mem[8] = {
+ [2] = X86_OP_ENTRYr(LDMXCSR, E,d, vex5),
+ [3] = X86_OP_ENTRYw(STMXCSR, E,d, vex5),
+ };
+
+ uint8_t modrm = get_modrm(s, env);
+ if ((modrm >> 6) == 3) {
+ *entry = group15_reg[(modrm >> 3) & 7];
+ } else {
+ *entry = group15_mem[(modrm >> 3) & 7];
+ }
+}
+
static void decode_group17(DisasContext *s, CPUX86State *env, X86OpEntry
*entry, uint8_t *b)
{
static const X86GenFunc group17_gen[8] = {
@@ -830,6 +853,8 @@ static const X86OpEntry opcodes_0F[256] = {
[0x7e] = X86_OP_GROUP0(0F7E),
[0x7f] = X86_OP_GROUP0(0F7F),
+ [0xae] = X86_OP_GROUP0(group15),
+
[0xc2] = X86_OP_ENTRY4(VCMP, V,x, H,x, W,x, vex2_rep3
p_00_66_f3_f2),
[0xc4] = X86_OP_ENTRY4(PINSRW, V,dq,H,dq,E,w, vex5 mmx p_00_66),
[0xc5] = X86_OP_ENTRY3(PEXTRW, G,d, U,dq,I,b, vex5 mmx p_00_66),
diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc
index 266e7499ad..d7c2290db1 100644
--- a/target/i386/tcg/emit.c.inc
+++ b/target/i386/tcg/emit.c.inc
@@ -1099,6 +1099,16 @@ static void gen_INSERTQ_r(DisasContext *s, CPUX86State
*env, X86DecodedInsn *dec
gen_helper_insertq_r(cpu_env, OP_PTR0, OP_PTR2);
}
+static void gen_LDMXCSR(DisasContext *s, CPUX86State *env, X86DecodedInsn
*decode)
+{
+ if (s->vex_l) {
+ gen_illegal_opcode(s);
+ return;
+ }
+ tcg_gen_trunc_tl_i32(s->tmp2_i32, s->T1);
+ gen_helper_ldmxcsr(cpu_env, s->tmp2_i32);
+}
+
static void gen_MASKMOV(DisasContext *s, CPUX86State *env, X86DecodedInsn
*decode)
{
tcg_gen_mov_tl(s->A0, cpu_regs[R_EDI]);
@@ -1688,6 +1698,16 @@ static void gen_VAESKEYGEN(DisasContext *s, CPUX86State
*env, X86DecodedInsn *de
gen_helper_aeskeygenassist_xmm(cpu_env, OP_PTR0, OP_PTR1, imm);
}
+static void gen_STMXCSR(DisasContext *s, CPUX86State *env, X86DecodedInsn
*decode)
+{
+ if (s->vex_l) {
+ gen_illegal_opcode(s);
+ return;
+ }
+ gen_helper_update_mxcsr(cpu_env);
+ tcg_gen_ld32u_tl(s->T0, cpu_env, offsetof(CPUX86State, mxcsr));
+}
+
static void gen_VAESIMC(DisasContext *s, CPUX86State *env, X86DecodedInsn
*decode)
{
assert(!s->vex_l);
--
2.37.3
- [PULL 20/53] target/i386: make rex_w available even in 32-bit mode, (continued)
- [PULL 20/53] target/i386: make rex_w available even in 32-bit mode, Paolo Bonzini, 2022/10/18
- [PULL 45/53] target/i386: reimplement 0x0f 0xc2, 0xc4-0xc6, add AVX, Paolo Bonzini, 2022/10/18
- [PULL 47/53] target/i386: reimplement 0x0f 0x28-0x2f, add AVX, Paolo Bonzini, 2022/10/18
- [PULL 48/53] target/i386: implement XSAVE and XRSTOR of AVX registers, Paolo Bonzini, 2022/10/18
- [PULL 50/53] target/i386: Enable AVX cpuid bits when using TCG, Paolo Bonzini, 2022/10/18
- [PULL 33/53] target/i386: implement additional AVX comparison operators, Paolo Bonzini, 2022/10/18
- [PULL 42/53] target/i386: reimplement 0x0f 0x3a, add AVX, Paolo Bonzini, 2022/10/18
- [PULL 46/53] target/i386: reimplement 0x0f 0x10-0x17, add AVX, Paolo Bonzini, 2022/10/18
- [PULL 51/53] tests/tcg: extend SSE tests to AVX, Paolo Bonzini, 2022/10/18
- [PULL 52/53] target/i386: move 3DNow to the new decoder, Paolo Bonzini, 2022/10/18
- [PULL 49/53] target/i386: implement VLDMXCSR/VSTMXCSR,
Paolo Bonzini <=
- Re: [PULL 00/53] target/i386, scsi, build patches for 2022-10-18, Stefan Hajnoczi, 2022/10/18