Re: [PATCH 02/11] tcg: Add tcg_gen_revbit{32,64}

Richard Henderson <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
On 7/30/26 23:49, Philippe Mathieu-Daudé wrote:
>> +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?

It is not intended for bswap (or revbit) to have a set interpretation for any target, but 
to be contextually correct for the usage.

For instance, TCG_BSWAP_IZ would generally be only known at the call-site, because of how 
one has prepared the input.  It's usage within s390x follows forced zero-extension:

     C(0xe31f, LRVH,    RXY_a, Z,   0, m2_16u, new, r1_16, rev16, 0)
...
     C(0xe33f, STRVH,   RXY_a, Z,   la2, r1_16u, new, m1_16, rev16, 0)

Annoyingly, s390x should have these memory insns updated to perform the "reversed" 
load/store via MO_BSWAP.

> - 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

But note that arm uses both OS (aarch32 REVSH) and OZ (aarch64 REV32).


r~
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.