Skip to content

tcg: improve optimizer

Aurelien Jarno qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest12 patches 4 repliesIn review
  2. v11 patch 4 repliesSuperseded

Changes in v2 from the cover letter

- Added patches 1 & 2
- patch 3: use bitmap_zero instead of memset
for the call op, only reset temps that are in use
- patch 4: do not use a bool to detect copies

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12tcg: correctly mark dead inputs for mov with a constanttcg/tcg.c+3 -00 replies
2/12tcg: mark temps as mem_coherent = 0 for mov with a constanttcg/tcg.c+1 -00 replies
3/12tcg/optimize: optimize temps trackingtcg/optimize.c+25 -110 replies
4/12tcg/optimize: add temp_is_const and temp_is_copy functionstcg/optimize.c+60 -710 replies
5/12tcg/optimize: track const/copy status separatelytcg/optimize.c+14 -283 replies
6/12tcg/optimize: allow constant to have copiestcg/optimize.c+2 -80 replies
7/12tcg: rename trunc_shr_i32 into trunc_shr_i64_i32tcg/README tcg/aarch64/tcg-target.h tcg/i386/tcg-target.h +10 more+18 -180 replies
8/12tcg: don't abuse TCG type in tcg_gen_trunc_shr_i64_i32tcg/tcg-op.c+2 -20 replies
9/12tcg: implement real ext_i32_i64 and extu_i32_i64 opstcg/aarch64/tcg-target.c tcg/i386/tcg-target.c tcg/ia64/tcg-target.c +7 more+45 -100 replies
10/12tcg/optimize: add optimizations for ext_i32_i64 and extu_i32_i64 opstcg/optimize.c+13 -00 replies
11/12tcg/optimize: do not remember garbage high bits for 32-bit opstcg/optimize.c+11 -301 reply
12/12tcg: update README about size changing opstcg/README+15 -30 replies

Reviews trailers per patch

2 of 12 patches have a Reviewed-by or Acked-by.

PatchRichard Henderson
1/12
2/12
3/12
4/12
5/12
6/12
7/12R-b
8/12R-b
9/12
10/12
11/12
12/12

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

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 for-2.5 00/12] tcg: improve optimizer

This patchset improves the optimizer in 3 different ways:
- by optimizing temp tracking using a bit array
- by allowing constants to have copy
- by differentiating 32 <-> 64 bits conversions from moves in the frontend by using specific instructions

The latter change introduces 2 new mandatory ext/extu_i32_i64 ops. For the future we might want to allow each guest to only implement 2 of the 3 size changing ops as I started to do in the following patchset:
http://lists.nongnu.org/archive/html/qemu-devel/2015-07/msg03369.html
That said we probably want to experiment with that first and see the impact on the performances. If wrongly implemented, things might seem to work but some bugs might appear in very rare cases, like the truncation problem we recently got on aarch64 and x86-64 hosts. Alternatively we might want to always implement the 3 ops on all backends to avoid multiplying variants of the code and with that bugs.

This patchset has been fully tested on x86-64 host, but only lightly tested on aarch64, ppc64 and s390x hosts.

Note that the two first patches have already been sent separately on the mailing list and should make their way to the 2.4 release. I have included them as they are fixing bugs triggered by patches from these series.

Changes v1->v2
- Added patches 1 & 2
- patch 3: use bitmap_zero instead of memset
for the call op, only reset temps that are in use
- patch 4: do not use a bool to detect copies

Aurelien Jarno (12):
tcg: correctly mark dead inputs for mov with a constant
tcg: mark temps as mem_coherent = 0 for mov with a constant tcg/optimize: optimize temps tracking
tcg/optimize: add temp_is_const and temp_is_copy functions tcg/optimize: track const/copy status separately tcg/optimize: allow constant to have copies
tcg: rename trunc_shr_i32 into trunc_shr_i64_i32
tcg: don't abuse TCG type in tcg_gen_trunc_shr_i64_i32
tcg: implement real ext_i32_i64 and extu_i32_i64 ops tcg/optimize: add optimizations for ext_i32_i64 and extu_i32_i64 ops tcg/optimize: do not remember garbage high bits for 32-bit ops
tcg: update README about size changing ops

 tcg/README               |  20 +++-
 tcg/aarch64/tcg-target.c |   4 +
 tcg/aarch64/tcg-target.h |   2 +-
 tcg/i386/tcg-target.c    |   5 +
 tcg/i386/tcg-target.h    |   2 +-
 tcg/ia64/tcg-target.c    |   4 +
 tcg/ia64/tcg-target.h    |   2 +-
 tcg/optimize.c           | 259 +++++++++++++++++++++--------------------------
 tcg/ppc/tcg-target.c     |   6 ++
 tcg/ppc/tcg-target.h     |   2 +-
 tcg/s390/tcg-target.c    |   5 +
 tcg/s390/tcg-target.h    |   2 +-
 tcg/sparc/tcg-target.c   |  12 ++-
 tcg/sparc/tcg-target.h   |   2 +-
 tcg/tcg-op.c             |  16 ++-
 tcg/tcg-opc.h            |   7 +-
 tcg/tcg.c                |   4 +
 tcg/tcg.h                |   2 +-
 tcg/tci/tcg-target.c     |   4 +
 tcg/tci/tcg-target.h     |   2 +-
 tci.c                    |   6 +-
 21 files changed, 198 insertions(+), 170 deletions(-)
Signature · 1 line
2.1.4