[llvm] [DAG] Add generic i8 CTPOP lowering using i32 MUL (PR #79989)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 07:20:38 PST 2024


================
@@ -8639,6 +8639,24 @@ SDValue TargetLowering::expandCTPOP(SDNode *Node, SelectionDAG &DAG) const {
   if (VT.isVector() && !canExpandVectorCTPOP(*this, VT))
     return SDValue();
 
+  // i8 CTPOP - with efficient i32 MUL, then attempt multiply-mask-multiply.
+  if (VT == MVT::i8 && shouldAllowMultiplyInBitCounts(MVT::i8, MVT::i32) &&
----------------
nikic wrote:

Would checking the immediate cost be able to distinguish targets where this is profitable?

https://github.com/llvm/llvm-project/pull/79989


More information about the llvm-commits mailing list