tcg: Handle clz, ctz, and clrsb generically
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest25 patches 14 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/25 | tcg: Add clz and ctz opcodestcg-runtime.c tcg/ tcg/ +14 more | +209 | 2 replies | |
| 2/25 | target-alpha: Use the ctz and clz opcodestarget-alpha/ target-alpha/ target-alpha/ | +2 | 0 replies | |
| 3/25 | target-cris: Use clz opcodetarget-cris/ target-cris/ target-cris/ | +1 | 0 replies | |
| 4/25 | target-microblaze: Use clz opcodetarget-microblaze/ target-microblaze/ target-microblaze/ | +1 | 0 replies | |
| 5/25 | target-mips: Use clz opcodetarget-mips/ target-mips/ target-mips/ | +16 | 0 replies | |
| 6/25 | target-openrisc: Use clz and ctz opcodestarget-openrisc/ target-openrisc/ target-openrisc/ | +4 | 0 replies | |
| 7/25 | target-ppc: Use clz and ctz opcodestarget-ppc/ target-ppc/ target-ppc/ | +16 | 1 reply | |
| 8/25 | target-s390x: Use clz opcodetarget-s390x/ target-s390x/ target-s390x/ | +1 | 0 replies | |
| 9/25 | target-tilegx: Use clz and ctz opcodestarget-tilegx/ target-tilegx/ target-tilegx/ | +2 | 0 replies | |
| 10/25 | target-tricore: Use clz opcodetarget-tricore/ target-tricore/ target-tricore/ | +3 | 2 replies | |
| 11/25 | target-unicore32: Use clz opcodetarget-unicore32/ target-unicore32/ target-unicore32/ | +3 | 0 replies | |
| 12/25 | target-xtensa: Use clz opcodetarget-xtensa/ target-xtensa/ target-xtensa/ | +11 | 0 replies | |
| 13/25 | target-arm: Use clz opcodetarget-arm/ target-arm/ target-arm/ +3 more | +7 | 0 replies | |
| 14/25 | target-i386: Use clz and ctz opcodestarget-i386/ target-i386/ target-i386/ | +14 | 0 replies | |
| 15/25 | disas/i386.c: Handle tzcntdisas/ | +10 | 0 replies | |
| 16/25 | tcg/i386: Handle ctz and clz opcodestcg/ tcg/ | +78 | 7 replies | |
| 17/25 | tcg/ppc: Handle ctz and clz opcodestcg/ tcg/ | +61 | 0 replies | |
| 18/25 | tcg/aarch64: Handle ctz and clz opcodestcg/ tcg/ | +51 | 2 replies | |
| 19/25 | tcg/arm: Handle ctz and clz opcodestcg/ tcg/ | +29 | 0 replies | |
| 20/25 | tcg/mips: Handle clz opcodetcg/ tcg/ | +36 | 0 replies | |
| 21/25 | tcg/s390: Handle clz opcodetcg/ tcg/ | +36 | 0 replies | |
| 22/25 | tcg: Add helpers for clrsbtcg-runtime.c tcg/ tcg/ +1 more | +44 | 0 replies | |
| 23/25 | target-arm: Use clrsb helpertarget-arm/ target-arm/ target-arm/ | +4 | 0 replies | |
| 24/25 | target-tricore: Use clrsb helpertarget-tricore/ target-tricore/ target-tricore/ | +1 | 0 replies | |
| 25/25 | target-xtensa: Use clrsb helpertarget-xtensa/ | +1 | 0 replies |
Reviews trailers per patch
1 of 25 patches has a Reviewed-by or Acked-by.
| Patch | David Gibson |
|---|---|
| 1/25 | |
| 2/25 | |
| 3/25 | |
| 4/25 | |
| 5/25 | |
| 6/25 | |
| 7/25 | R-b |
| 8/25 | |
| 9/25 | |
| 10/25 | |
| 11/25 | |
| 12/25 | |
| 13/25 | |
| 14/25 | |
| 15/25 | |
| 16/25 | |
| 17/25 | |
| 18/25 | |
| 19/25 | |
| 20/25 | |
| 21/25 | |
| 22/25 | |
| 23/25 | |
| 24/25 | |
| 25/25 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [Qemu-devel] [PATCH 00/25] tcg: Handle clz, ctz, and clrsb generically
As you can see from the diffstat below, almost every target was defining its own helpers for these common bit manipulation ops.
In the case of ctz and clz, they are often central to string search routines such as strlen, so it does benefit us to make them fast. So I do go ahead and add those as tcg opcodes, that can be handled by the tcg backends.
One perhaps surprising thing about my definition of these opcodes is that they take an explicit argument for the value to return when the input is zero.
In the vast majority of cases this we simply pass a constant that is the width of the argument. But it turns out to have a number of uses when implementing target-i386 (bsf does not change the register), target-openrisc (ff1 = ffs(3)), decomposing 64-bit clz/ctz for a 32-bit host, and actually implementing tcg/i386 (forcing the value into a register for input to cmov).
Lightly tested with x86_64 and ppc64 hosts.
r~
Richard Henderson (25):
tcg: Add clz and ctz opcodes
target-alpha: Use the ctz and clz opcodes
target-cris: Use clz opcode
target-microblaze: Use clz opcode
target-mips: Use clz opcode
target-openrisc: Use clz and ctz opcodes
target-ppc: Use clz and ctz opcodes
target-s390x: Use clz opcode
target-tilegx: Use clz and ctz opcodes
target-tricore: Use clz opcode
target-unicore32: Use clz opcode
target-xtensa: Use clz opcode
target-arm: Use clz opcode
target-i386: Use clz and ctz opcodes
disas/i386.c: Handle tzcnt
tcg/i386: Handle ctz and clz opcodes
tcg/ppc: Handle ctz and clz opcodes
tcg/aarch64: Handle ctz and clz opcodes
tcg/arm: Handle ctz and clz opcodes
tcg/mips: Handle clz opcode
tcg/s390: Handle clz opcode
tcg: Add helpers for clrsb
target-arm: Use clrsb helper
target-tricore: Use clrsb helper
target-xtensa: Use clrsb helper
disas/i386.c | 12 ++++- target-alpha/helper.h | 2 - target-alpha/int_helper.c | 10 ---- target-alpha/translate.c | 4 +- target-arm/helper-a64.c | 20 -------- target-arm/helper-a64.h | 4 -- target-arm/helper.c | 5 -- target-arm/helper.h | 1 - target-arm/translate-a64.c | 16 +++--- target-arm/translate.c | 6 +-- target-cris/helper.h | 1 - target-cris/op_helper.c | 5 -- target-cris/translate.c | 2 +- target-i386/helper.h | 2 - target-i386/int_helper.c | 11 ---- target-i386/translate.c | 31 ++++++------ target-microblaze/helper.h | 1 - target-microblaze/op_helper.c | 5 -- target-microblaze/translate.c | 2 +- target-mips/helper.h | 7 --- target-mips/op_helper.c | 22 -------- target-mips/translate.c | 23 ++++++--- target-openrisc/helper.h | 2 - target-openrisc/int_helper.c | 19 ------- target-openrisc/translate.c | 6 ++- target-ppc/helper.h | 4 -- target-ppc/int_helper.c | 20 -------- target-ppc/translate.c | 20 ++++++-- target-s390x/helper.h | 1 - target-s390x/int_helper.c | 6 --- target-s390x/translate.c | 2 +- target-tilegx/helper.c | 10 ---- target-tilegx/helper.h | 2 - target-tilegx/translate.c | 4 +- target-tricore/helper.h | 3 -- target-tricore/op_helper.c | 15 ------ target-tricore/translate.c | 7 +-- target-unicore32/helper.c | 10 ---- target-unicore32/helper.h | 3 -- target-unicore32/translate.c | 6 +-- target-xtensa/helper.h | 2 - target-xtensa/op_helper.c | 13 ----- target-xtensa/translate.c | 4 +- tcg-runtime.c | 30 +++++++++++ tcg/README | 8 +++ tcg/aarch64/tcg-target.h | 4 ++ tcg/aarch64/tcg-target.inc.c | 47 +++++++++++++++++ tcg/arm/tcg-target.h | 2 + tcg/arm/tcg-target.inc.c | 27 ++++++++++ tcg/i386/tcg-target.h | 4 ++ tcg/i386/tcg-target.inc.c | 83 ++++++++++++++++++++++++++---- tcg/ia64/tcg-target.h | 4 ++ tcg/mips/tcg-target.h | 2 + tcg/mips/tcg-target.inc.c | 34 +++++++++++++ tcg/optimize.c | 36 +++++++++++++ tcg/ppc/tcg-target.h | 4 ++ tcg/ppc/tcg-target.inc.c | 57 +++++++++++++++++++++ tcg/s390/tcg-target.h | 4 ++ tcg/s390/tcg-target.inc.c | 36 ++++++++++++- tcg/sparc/tcg-target.h | 4 ++ tcg/tcg-op.c | 114 ++++++++++++++++++++++++++++++++++++++++++ tcg/tcg-op.h | 20 ++++++++ tcg/tcg-opc.h | 4 ++ tcg/tcg-runtime.h | 7 +++ tcg/tcg.h | 2 + tcg/tci/tcg-target.h | 4 ++ 66 files changed, 614 insertions(+), 274 deletions(-)
Signature · 1 line
2.7.4