[PATCH] D121354: [SLP] Fix lookahead operand reordering for splat loads.
Vasileios Porpodas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 10 10:52:24 PST 2022
vporpo added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1091
+ /// `ScoreSplat` because it takes only 1 instruction in x86 for a 2-lane
+ /// vector using `movddup (%reg), xmm0`.
+ static const int ScoreSplatLoads = 3;
----------------
ABataev wrote:
> Thos is target specific for x86. What about other targets?
Please see the discussion below.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:1121
+ if (V1 == V2) {
+ if (isa<LoadInst>(V1) && NumLanes == 2)
+ return VLOperands::ScoreSplatLoads;
----------------
lebedev.ri wrote:
> This should be a lot more principled than this (i.e, query the actual costmodel).
> E.g., `movddup` is only for `double`, but i think this will also trigger for `float`?
> Also, what about broadcasting loads that are available in AVX/AVX2/AVX512?
I agree, this needs to be target specific. I could add a new `ShuffleKind`, something like `SK_BroadcastLoad`. But this is not strictly a shuffle pattern, it is a combined Load + Shuffle. So this might need its own function, like `TargetTransformInfo::getBroadcastLoadCost(VectorType *VecTy)`. What do you think?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121354/new/
https://reviews.llvm.org/D121354
More information about the llvm-commits
mailing list