[llvm] fe9f390 - [AMDGPU] Update isLegalAddressingMode for GFX12 SMEM loads (#78728)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 13:04:47 PST 2024


Author: Jay Foad
Date: 2024-01-24T21:04:43Z
New Revision: fe9f3903f2d61bc67bfee66b44872339c8c767bb

URL: https://github.com/llvm/llvm-project/commit/fe9f3903f2d61bc67bfee66b44872339c8c767bb
DIFF: https://github.com/llvm/llvm-project/commit/fe9f3903f2d61bc67bfee66b44872339c8c767bb.diff

LOG: [AMDGPU] Update isLegalAddressingMode for GFX12 SMEM loads (#78728)

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index d60f511302613e1..6b0ce7b21bdd1f5 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -1534,13 +1534,14 @@ bool SITargetLowering::isLegalAddressingMode(const DataLayout &DL,
     if (AM.BaseOffs % 4 != 0)
       return isLegalMUBUFAddressingMode(AM);
 
-    // There are no SMRD extloads, so if we have to do a small type access we
-    // will use a MUBUF load.
-    // FIXME?: We also need to do this if unaligned, but we don't know the
-    // alignment here.
-    // TODO: Update this for GFX12 which does have scalar sub-dword loads.
-    if (Ty->isSized() && DL.getTypeStoreSize(Ty) < 4)
-      return isLegalGlobalAddressingMode(AM);
+    if (!Subtarget->hasScalarSubwordLoads()) {
+      // There are no SMRD extloads, so if we have to do a small type access we
+      // will use a MUBUF load.
+      // FIXME?: We also need to do this if unaligned, but we don't know the
+      // alignment here.
+      if (Ty->isSized() && DL.getTypeStoreSize(Ty) < 4)
+        return isLegalGlobalAddressingMode(AM);
+    }
 
     if (Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS) {
       // SMRD instructions have an 8-bit, dword offset on SI.


        


More information about the llvm-commits mailing list