Skip to content

target/i386: optimize string operations

Paolo Bonzini qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 19 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13target/i386: inline gen_jcc into sole callertarget/i386/tcg/emit.c.inc target/i386/tcg/translate.c+5 -91 reply
2/13target/i386: remove trailing 1 from gen_{j, cmov, set}cc1target/i386/tcg/emit.c.inc target/i386/tcg/translate.c+12 -121 reply
3/13target/i386: unify REP and REPZ/REPNZ generationtarget/i386/tcg/translate.c+20 -191 reply
4/13target/i386: unify choice between single and repeated string instructionstarget/i386/tcg/emit.c.inc target/i386/tcg/translate.c+17 -372 replies
5/13target/i386: reorganize ops emitted by do_gen_rep, drop repz_opttarget/i386/tcg/translate.c+13 -471 reply
6/13target/i386: tcg: move gen_set/reset_* earlier in the filetarget/i386/tcg/translate.c+40 -401 reply
7/13target/i386: fix RF handling for string instructionstarget/i386/tcg/translate.c+21 -11 reply
8/13target/i386: make cc_op handling more explicit for repeated string instructions.target/i386/tcg/translate.c+16 -13 replies
9/13target/i386: do not use gen_op_jz_ecx for repeated string operationstarget/i386/tcg/translate.c+2 -12 replies
10/13target/i386: optimize CX handling in repeated string operationstarget/i386/tcg/translate.c+14 -11 reply
11/13target/i386: execute multiple REP/REPZ iterations without leaving TBtarget/i386/tcg/translate.c+49 -63 replies
12/13target/i386: pull computation of string update value out of looptarget/i386/tcg/translate.c+26 -281 reply
13/13target/i386: avoid using s->tmp0 for add to implicit registerstarget/i386/tcg/translate.c+15 -81 reply

Reviews trailers per patch

10 of 13 patches have a Reviewed-by or Acked-by.

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

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

Read the v1 thread

Cover letter [PATCH 00/13] target/i386: optimize string operations

This started as an "easy" fix for RF handling in string instructions. I then realized how broken repz_opt is (patch 5) in that it was optimizing for the wrong case; and that redoing the optimization would make the RF handling basically free.

On a microbenchmark running x86-on-x86 user-mode emulation, stos and movs execute about 40% less instruction and about 60% less branches. Performance is very variable, because it is limited by memory bandwidth and because the out-of-order processor does a great job of scheduling all the useless instructions executed by the older code; but the microbenchmark results seem to improve by 10-15%.

Paolo

Paolo Bonzini (13):
target/i386: inline gen_jcc into sole caller
target/i386: remove trailing 1 from gen_{j,cmov,set}cc1 target/i386: unify REP and REPZ/REPNZ generation target/i386: unify choice between single and repeated string
instructions
target/i386: reorganize ops emitted by do_gen_rep, drop repz_opt target/i386: tcg: move gen_set/reset_* earlier in the file target/i386: fix RF handling for string instructions target/i386: make cc_op handling more explicit for repeated string
instructions.
target/i386: do not use gen_op_jz_ecx for repeated string operations target/i386: optimize CX handling in repeated string operations target/i386: execute multiple REP/REPZ iterations without leaving TB target/i386: pull computation of string update value out of loop target/i386: avoid using s->tmp0 for add to implicit registers

 target/i386/tcg/translate.c | 342 +++++++++++++++++++++---------------
 target/i386/tcg/emit.c.inc  |  56 ++----
 2 files changed, 219 insertions(+), 179 deletions(-)
Signature · 1 line
2.47.1