Skip to content

target/i386: decoder changes for 8.2

Paolo Bonzini qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest19 patches 9 repliesIn review
  2. v118 patches 17 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19target/i386: group common checks in the decoding phasetarget/i386/tcg/decode-new.c.inc target/i386/tcg/decode-new.h target/i386/tcg/emit.c.inc+76 -361 reply
2/19target/i386: validate VEX.W for AVX instructionstarget/i386/tcg/decode-new.c.inc target/i386/tcg/decode-new.h+99 -401 reply
3/19target/i386: implement SHA instructionstarget/i386/cpu.c target/i386/ops_sse.h target/i386/tcg/decode-new.c.inc +3 more+209 -12 replies
4/19tests/tcg/i386: initialize more registers in test-avxtests/tcg/i386/test-avx.c+8 -00 replies
5/19tests/tcg/i386: test-avx: add test cases for SHA new instructionstests/tcg/i386/test-avx.py+2 -10 replies
6/19target/i386: accept full MemOp in gen_ext_tltarget/i386/tcg/translate.c+15 -150 replies
7/19target/i386: introduce flags writeback mechanismtarget/i386/cpu.h target/i386/tcg/decode-new.c.inc target/i386/tcg/decode-new.h +3 more+87 -72 replies
8/19target/i386: implement CMPccXADDtarget/i386/cpu.c target/i386/tcg/decode-new.c.inc target/i386/tcg/decode-new.h +2 more+133 -10 replies
9/19target/i386: do not clobber A0 in POP translationtarget/i386/tcg/translate.c+20 -140 replies
10/19target/i386: reintroduce debugging mechanismtarget/i386/tcg/decode-new.c.inc target/i386/tcg/translate.c+30 -00 replies
11/19target/i386: move 00-5F opcodes to new decodertarget/i386/tcg/decode-new.c.inc target/i386/tcg/decode-new.h target/i386/tcg/emit.c.inc +1 more+323 -10 replies
12/19target/i386: adjust decoding of J operandtarget/i386/tcg/decode-new.c.inc+0 -100 replies
13/19target/i386: split eflags computation out of gen_compute_eflagstarget/i386/tcg/translate.c+13 -50 replies
14/19tcg: add negsetcondiinclude/tcg/tcg-op-common.h include/tcg/tcg-op.h tcg/tcg-op.c+18 -01 reply
15/19target/i386: move 60-BF opcodes to new decodertarget/i386/tcg/decode-new.c.inc target/i386/tcg/decode-new.h target/i386/tcg/emit.c.inc +1 more+536 -170 replies
16/19target/i386: move operand load and writeback out of gen_cmovcc1target/i386/tcg/translate.c+8 -120 replies
17/19target/i386: move remaining conditional operations to new decodertarget/i386/tcg/decode-new.c.inc target/i386/tcg/decode-new.h target/i386/tcg/emit.c.inc +1 more+70 -10 replies
18/19target/i386: remove now converted opcodes from old decodertarget/i386/tcg/translate.c+4 -7010 replies
19/19target/i386: remove gen_optarget/i386/tcg/translate.c+12 -1330 replies

Reviews trailers per patch

3 of 19 patches have a Reviewed-by or Acked-by.

PatchRichard Henderson
1/19R-b
2/19A-b
3/19
4/19
5/19
6/19
7/19
8/19
9/19
10/19
11/19
12/19
13/19
14/19R-b
15/19
16/19
17/19
18/19
19/19

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 00/19] target/i386: decoder changes for 8.2

This includes:

- implementing SHA and CMPccXADD instruction extensions

- introducing a new mechanism for flags writeback that avoids a tricky failure

- converting the more orthogonal parts of the one-byte opcode map, as well as the CMOVcc and SETcc instructions.

Tested by booting several 32-bit and 64-bit guests.

The new decoder produces roughly 2% more ops, but after optimization there are just 0.5% more and almost all of them come from cmp instructions. For some reason that I have not investigated, these end up with an extra mov even after optimization:

                                sub_i64 tmp0,rax,$0x33
 mov_i64 cc_src,$0x33           mov_i64 cc_dst,tmp0
 sub_i64 cc_dst,rax,$0x33       mov_i64 cc_src,$0x33
 discard cc_src2                discard cc_src2
 discard cc_op                  discard cc_op

It could be easily fixed by not reusing gen_SUB for cmp instructions, or by debugging what goes on in the optimizer. However, it does not result in larger assembly.

Paolo

v1->v2: call set_cc_op from the delayed flags writeback
preparation for CC_OP_DYNAMIC
fix INC/DEC to use delayed flags writeback
remove cc_srcT from delayed flags writeback
annotate places that call set_cc_op() from emit functions rewrite IMUL expansion to avoid nowb and to commonize flags handling introduce tcg_gen_negsetcondi*

Paolo Bonzini (19):
target/i386: group common checks in the decoding phase target/i386: validate VEX.W for AVX instructions target/i386: implement SHA instructions tests/tcg/i386: initialize more registers in test-avx tests/tcg/i386: test-avx: add test cases for SHA new instructions target/i386: accept full MemOp in gen_ext_tl target/i386: introduce flags writeback mechanism target/i386: implement CMPccXADD
target/i386: do not clobber A0 in POP translation target/i386: reintroduce debugging mechanism target/i386: move 00-5F opcodes to new decoder target/i386: adjust decoding of J operand
target/i386: split eflags computation out of gen_compute_eflags
tcg: add negsetcondi
target/i386: move 60-BF opcodes to new decoder target/i386: move operand load and writeback out of gen_cmovcc1 target/i386: move remaining conditional operations to new decoder target/i386: remove now converted opcodes from old decoder target/i386: remove gen_op

 include/tcg/tcg-op-common.h          |    4 +
 include/tcg/tcg-op.h                 |    2 +
 target/i386/cpu.c                    |    4 +-
 target/i386/cpu.h                    |    1 +
 target/i386/ops_sse.h                |  128 ++++
 target/i386/tcg/decode-new.c.inc     |  616 ++++++++++++++--
 target/i386/tcg/decode-new.h         |   43 +-
 target/i386/tcg/emit.c.inc           |  745 ++++++++++++++++++-
 target/i386/tcg/ops_sse_header.h.inc |   14 +
 target/i386/tcg/translate.c          | 1001 +++-----------------------
 tcg/tcg-op.c                         |   12 +
 tests/tcg/i386/Makefile.target       |    2 +-
 tests/tcg/i386/test-avx.c            |    8 +
 tests/tcg/i386/test-avx.py           |    3 +-
 tests/tcg/i386/test-flags.c          |   37 +
 15 files changed, 1644 insertions(+), 976 deletions(-)
 create mode 100644 tests/tcg/i386/test-flags.c
Signature · 1 line
2.41.0