[PATCH] D132237: [AArch64] expand is-power-of-2 pattern that uses popcount
    David Zarzycki via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sat Aug 20 03:29:41 PDT 2022
    
    
  
davezarzycki added inline comments.
================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:18593-18594
 
+  // (ctpop x) == 1 --> (x != 0) && ((x & x-1) == 0)
+  // (ctpop x) != 1 --> (x == 0) || ((x & x-1) != 0)
+  if (LHS.getOpcode() == ISD::CTPOP && LHS.hasOneUse() && isOneConstant(RHS) &&
----------------
For your consideration:
(ctpop x) <= 1 --> (x & x-1) == 0
(ctpop x) > 1 --> (x & x-1) != 0
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132237/new/
https://reviews.llvm.org/D132237
    
    
More information about the llvm-commits
mailing list