[PATCH] D117680: [InstCombine] Simplify bswap -> shift

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 20 10:53:48 PST 2022


spatel added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/bswap-fold.ll:442
+; CHECK-NEXT:    [[TMP2:%.*]] = shl i64 [[TMP0:%.*]], 57
+; CHECK-NEXT:    [[TMP3:%.*]] = shl i64 [[TMP0]], 1
+; CHECK-NEXT:    [[TMP4:%.*]] = and i64 [[TMP3]], 254
----------------
chfast wrote:
> Here we replace bswap with `lshr i64 %2, 56`, but it is further expanded to 
> ```
> shl i64 %0, 1
> and i64 %3, 254
> ```
I added one-use checks with:
2d031ec5e53f
...so this shouldn't have an extra instruction now.

Please pre-commit the tests with the baseline CHECKs, so we just show diffs in this patch.


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