[llvm] [Analysis][SVE] Improve cost model for some extending masked loads (PR #65957)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 01:33:29 PDT 2023


================
@@ -2461,6 +2461,34 @@ InstructionCost AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst,
             FP16Tbl, ISD, DstTy.getSimpleVT(), SrcTy.getSimpleVT()))
       return AdjustCost(Entry->Cost);
 
+  if ((ISD == ISD::ZERO_EXTEND || ISD == ISD::SIGN_EXTEND) &&
+      CCH == TTI::CastContextHint::Masked && ST->hasSVEorSME() &&
+      !TLI->isTypeLegal(SrcTy) && !TLI->isTypeLegal(DstTy)) {
----------------
david-arm wrote:

That's a good question @dtemirbulatov! For non-load extends the context hint (CCH) will be TTI::CastContextHint::None, whereas I am checking for TTI::CastContextHint::Masked. That means the new code I've added only applies when we are extending a masked load.

https://github.com/llvm/llvm-project/pull/65957


More information about the llvm-commits mailing list