================
@@ -2172,13 +2172,47 @@ static unsigned getNumMemoryInsts(unsigned Bytes, 
unsigned MaxBytes,
                                   bool HasDwordx3) {
   unsigned NumInsts = Bytes / MaxBytes;
   unsigned Rem = Bytes % MaxBytes;
-  if (HasDwordx3 && Rem >= 12) {
+  if (HasDwordx3 && Rem % 16 >= 12) {
     ++NumInsts;
     Rem -= 12;
   }
   return NumInsts + llvm::popcount(Rem);
 }
 
+static unsigned getNumWidenedSMEMLoads(unsigned Bytes, uint64_t Alignment,
+                                       unsigned EltBytes, unsigned MaxBytes,
+                                       bool HasDwordx3) {
+  unsigned MaxPiece = EltBytes == 1 ? 8 : MaxBytes;
----------------
MrSidims wrote:

I'd love to avoid it as well, but the helper doesn't exactly follow the 
legalization as DAG splits these loads and type legalization cost counts 
registers and not loads. I can still reuse it and drop the helper, but the 
result would be less precise than the current model.

https://github.com/llvm/llvm-project/pull/238840
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to