[llvm] [RISCV] Handle .vx/.vi pseudos in hasAllNBitUsers (PR #67419)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 26 11:22:35 PDT 2023
================
@@ -2752,6 +2752,175 @@ bool RISCVDAGToDAGISel::selectSHXADD_UWOp(SDValue N, unsigned ShAmt,
return false;
}
+static bool vectorPseudoHasAllNBitUsers(SDNode *User, unsigned UserOpNo,
+ unsigned Bits,
+ const TargetInstrInfo *TII) {
+ const RISCVVPseudosTable::PseudoInfo *PseudoInfo =
+ RISCVVPseudosTable::getPseudoInfo(User->getMachineOpcode());
+
+ if (!PseudoInfo)
+ return false;
+
+ const MCInstrDesc &MCID = TII->get(User->getMachineOpcode());
+ const uint64_t TSFlags = MCID.TSFlags;
+ if (!RISCVII::hasSEWOp(TSFlags))
+ return false;
+ assert(RISCVII::hasVLOp(TSFlags));
+
+ bool HasGlueOp = User->getGluedNode() != nullptr;
+ unsigned ChainOpIdx = User->getNumOperands() - HasGlueOp - 1;
+ bool HasChainOp = User->getOperand(ChainOpIdx).getValueType() == MVT::Other;
+ bool HasVecPolicyOp = RISCVII::hasVecPolicyOp(TSFlags);
+ unsigned VLIdx =
+ User->getNumOperands() - HasVecPolicyOp - HasChainOp - HasGlueOp - 2;
+ const unsigned Log2SEW = User->getConstantOperandVal(VLIdx + 1);
+
+ // TODO: The Largest VL 65,536 occurs for LMUL=8 and SEW=8 with
+ // VLEN=65,536. We could check if Bits < 16 here.
+ if (UserOpNo == VLIdx)
----------------
preames wrote:
Isn't such an AVL undefined to start with though? I thought AVL had to be smaller than VLMAX to be well defined - both in our internal representation and the intrinsic definition.
I'm being pedantic here. I don't think it is worth optimizing on right now, just want to make sure I fully have my head wrapped around this.
https://github.com/llvm/llvm-project/pull/67419
More information about the llvm-commits
mailing list