Message ID | 20201127222516.44915-1-luc.vanoostenryck@gmail.com (mailing list archive) |
---|---|
Headers | show |
Series | 'bits translation' simplification | expand |
On Fri, Nov 27, 2020 at 2:28 PM Luc Van Oostenryck <luc.vanoostenryck@gmail.com> 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