[llvm] [SDag][ARM][RISCV] Allow lowering CTPOP into a libcall (PR #99752)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 09:29:04 PDT 2024


================
@@ -3847,15 +3847,36 @@ void DAGTypeLegalizer::ExpandIntRes_CTLZ(SDNode *N,
   Hi = DAG.getConstant(0, dl, NVT);
 }
 
-void DAGTypeLegalizer::ExpandIntRes_CTPOP(SDNode *N,
-                                          SDValue &Lo, SDValue &Hi) {
-  SDLoc dl(N);
+void DAGTypeLegalizer::ExpandIntRes_CTPOP(SDNode *N, SDValue &Lo, SDValue &Hi) {
+  SDValue Op = N->getOperand(0);
+  EVT VT = N->getValueType(0);
+  SDLoc DL(N);
+
+  // If the narrow CTPOP is not supported by the target, try to convert it
----------------
arsenm wrote:

Do we really have to handle the libcall logic during type legalization? Can this just adjust the type, and leave the libcall for the libcall action 

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


More information about the llvm-commits mailing list