[llvm] [RISCV] Handle .vx/.vi pseudos in hasAllNBitUsers (PR #67419)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 26 09:42:20 PDT 2023
================
@@ -77,6 +77,141 @@ FunctionPass *llvm::createRISCVOptWInstrsPass() {
return new RISCVOptWInstrs();
}
+static bool vectorPseudoHasAllNBitUsers(const MachineOperand &UserOp,
+ unsigned Bits) {
+ const MachineInstr &MI = *UserOp.getParent();
+ const RISCVVPseudosTable::PseudoInfo *PseudoInfo =
+ RISCVVPseudosTable::getPseudoInfo(MI.getOpcode());
+
+ if (!PseudoInfo)
+ return false;
+
+ const MCInstrDesc &MCID = MI.getDesc();
+ const uint64_t TSFlags = MI.getDesc().TSFlags;
+ if (!RISCVII::hasSEWOp(TSFlags))
+ return false;
+ assert(RISCVII::hasVLOp(TSFlags));
+ const unsigned Log2SEW = MI.getOperand(RISCVII::getSEWOpNum(MCID)).getImm();
+
+ if (UserOp.getOperandNo() == RISCVII::getVLOpNum(MCID))
+ return false;
+
+ // TODO: Handle Zvbb instructions
+ switch (PseudoInfo->BaseInstr) {
----------------
preames wrote:
Having a utility which took the base opcode, and returned the number of bits used by the scalar operand would seem to common a lot of the implementation here. That could reasonable live in RISCVBaseInfo.h/cpp.
https://github.com/llvm/llvm-project/pull/67419
More information about the llvm-commits
mailing list