[PATCH] D152116: [DAGCombiner] Transform `(icmp eq/ne (and X,C0),(shift X,C1))` to use rotate or to getter constants.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 09:45:44 PDT 2023


RKSimon accepted this revision.
RKSimon added a comment.
This revision is now accepted and ready to land.

LGTM with one minor



================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:12496
+            IsRotate ||
+            (*ShiftCAmt == (~*AndCMask).popcount() && ShiftOpc == ISD::SHL
+                 ? (~*AndCMask).isMask()
----------------
goldstein.w.n wrote:
> RKSimon wrote:
> > (~*AndCMask).popcount() - is this the same as !AndCMask->isAllOnes() ?
> No, we are checking for something like:
> `(icmp eq  (and X, 0x1f), (srl, X, 3)`. Not all ones.
Test ShiftOpc == ISD::SHL before the popcount as its cheaper?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152116



More information about the llvm-commits mailing list