Message ID | 20230823145542.79633-9-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | tcg: Document *swap* helper implementations | expand |
On Wed, Aug 23, 2023 at 4:56 PM Philippe Mathieu-Daudé <philmd@linaro.org> wrote: > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > Reviewed-by: Edgar E. Iglesias <edgar@zeroasic.com> > --- > target/cris/translate.c | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/target/cris/translate.c b/target/cris/translate.c > index 0b3d724281..42103b5558 100644 > --- a/target/cris/translate.c > +++ b/target/cris/translate.c > @@ -411,15 +411,17 @@ static inline void t_gen_swapw(TCGv d, TCGv s) > tcg_gen_or_tl(d, d, t); > } > > -/* Reverse the within each byte. > - T0 = (((T0 << 7) & 0x80808080) | > - ((T0 << 5) & 0x40404040) | > - ((T0 << 3) & 0x20202020) | > - ((T0 << 1) & 0x10101010) | > - ((T0 >> 1) & 0x08080808) | > - ((T0 >> 3) & 0x04040404) | > - ((T0 >> 5) & 0x02020202) | > - ((T0 >> 7) & 0x01010101)); > +/* > + * Reverse the bits within each byte. > + * > + * T0 = ((T0 << 7) & 0x80808080) > + * | ((T0 << 5) & 0x40404040) > + * | ((T0 << 3) & 0x20202020) > + * | ((T0 << 1) & 0x10101010) > + * | ((T0 >> 1) & 0x08080808) > + * | ((T0 >> 3) & 0x04040404) > + * | ((T0 >> 5) & 0x02020202) > + * | ((T0 >> 7) & 0x01010101); > */ > static void t_gen_swapr(TCGv d, TCGv s) > { > -- > 2.41.0 > >
diff --git a/target/cris/translate.c b/target/cris/translate.c index 0b3d724281..42103b5558 100644 --- a/target/cris/translate.c +++ b/target/cris/translate.c @@ -411,15 +411,17 @@ static inline void t_gen_swapw(TCGv d, TCGv s) tcg_gen_or_tl(d, d, t); } -/* Reverse the within each byte. - T0 = (((T0 << 7) & 0x80808080) | - ((T0 << 5) & 0x40404040) | - ((T0 << 3) & 0x20202020) | - ((T0 << 1) & 0x10101010) | - ((T0 >> 1) & 0x08080808) | - ((T0 >> 3) & 0x04040404) | - ((T0 >> 5) & 0x02020202) | - ((T0 >> 7) & 0x01010101)); +/* + * Reverse the bits within each byte. + * + * T0 = ((T0 << 7) & 0x80808080) + * | ((T0 << 5) & 0x40404040) + * | ((T0 << 3) & 0x20202020) + * | ((T0 << 1) & 0x10101010) + * | ((T0 >> 1) & 0x08080808) + * | ((T0 >> 3) & 0x04040404) + * | ((T0 >> 5) & 0x02020202) + * | ((T0 >> 7) & 0x01010101); */ static void t_gen_swapr(TCGv d, TCGv s) {
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- target/cris/translate.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)