[llvm] [AArch64] Improve non-SVE popcount for 32bit and 64 bit using udot (PR #95881)

David Green via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 00:34:03 PDT 2024


================
@@ -9740,6 +9740,26 @@ SDValue AArch64TargetLowering::LowerCTPOP_PARITY(SDValue Op,
   Val = DAG.getBitcast(VT8Bit, Val);
   Val = DAG.getNode(ISD::CTPOP, DL, VT8Bit, Val);
 
+  if (Subtarget->hasDotProd() && VT.getScalarSizeInBits() != 16) {
+    EVT DT = VT == MVT::v2i64 ? MVT::v4i32 : VT;
+    SDValue Zeros = DAG.getSplatBuildVector(
+        DT, DL, DAG.getConstant(0, DL, DT.getScalarType()));
----------------
davemgreen wrote:

I think you might be able to do just `DAG.getConstant(0, DL, DT)`, and it will splat for you.

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


More information about the llvm-commits mailing list