Re: [PATCH 02/11] tcg: Add tcg_gen_revbit{32,64}
Philippe Mathieu-Daudé <[email protected]> Fri, 31 Jul 2026 08:49:33 +0200
| Newsgroups | org.nongnu.qemu-arm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Richard, On 31/7/26 02:04, Richard Henderson wrote: > Add generic expanders for reversing bits within a word. > > Signed-off-by: Richard Henderson <[email protected]> > --- > include/tcg/tcg-op-common.h | 3 ++ > include/tcg/tcg-op.h | 5 ++++ > tcg/tcg-op.c | 59 +++++++++++++++++++++++++++++++++++++ > 3 files changed, 67 insertions(+) > > diff --git a/include/tcg/tcg-op-common.h b/include/tcg/tcg-op-common.h > index 1fe342db0d..91f59dc11e 100644 > --- a/include/tcg/tcg-op-common.h > +++ b/include/tcg/tcg-op-common.h > @@ -275,6 +276,8 @@ void tcg_gen_smax_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); > void tcg_gen_umin_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); > void tcg_gen_umax_i64(TCGv_i64, TCGv_i64 arg1, TCGv_i64 arg2); > void tcg_gen_abs_i64(TCGv_i64, TCGv_i64); > +void tcg_gen_revbit32_i64(TCGv_i64 ret, TCGv_i64 arg, int flags); > +void tcg_gen_revbit64_i64(TCGv_i64 ret, TCGv_i64 arg); Could the bswap flag be defined once per target? - output sign-extended (TCG_BSWAP_OS): alpha, hppa, loongarch, m68k, mips, riscv, rx, sh4, tricore - output zero-extended (TCG_BSWAP_OZ): arm, avr, hexagon, microblaze, openrisc, ppc, sparc, x86, xtensa - input/output zero-extended (TCG_BSWAP_IZ | TCG_BSWAP_OZ): s390x Having to manually encode it on each frontend doesn't sound optimal. Note, we have some target-specific TCG information in TCGCPUOps (useful at runtime for heterogeneous emulation).