[llvm] [RISCV][TTI] Scale the cost of ICmp with LMUL (PR #88235)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 12 00:23:58 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);
----------------
arcbbb wrote:
If listing each enum would overly complicate the function, we might simplify it by using a single instruction like VMSLT to represent VMSEQ, VMSNE, VMSGT, and others, provided they all incur the same cost across implementations.
https://github.com/llvm/llvm-project/pull/88235
More information about the llvm-commits
mailing list