[llvm] [RISCV][CostModel] Updates reduction and shuffle cost (PR #77342)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 9 08:28:48 PST 2024
================
@@ -1392,20 +1431,50 @@ RISCVTTIImpl::getArithmeticReductionCost(unsigned Opcode, VectorType *Ty,
return BaseT::getArithmeticReductionCost(Opcode, Ty, FMF, CostKind);
std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(Ty);
- if (Ty->getElementType()->isIntegerTy(1))
+ std::array<unsigned, 3> Opcodes;
+ if (Ty->getElementType()->isIntegerTy(1)) {
// vcpop sequences, see vreduction-mask.ll
- return (LT.first - 1) + (ISD == ISD::AND ? 3 : 2);
+ if (ISD == ISD::AND)
+ Opcodes = {RISCV::VMNAND_MM, RISCV::VCPOP_M, RISCV::SLT};
+ else
+ Opcodes = {RISCV::VCPOP_M, RISCV::SLT};
----------------
arcbbb wrote:
Fixed. Thanks!
https://github.com/llvm/llvm-project/pull/77342
More information about the llvm-commits
mailing list