[PATCH] D123409: [AArch64] Use PerfectShuffle costs in AArch64TTIImpl::getShuffleCost
Dave Green via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 19 03:11:31 PDT 2022
dmgreen added inline comments.
================
Comment at: llvm/lib/Target/AArch64/AArch64PerfectShuffle.h:6590
+static unsigned getPerfectShuffleCost(llvm::ArrayRef<int> M) {
+ assert(M.size() == 4 && "Expected a 4 entry perfect shuffle");
+
----------------
samtebbs wrote:
> Why do we have to limit this to 4x16 or 4x32 shuffles?
There is a comment in the summary of D123379 that might help explain perfect shuffles. The quick version is that they only support 4 entry shuffles, because otherwise the tables we store would just be too large.
================
Comment at: llvm/lib/Target/AArch64/AArch64PerfectShuffle.h:6611-6617
+ // Compute the index in the perfect shuffle table.
+ unsigned PFTableIndex = PFIndexes[0] * 9 * 9 * 9 + PFIndexes[1] * 9 * 9 +
+ PFIndexes[2] * 9 + PFIndexes[3];
+ unsigned PFEntry = PerfectShuffleTable[PFTableIndex];
+ // And extract the cost from the upper bits. The cost is encoded as Cost-1.
+ unsigned Cost = (PFEntry >> 30) + 1;
+ return Cost;
----------------
samtebbs wrote:
> A bit more elaboration here would be nice too.
I'm not sure exactly what else to say, other than this is how perfect shuffle tables work :)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123409/new/
https://reviews.llvm.org/D123409
More information about the llvm-commits
mailing list