Re: [PATCH 0/6] 'bits translation' simplification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 27, 2020 at 2:28 PM Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
>
> With a better if-conversion mechanism it also allows to optimize
>         int translate_bits(int x)
>         {
>                 int y = 0;
>                 if (x & 4)
>                         y |= 16;
>                 if (x & 8)
>                         y |= 32;
>                 return y;
>         }
>
> into this nice:
>         translate_bits:
>                 and.32      %r2 <- %arg1, $12
>                 shl.32      %r5 <- %r2, $2
>                 ret.32      %r5
>
> when applied on top of the previous 'factorization' series.

Heh. Very nice. Thanks,

            Linus



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux