[llvm] update P7 v4i8 load cost (PR #108261)

Chen Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 16:26:19 PDT 2024


================
@@ -802,12 +802,18 @@ InstructionCost PPCTTIImpl::getMemoryOpCost(unsigned Opcode, Type *Src,
   // explicitly check this case. There are also corresponding store
   // instructions.
   unsigned MemBytes = Src->getPrimitiveSizeInBits();
-  if (ST->hasVSX() && IsAltivecType &&
-      (MemBytes == 64 || (ST->hasP8Vector() && MemBytes == 32)))
-    return 1;
+  Align AlignBytes = Alignment ? *Alignment : Align(1);
+  unsigned SrcBytes = LT.second.getStoreSize();
+  if (ST->hasVSX() && IsAltivecType) {
+    if (MemBytes == 64 || (ST->hasP8Vector() && MemBytes == 32))
+      return 1;
+    // Use lfiwax/xxspltw
+    if (Opcode == Instruction::Load && MemBytes == 32)
+      if (AlignBytes < SrcBytes || Cost > 2)
----------------
chenzheng1030 wrote:

The logic if(Cost > 2) return 2; seems not perfect. Can we exclude the case at the place where Cost is set to be bigger than 2?

https://github.com/llvm/llvm-project/pull/108261


More information about the llvm-commits mailing list