• Craig Topper's avatar
    [RISCV] Add tests that do a bitreverse before or after a bswap. NFC · 3575700b
    Craig Topper authored
    We don't optimize this as well as we could. Bitreverse is always
    expanded to bswap and a shift/and/or sequence to swap bits within a
    byte. The newly created bswap will either becomes a shift/and/or
    sequence or rev8 instruction. We don't always realize the bswap is
    redundant with another bswap before or after the bitreverse.
    
    Found while thinking about the brev8 instruction from the
    Cryptography extension. It's equivalent to bswap(bitreverse(x)) or
    bitreverse(bswap(x)).
    3575700b
bswap-bitreverse-ctlz-cttz-ctpop.ll 84.5 KB