target/i386: miscellaneous flags improvements
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest14 patches 5 repliesIn review
- v114 patches 8 repliesSuperseded
Changes in v2 from the cover letter
- use MAKE_64BIT_MASK in helper_cc_compute_nz
- get rid completely of parity_table
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/14 | target/i386: use tcg_gen_ext_tl when applicabletarget/ | +8 | 0 replies | |
| 2/14 | target/i386: Tidy cc_op_str usagetarget/ | +11 | 0 replies | |
| 3/14 | target/i386: remove CC_OP_CLRtarget/ target/ target/ +2 more | +4 | 0 replies | |
| 4/14 | target/i386: Rearrange CCOptarget/ | +8 | 0 replies | |
| 5/14 | target/i386: Introduce cc_op_sizetarget/ target/ target/ | +26 | 0 replies | |
| 6/14 | target/i386: Wrap cc_op_live with a validity checktarget/ target/ target/ +1 more | +21 | 0 replies | |
| 7/14 | target/i386: optimize computation of ZF from CC_OP_DYNAMICtarget/ target/ target/ | +21 | 1 reply | |
| 8/14 | target/i386: optimize TEST+Jxx sequencestarget/ | +22 | 0 replies | |
| 9/14 | target/i386: add a few more trivial CCPrepare casestarget/ | +3 | 0 replies | |
| 10/14 | target/i386: add a note about gen_jcc1target/ | +4 | 1 reply | |
| 11/14 | target/i386: make flag variables unsignedtarget/ | +23 | 0 replies | |
| 12/14 | target/i386: use compiler builtin to compute PFinclude/ target/ target/ +2 more | +26 | 1 reply | |
| 13/14 | target/i386: use higher-precision arithmetic to compute CFtarget/ | +37 | 1 reply | |
| 14/14 | target/i386: use + to put flags togethertarget/ | +12 | 1 reply |
Reviews trailers per patch
11 of 14 patches have a Reviewed-by or Acked-by.
| Patch | Richard Henderson |
|---|---|
| 1/14 | R-b |
| 2/14 | |
| 3/14 | R-b |
| 4/14 | |
| 5/14 | |
| 6/14 | R-b |
| 7/14 | R-b |
| 8/14 | R-b |
| 9/14 | R-b |
| 10/14 | R-b |
| 11/14 | R-b |
| 12/14 | R-b |
| 13/14 | R-b |
| 14/14 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 00/14] target/i386: miscellaneous flags improvements
This includes improved translation of checks, microoptimization of the helpers, and improvements to the cc_op_* functions from Richard.
Unlike his original patches[1] I didn't convert cc_op_live() to a switch statement, instead keeping the array but making sure that all of its entries are nonzero. The only zero entry was CC_OP_CLR, which is now changed to spill the constant value of EFLAGS to cc_op_src. While this has a 0.2% cost in number of TCG ops, getting rid of the special case for CC_OP_CLR makes it even easier to optimize computation of ZF from CC_OP_DYNAMIC; this is quite common, for example in switch statements that have CMP/JG/JE sequences (JE followed JL/JG/JA/JB seems less common than the opposite, though that's not universal).
On a quick-and-dirty run of "ls -lR", the changes add ~750 spills of 0x44 to cc_op_src; but it also reduces to one half the calls to cc_compute_all (most of them are completely eliminated), and that is a lot more expensive.
One thing I noticed is that those spills are really huge (11 bytes). It might help to move cc_* at the very beginning of CPUX86State, because the number of accesses to cc_* is comparable to the number of accesses to registers (despite cc_* being mostly written, while registers are both read and written).
Thanks,
Paolo
[1] https://patchew.org/QEMU/[email protected]/
v1->v2:
- use MAKE_64BIT_MASK in helper_cc_compute_nz
- get rid completely of parity_table
Paolo Bonzini (10):
target/i386: use tcg_gen_ext_tl when applicable target/i386: remove CC_OP_CLR
target/i386: optimize computation of ZF from CC_OP_DYNAMIC target/i386: optimize TEST+Jxx sequences target/i386: add a few more trivial CCPrepare cases target/i386: add a note about gen_jcc1 target/i386: make flag variables unsigned target/i386: use compiler builtin to compute PF target/i386: use higher-precision arithmetic to compute CF target/i386: use + to put flags together
Richard Henderson (4):
target/i386: Tidy cc_op_str usage target/i386: Rearrange CCOp
target/i386: Introduce cc_op_size target/i386: Wrap cc_op_live with a validity check
include/qemu/host-utils.h | 9 ++ target/i386/cpu.h | 33 ++++-- target/i386/helper.h | 1 + target/i386/tcg/helper-tcg.h | 6 +- target/i386/tcg/cc_helper_template.h.inc | 127 +++++++++++++++-------- target/i386/cpu-dump.c | 18 ++-- target/i386/tcg/cc_helper.c | 51 +++------ target/i386/tcg/int_helper.c | 4 +- target/i386/tcg/translate.c | 103 ++++++++++++------ target/i386/tcg/decode-new.c.inc | 2 +- target/i386/tcg/emit.c.inc | 24 ++--- 11 files changed, 226 insertions(+), 152 deletions(-)
Signature · 1 line
2.47.0