[PATCH] D100099: [X86][CostModel] Try to fix cost computation load/stores of non-power-of-two vectors
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 8 05:33:02 PDT 2021
ABataev added inline comments.
================
Comment at: llvm/lib/Target/X86/X86TargetTransformInfo.cpp:3222-3230
+ SmallVector<unsigned, CHAR_BIT * sizeof(NumElem)> Factors;
+ for (unsigned Bit = 0; Bit != CHAR_BIT * sizeof(NumElem); ++Bit) {
+ unsigned Factor = unsigned(1) << Bit;
+ if (NumElem & Factor)
+ Factors.emplace_back(Factor);
+ }
+ assert(std::accumulate(Factors.begin(), Factors.end(), unsigned(0)) ==
----------------
Why not just something like this:
```
unsigned Factor = 0;
for (; NumElem > 0; NumElem -= Factor) {
Factor = PowerOf2Floor(NumElem);
.....
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100099/new/
https://reviews.llvm.org/D100099
More information about the llvm-commits
mailing list