[llvm] [RISCV][TTI] Scale the cost of ICmp with LMUL (PR #88235)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 15 08:04:50 PDT 2024
================
@@ -1375,14 +1375,15 @@ 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() &&
+ CmpInst::isIntPredicate(VecPred)) {
+ // Use VMSLT_VV to represent VMSEQ, VMSNE, VMSLTU, VMSLEU, VMSLT, VMSLE
+ // provided they incur the same cost across all implementations
+ return LT.first *
+ getRISCVInstructionCost(RISCV::VMSLT_VV, LT.second, CostKind);
----------------
preames wrote:
We can split these apart if needed, starting with the assumption they're all the same cost seems entirely reasonable to me and simplifies the code significantly.
https://github.com/llvm/llvm-project/pull/88235
More information about the llvm-commits
mailing list