All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/20] target/i386/tcg: implement APX
@ 2026-08-25 12:29 Paolo Bonzini
  2026-08-25 12:29 ` [PATCH 01/20] target/i386/tcg: do not reuse cc_srcT Paolo Bonzini
                   ` (20 more replies)
  0 siblings, 21 replies; 38+ messages in thread
From: Paolo Bonzini @ 2026-08-25 12:29 UTC (permalink / raw)
  To: qemu-devel

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.

In fact, most of the new code is for EVEX decoding.  The extensions to
existing instruction can be implemented almost entirely by tweaking the
decode tables: the new data destination feature comes almost for free
thanks to the existing support for BMI instructions.  Variants such as no
flags update and zero-upper are quite easy as well.  The new instructions
(CCMP/CTEST, CFCMOV, PUSH2/POP2) are trivial except for CCMP/CTEST,
which try to be reasonably efficient.  A lot of the recent changes to
AF/CF/OF computation make the changes to helpers very small, while
efficient implementation of JL/JLE/JB/JBE takes a bit of effort.

The main design decision was whether to treat VEX and EVEX maps as an
extension of the regular maps, or just bite the bullet, copy them over
to a new array and define them from scratch.  Here I went the copying
route due to some annoying differences in accepted prefixes and due to
opcodes that were moved to a different spot.  But in some cases APX's
three-operand variants end up being visible in the regular table,
due to shared code in decode_group*.

Don't expect any performance gains.  APX binaries do produce about 1%
fewer TCG ops, but they map to about 1% *more* assembly instructions,
at least for x86-on-x86: that's because while the optimizer could
already produce roughly the same ops as NDD or NF instructions, the new
PUSH2/POP2 instructions include a stack alignment check that isn't there
in non-APX code.  I don't think it's worth wasting a precious HF_ bit
for it, at least not for the next few years.

Other than the first three patches, and other than not reusing decode_root,
this is mostly the same as the RFC[1] since I didn't have much more
time to work on it.  System mode emulation was tested very little,
basically nothing more than a simple initrd that runs a few instructions
and does xsave/xrstor.

Paolo

[1] https://lore.kernel.org/qemu-devel/20260301144218.458140-1-pbonzini@redhat.com/


Paolo Bonzini (20):
  target/i386/tcg: do not reuse cc_srcT
  target/i386/tcg: inline gen_ext_tl
  target/i386/tcg: simplify return value of gen_prepare_cc
  target/i386/tcg: move check bits out of validate_vex
  target/i386/tcg: add APX support to XSAVE/XRSTOR
  target/i386/tcg: treat VEX as disabling high-byte registers
  target/i386/tcg: add definition for REX2 prefix
  target/i386/tcg: mark XSAVE* as not allowing REX2
  target/i386/tcg: decode REX2 prefix
  target/i386/tcg: implement JMPABS instruction
  target/i386/tcg: fetch modrm early
  target/i386/tcg: move VEX validation early
  target/i386/tcg: extend VEX.vvvv parsing for APX
  target/i386/tcg: decode EVEX prefix
  target/i386/tcg: add ZU writeback
  target/i386/tcg: add decode functionality for APX
  target/i386/tcg: implement CCMP/CTEST
  target/i386/tcg: decode APX instructions
  target/i386/tcg: mark APX as supported
  target/i386/tcg: optimize CCMP

 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             |  20 +
 target/i386/tcg/tcg-cpu.h                |  16 +-
 target/i386/tcg/cc_helper_template.h.inc |  11 +
 target/i386/cpu.c                        |  15 +-
 target/i386/helper.c                     |  11 +
 target/i386/tcg/cc_helper.c              |  10 +
 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              | 203 +++--
 target/i386/tcg/decode-new.c.inc         | 896 +++++++++++++++++++----
 target/i386/tcg/emit.c.inc               | 256 ++++++-
 16 files changed, 1274 insertions(+), 246 deletions(-)

-- 
2.55.0



^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2026-09-08  2:11 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 12:29 [PATCH 00/20] target/i386/tcg: implement APX Paolo Bonzini
2026-08-25 12:29 ` [PATCH 01/20] target/i386/tcg: do not reuse cc_srcT Paolo Bonzini
2026-08-25 23:09   ` Richard Henderson
2026-08-25 12:29 ` [PATCH 02/20] target/i386/tcg: inline gen_ext_tl Paolo Bonzini
2026-08-25 23:09   ` Richard Henderson
2026-08-25 12:29 ` [PATCH 03/20] target/i386/tcg: simplify return value of gen_prepare_cc Paolo Bonzini
2026-08-25 12:29 ` [PATCH 04/20] target/i386/tcg: move check bits out of validate_vex Paolo Bonzini
2026-08-25 12:29 ` [PATCH 05/20] target/i386/tcg: add APX support to XSAVE/XRSTOR Paolo Bonzini
2026-09-08  2:10   ` Chang S. Bae
2026-08-25 12:29 ` [PATCH 06/20] target/i386/tcg: treat VEX as disabling high-byte registers Paolo Bonzini
2026-08-25 12:29 ` [PATCH 07/20] target/i386/tcg: add definition for REX2 prefix Paolo Bonzini
2026-09-08  2:10   ` Chang S. Bae
2026-08-25 12:29 ` [PATCH 08/20] target/i386/tcg: mark XSAVE* as not allowing REX2 Paolo Bonzini
2026-09-08  2:10   ` Chang S. Bae
2026-08-25 12:29 ` [PATCH 09/20] target/i386/tcg: decode REX2 prefix Paolo Bonzini
2026-09-08  2:10   ` Chang S. Bae
2026-08-25 12:29 ` [PATCH 10/20] target/i386/tcg: implement JMPABS instruction Paolo Bonzini
2026-08-26 14:30   ` Zhao Liu
2026-08-27  6:33     ` Paolo Bonzini
2026-08-25 12:29 ` [PATCH 11/20] target/i386/tcg: fetch modrm early Paolo Bonzini
2026-08-25 12:29 ` [PATCH 12/20] target/i386/tcg: move VEX validation early Paolo Bonzini
2026-08-28  8:32   ` Zhao Liu
2026-08-25 12:29 ` [PATCH 13/20] target/i386/tcg: extend VEX.vvvv parsing for APX Paolo Bonzini
2026-08-25 12:29 ` [PATCH 14/20] target/i386/tcg: decode EVEX prefix Paolo Bonzini
2026-08-28  9:10   ` Zhao Liu
2026-08-25 12:29 ` [PATCH 15/20] target/i386/tcg: add ZU writeback Paolo Bonzini
2026-08-25 12:29 ` [PATCH 16/20] target/i386/tcg: add decode functionality for APX Paolo Bonzini
2026-09-01 14:56   ` Zhao Liu
2026-09-02  6:55   ` Zhao Liu
2026-08-25 12:29 ` [PATCH 17/20] target/i386/tcg: implement CCMP/CTEST Paolo Bonzini
2026-09-02  6:06   ` Zhao Liu
2026-08-25 12:29 ` [PATCH 18/20] target/i386/tcg: decode APX instructions Paolo Bonzini
2026-09-02  7:27   ` Zhao Liu
2026-08-25 12:29 ` [PATCH 19/20] target/i386/tcg: mark APX as supported Paolo Bonzini
2026-09-02  9:15   ` Zhao Liu
2026-08-25 12:29 ` [PATCH 20/20] target/i386/tcg: optimize CCMP Paolo Bonzini
2026-09-02  9:29   ` Zhao Liu
2026-09-08  2:10 ` [PATCH 00/20] target/i386/tcg: implement APX Chang S. Bae

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.