[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 06/23] i386: Move 3DNOW decoder
From: |
Paolo Bonzini |
Subject: |
[PATCH v3 06/23] i386: Move 3DNOW decoder |
Date: |
Thu, 1 Sep 2022 09:48:25 +0200 |
From: Paul Brook <paul@nowt.org>
Handle 3DNOW instructions early to avoid complicating the MMX/SSE logic.
Signed-off-by: Paul Brook <paul@nowt.org>
Message-Id: <20220424220204.2493824-25-paul@nowt.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/tcg/translate.c | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index b7321b7588..c76f6dba11 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -3216,6 +3216,11 @@ static void gen_sse(CPUX86State *env, DisasContext *s,
int b,
is_xmm = 1;
}
}
+ if (sse_op_flags & SSE_OPF_3DNOW) {
+ if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW)) {
+ goto illegal_op;
+ }
+ }
/* simple MMX/SSE operation */
if (s->flags & HF_TS_MASK) {
gen_exception(s, EXCP07_PREX, pc_start - s->cs_base);
@@ -4567,21 +4572,20 @@ static void gen_sse(CPUX86State *env, DisasContext *s,
int b,
rm = (modrm & 7);
op2_offset = offsetof(CPUX86State,fpregs[rm].mmx);
}
+ if (sse_op_flags & SSE_OPF_3DNOW) {
+ /* 3DNow! data insns */
+ val = x86_ldub_code(env, s);
+ SSEFunc_0_epp op_3dnow = sse_op_table5[val];
+ if (!op_3dnow) {
+ goto unknown_op;
+ }
+ tcg_gen_addi_ptr(s->ptr0, cpu_env, op1_offset);
+ tcg_gen_addi_ptr(s->ptr1, cpu_env, op2_offset);
+ op_3dnow(cpu_env, s->ptr0, s->ptr1);
+ return;
+ }
}
switch(b) {
- case 0x0f: /* 3DNow! data insns */
- val = x86_ldub_code(env, s);
- sse_fn_epp = sse_op_table5[val];
- if (!sse_fn_epp) {
- goto unknown_op;
- }
- if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW)) {
- goto illegal_op;
- }
- tcg_gen_addi_ptr(s->ptr0, cpu_env, op1_offset);
- tcg_gen_addi_ptr(s->ptr1, cpu_env, op2_offset);
- sse_fn_epp(cpu_env, s->ptr0, s->ptr1);
- break;
case 0x70: /* pshufx insn */
case 0xc6: /* pshufx insn */
val = x86_ldub_code(env, s);
--
2.37.1
- [PATCH v3 00/23] target/i386: make SSE helpers generic in the vector size, Paolo Bonzini, 2022/09/01
- [PATCH v3 02/23] i386: formatting fixes, Paolo Bonzini, 2022/09/01
- [PATCH v3 01/23] i386: do not use MOVL to move data between SSE registers, Paolo Bonzini, 2022/09/01
- [PATCH v3 07/23] i386: check SSE table flags instead of hardcoding opcodes, Paolo Bonzini, 2022/09/01
- [PATCH v3 05/23] i386: Rework sse_op_table6/7, Paolo Bonzini, 2022/09/01
- [PATCH v3 03/23] i386: Add ZMM_OFFSET macro, Paolo Bonzini, 2022/09/01
- [PATCH v3 06/23] i386: Move 3DNOW decoder,
Paolo Bonzini <=
- [PATCH v3 08/23] i386: isolate MMX code more, Paolo Bonzini, 2022/09/01
- [PATCH v3 09/23] i386: Add size suffix to vector FP helpers, Paolo Bonzini, 2022/09/01
- [PATCH v3 04/23] i386: Rework sse_op_table1, Paolo Bonzini, 2022/09/01
- [PATCH v3 10/23] i386: do not cast gen_helper_* function pointers, Paolo Bonzini, 2022/09/01
- [PATCH v3 11/23] i386: Add CHECK_NO_VEX, Paolo Bonzini, 2022/09/01
- [PATCH v3 18/23] i386: Dot product AVX helper prep, Paolo Bonzini, 2022/09/01
- [PATCH v3 21/23] i386: Rewrite blendv helpers, Paolo Bonzini, 2022/09/01
- [PATCH v3 12/23] i386: Rewrite vector shift helper, Paolo Bonzini, 2022/09/01