[llvm] [VP][RISCV] Add vp.cttz.elts intrinsic and its RISC-V codegen (PR #90502)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 13:05:43 PDT 2024


================
@@ -1026,6 +1026,13 @@ void VectorLegalizer::Expand(SDNode *Node, SmallVectorImpl<SDValue> &Results) {
       return;
     }
     break;
+  case ISD::VP_CTTZ_ELTS:
----------------
topperc wrote:

I think this should actually be expanded in LegalizeDAG. The original intent of LegalizeVectorOps is to handle instructions that may need to scalarize. Anything that is exclusively vector with no scalar equivalent should be done by LegalizeDAG.

Unfortunately, the code for VP intrinsics in `VectorLegalizer::LegalizeOp` where we instantiate BEGIN_REGISTER_VP_SDNODE is completely unaware of this. I think we should force `Legal` for this operation there so that it will get ignored until LegalizeDAG.

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


More information about the llvm-commits mailing list