[llvm] [X86][CostModel] Add per-shape gather/scatter cost tables for AMD znver4+ (PR #199488)

via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 6 23:18:30 PDT 2026


================
@@ -6647,36 +6831,72 @@ InstructionCost X86TTIImpl::getGSVectorCost(unsigned Opcode,
     return (unsigned)32;
   };
 
-  // Trying to reduce IndexSize to 32 bits for vector 16.
-  // By default the IndexSize is equal to pointer size.
-  unsigned IndexSize = (ST->hasAVX512() && VF >= 16)
-                           ? getIndexSizeInBits(Ptr, DL)
-                           : DL.getPointerSizeInBits();
+  // By default the index is pointer-sized. The generic model has historically
+  // tried to narrow only VF 16+, where this avoids a legalization split. The
+  // Zen schedule-driven path also needs the real index width at smaller VFs to
+  // select the matching DQ/QQ (or DD/QD) instruction class.
+  unsigned IndexSize =
+      ST->hasAVX512() && (VF >= 16 || ST->hasPreferGSCostTable())
+          ? getIndexSizeInBits(Ptr, DL)
----------------
MattPD wrote:

Confirmed: The pointer operand's address space now selects the correct index width and schedule class.

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


More information about the llvm-commits mailing list