[PATCH] D123409: [AArch64] Use PerfectShuffle costs in AArch64TTIImpl::getShuffleCost
Sam Tebbs via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 13 03:15:27 PDT 2022
samtebbs 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");
+
----------------
Why do we have to limit this to 4x16 or 4x32 shuffles?
================
Comment at: llvm/lib/Target/AArch64/AArch64PerfectShuffle.h:6602-6609
+ unsigned PFIndexes[4];
+ for (unsigned i = 0; i != 4; ++i) {
+ assert(M[i] < 8 && "Expected a maximum entry of 8 for shuffle mask");
+ if (M[i] < 0)
+ PFIndexes[i] = 8;
+ else
+ PFIndexes[i] = M[i];
----------------
A comment about what is being done here would be beneficial.
================
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;
----------------
A bit more elaboration here would be nice too.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123409/new/
https://reviews.llvm.org/D123409
More information about the llvm-commits
mailing list