This series implements APX support; the main reason to do this is actually
to have some initial infrastructure for EVEX, without requiring all the
complexity of AVX512 but introducing the required changes in the
emulator. It also forces some changes that (hopefully) make
QEMU's decoder align a bit more with what Intel processors actually do.
This series was tested with Zhao Liu's https://github.com/trueptolemy/apx-test.
The failures were analyzed by AI but the fixes had to be redone anyway.
Other than for a couple typos, the LLM tended to fix the symptom rather
than be general, which is exactly the opposite of what I wanted. For
example, for the MUL/IMUL/DIV/IDIV assertion failure it wanted to modify
the decoding tables instead of weakening
assert(e->s0 == e->s1);
to this:
assert(e->op1 == X86_TYPE_None || e->s0 == e->s1);
Changing the decoding tables probably is a more common failure mode, indeed,
but not the right approach in the context of this series. Other than that,
the AGENTS.md from the AI policy discussion worked fine and the LLM was very
keen on helping me not stray from the righteous path.
The issues detected by apx-test and fixed here are as follows:
- MUL/IMUL/DIV/IDIV caused an assertion failure
- INC/DEC did not allow 0x66 as a prefix
- CMOV/CFCMOV's implicit zero-upper behavior was missing
- IMUL's use of sextT0 conflicted with the zero-upper modifier (see also
patches 1-3)
- MOVBE's register-to-register implementation was missing (see also
patch 4)
- REX2 incorrectly allowed a 0x0F byte following the prefix (patch 8)
On top of this, the fix between APX and MPX was not correctly resolved,
which is now fixed, and PUSH2/POP2 use a single MO_128 access.
I also included a couple recommendations from Chang Seok Bae. Thanks!
Paolo
Paolo Bonzini (17):
target/i386/tcg: generalize zero- and sign-extension
target/i386/tcg: use standard operand order for BSF and BSR
target/i386/tcg: use zextT1 for CMPXCHG
target/i386/tcg: unify MOVBE and BSWAP generators
target/i386/tcg: add APX support to XSAVE/XRSTOR
target/i386/tcg: add definition for REX2 prefix
target/i386/tcg: mark XSAVE* as not allowing REX2
target/i386/tcg: treat 0x0F as a prefix
target/i386/tcg: decode REX2 prefix
target/i386/tcg: implement JMPABS instruction
target/i386/tcg: extend VEX.vvvv parsing for APX
target/i386/tcg: decode EVEX prefix
target/i386/tcg: add decode functionality for APX
target/i386/tcg: implement CCMP/CTEST
target/i386/tcg: decode APX instructions
target/i386: extract computation of no-autoenable features
target/i386/tcg: mark APX as supported
configs/targets/x86_64-bsd-user.mak | 2 +-
configs/targets/x86_64-linux-user.mak | 2 +-
target/i386/cpu.h | 8 +
target/i386/helper.h | 1 +
target/i386/tcg/decode-new.h | 32 +-
target/i386/tcg/tcg-cpu.h | 18 +-
target/i386/tcg/cc_helper_template.h.inc | 11 +
target/i386/cpu.c | 45 +-
target/i386/helper.c | 11 +
target/i386/tcg/cc_helper.c | 14 +
target/i386/tcg/excp_helper.c | 5 +
target/i386/tcg/fpu_helper.c | 59 +-
target/i386/tcg/tcg-cpu.c | 5 +-
target/i386/tcg/translate.c | 112 ++-
target/i386/tcg/decode-new.c.inc | 823 +++++++++++++++++++----
target/i386/tcg/emit.c.inc | 255 ++++++-
16 files changed, 1210 insertions(+), 193 deletions(-)
--
2.55.0