Skip to content

Commit f87af7b

Browse files
author
git apple-llvm automerger
committed
Merge commit '8eb4ada181dc' from llvm.org/main into next
2 parents 58f0c21 + 8eb4ada commit f87af7b

File tree

3 files changed

+598
-1
lines changed

3 files changed

+598
-1
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2297,9 +2297,12 @@ InstructionCost RISCVTTIImpl::getVectorInstrCost(unsigned Opcode, Type *Val,
22972297
Index = Index % M1Max;
22982298
}
22992299

2300-
// We could extract/insert the first element without vslidedown/vslideup.
23012300
if (Index == 0)
2301+
// We can extract/insert the first element without vslidedown/vslideup.
23022302
SlideCost = 0;
2303+
else if (ST->hasVendorXRivosVisni() && isUInt<5>(Index) &&
2304+
Val->getScalarType()->isIntegerTy())
2305+
SlideCost = 0; // With ri.vinsert/ri.vextract there is no slide needed
23032306
else if (Opcode == Instruction::InsertElement)
23042307
SlideCost = 1; // With a constant index, we do not need to use addi.
23052308
}

0 commit comments

Comments
 (0)