[llvm] [SelectionDAG] Support integer promotion for VP_LOAD and VP_STORE (PR #81299)
zhijian lin via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 30 13:51:24 PDT 2024
================
@@ -2216,6 +2242,50 @@ SDValue DAGTypeLegalizer::PromoteIntOp_STORE(StoreSDNode *N, unsigned OpNo){
N->getMemoryVT(), N->getMemOperand());
}
+SDValue DAGTypeLegalizer::PromoteIntOp_VP_STORE(VPStoreSDNode *N,
+ unsigned OpNo) {
+ SDValue DataOp = N->getValue();
+ SDValue Operand = N->getOperand(OpNo);
+
+ if (OpNo >= 4) {
+ // The Mask or EVL. Update in place.
+ EVT DataVT = DataOp.getValueType();
+ SDValue PromotedOperand = OpNo == 4 ? PromoteTargetBoolean(Operand, DataVT)
+ : ZExtPromotedInteger(Operand);
+ SmallVector<SDValue, 6> NewOps(N->op_begin(), N->op_end());
+ NewOps[OpNo] = PromotedOperand;
+ return SDValue(DAG.UpdateNodeOperands(N, NewOps), 0);
+ }
+
+ assert(OpNo == 1 && "Unexpected operand for promotion");
+ DataOp = GetPromotedInteger(DataOp);
+
+ assert(!N->isIndexed() && "expecting unindexed vp_store!");
+
+ return DAG.getTruncStoreVP(N->getChain(), SDLoc(N), DataOp, N->getBasePtr(),
+ N->getMask(), N->getVectorLength(),
+ N->getMemoryVT(), N->getMemOperand(),
+ N->isCompressingStore());
+}
+
+SDValue DAGTypeLegalizer::PromoteIntOp_VP_LOAD(VPLoadSDNode *N, unsigned OpNo) {
----------------
diggerlin wrote:
I added some printf in the function.
it looks the test case llvm/test/CodeGen/RISCV/rvv/vpload.ll do not hit the function.
is there any test case test the function?
https://github.com/llvm/llvm-project/pull/81299
More information about the llvm-commits
mailing list