[PATCH] D99281: [AArch64][GlobalISel] Combine funnel shifts to AArch64 rotate opcodes.

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 24 10:49:24 PDT 2021


paquette added a comment.

There are a bunch of rotate combines in the DAGCombiner, so it would make sense to have a generic G_ROR and G_ROL. Looks like some low-hanging fruit.

    // fold (or (shl x, C1), (srl x, C2)) -> (rotl x, C1)
  
    // fold (or (shl x, C1), (srl x, C2)) -> (rotr x, C2)
  
    // fold (xor (shl 1, x), -1) -> (rotl ~1, x)
  
    // (or (and (shl (A, 8)), 0xff00ff00), (and (srl (A, 8)), 0x00ff00ff)) -> (rotr (bswap A), 16)
  
    // fold (or (shl x, (*ext y)),
    //          (srl x, (*ext (sub 32, y)))) ->
    //   (rotl x, y) or (rotr x, (sub 32, y))
  
    // fold (or (shl x, (*ext (sub 32, y))),
    //          (srl x, (*ext y))) ->
    //   (rotr x, y) or (rotl x, (sub 32, y))
    
  ... and so on ... 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99281/new/

https://reviews.llvm.org/D99281



More information about the llvm-commits mailing list