[llvm] [ARM][MVE] Add shuffle costs for LDn and STn instructions. (PR #145304)
John Brawn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 23 05:56:30 PDT 2025
================
@@ -1336,6 +1336,37 @@ InstructionCost ARMTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
if (!Mask.empty()) {
std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(SrcTy);
+ // Check for LD2/LD4 instructions, which are represented in llvm IR as
+ // deinterleaving-shuffle(load). The shuffle cost could potentially be
+ // free, but we model it with a cost of LT.first so that LD2/LD4 have a
+ // higher cost than just the load.
+ if (Args.size() >= 1 && isa<LoadInst>(Args[0]) &&
+ (LT.second.getScalarSizeInBits() == 8 ||
+ LT.second.getScalarSizeInBits() == 16 ||
+ LT.second.getScalarSizeInBits() == 32) &&
+ LT.second.getSizeInBits() == 128 &&
+ (ShuffleVectorInst::isDeInterleaveMaskOfFactor(Mask, 2) ||
----------------
john-brawn-arm wrote:
Check MaxSupportedInterleaveFactor() >= 2 here? (So -mve-max-interleave-factor=1 will work as expected)
https://github.com/llvm/llvm-project/pull/145304
More information about the llvm-commits
mailing list