[PATCH] D109417: Cost model for VPMemory operations on PowerPC.

Bardia Mahjour via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 1 07:50:21 PST 2021


bmahjour added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp:1400
+
+    float AlignmentProb = (float)(Alignment.value() - 1) / Alignment.value();
+    float MisalignmentProb = 1.0 - AlignmentProb;
----------------
RolandF wrote:
> I like this approach better.  But I think the AlignmentProb calculation is incorrect.  This would calculate 0% aligned for align 1 and 7/8 aligned for align 8 instead of 50%.  If you want to key off alignment rather than number of elements then I think you want to do size / alignment to figure out the number of possible offsets and use that to calculate probability.
The accesses are consecutive and the minimum alignment of the address is specified on the load/store instruction, which is passed to this function, so I don't think the element size or the size of the vector matters.

I've changed the alignment probability calculation to simply divide the specified alignment by the desired alignment. This way we'll get 50% probability for 8-byte aligned accesses, 25% probability for 4-byte aligned accesses and so forth.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109417/new/

https://reviews.llvm.org/D109417



More information about the llvm-commits mailing list