[PATCH] D117680: [InstCombine] Fold bswap(shl(x, C)) -> and(x, 255)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 19 09:39:06 PST 2022


RKSimon added a comment.

If we're after a more general mechanism, it might be possible to extend llvm::recognizeBSwapOrBitReverseIdiom() to recognise shift/mask patterns as well - the inner collectBitParts already handles bswap etc.



================
Comment at: llvm/test/Transforms/InstCombine/bswap-fold.ll:386
+  ret i64 %3
+}
+
----------------
We don't gain much from duplicating tests for different bitwidths like this - one scalar and one vector is typically enough, possibly with some basic additional multiuse and vector shift-amounts-with-undef tests as well


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117680



More information about the llvm-commits mailing list