[llvm] [RISCV][TTI] Scale the cost of ICmp with LMUL (PR #88235)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 10 20:13:05 PDT 2024
================
@@ -1375,14 +1375,47 @@ InstructionCost RISCVTTIImpl::getCmpSelInstrCost(unsigned Opcode, Type *ValTy,
LT.second, CostKind);
}
- if ((Opcode == Instruction::ICmp || Opcode == Instruction::FCmp) &&
- ValTy->isVectorTy()) {
- std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(ValTy);
-
- // Support natively.
- if (CmpInst::isIntPredicate(VecPred))
- return LT.first * 1;
+ if ((Opcode == Instruction::ICmp) && ValTy->isVectorTy()) {
+ unsigned RVVOp;
+ switch (VecPred) {
+ case CmpInst::ICMP_EQ:
+ RVVOp = RISCV::VMSEQ_VV;
+ break;
+ case CmpInst::ICMP_NE:
+ RVVOp = RISCV::VMSNE_VV;
+ break;
+ case CmpInst::ICMP_UGT:
+ RVVOp = RISCV::VMSLTU_VV;
----------------
arcbbb wrote:
We currently ignore the cost of materializing constant vectors, so I would like to postpone it until we start to handle constant materialization cost.
https://github.com/llvm/llvm-project/pull/88235
More information about the llvm-commits
mailing list