[llvm] [RISCV][TTI] Cost non-power-of-two size changing casts (PR #101047)
Shih-Po Hung via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 29 19:16:49 PDT 2024
================
@@ -1030,17 +1030,28 @@ InstructionCost RISCVTTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
if (!IsVectorType)
return BaseT::getCastInstrCost(Opcode, Dst, Src, CCH, CostKind, I);
- bool IsTypeLegal = isTypeLegal(Src) && isTypeLegal(Dst) &&
- (Src->getScalarSizeInBits() <= ST->getELen()) &&
- (Dst->getScalarSizeInBits() <= ST->getELen());
-
- // FIXME: Need to compute legalizing cost for illegal types.
- if (!IsTypeLegal)
+ // FIXME: Need to compute legalizing cost for illegal types. The current
+ // code handles only legal types and those which can be trivially
+ // promoted to legal.
+ if (Src->getScalarSizeInBits() > ST->getELen() ||
+ Dst->getScalarSizeInBits() > ST->getELen())
----------------
arcbbb wrote:
need `ST->hasVInstructions()` before calling `ST->getELen`
https://github.com/llvm/llvm-project/pull/101047
More information about the llvm-commits
mailing list