[llvm] [AMDGPU][GlobalIsel] Add RegBankLegalize rules and lowering for G_AMDGPU_S_BUFFER_LOAD (PR #192480)

Abhinav Garg via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 23:53:42 PDT 2026


================
@@ -7497,6 +7497,11 @@ bool AMDGPULegalizerInfo::legalizeSBufferLoad(LegalizerHelper &Helper,
     // The 8-bit and 16-bit scalar buffer load instructions have 32-bit
     // destination register.
     Dst = B.getMRI()->createGenericVirtualRegister(LLT::scalar(32));
+  } else if (Size < 32) {
+    // No native sub-dword scalar buffer load on this subtarget. Load a full
+    // dword into a fresh s32 register — s8/s16 are not valid SGPR types.
+    Opc = AMDGPU::G_AMDGPU_S_BUFFER_LOAD;
+    Dst = B.getMRI()->createGenericVirtualRegister(LLT::scalar(32));
----------------
abhigargrepo wrote:

Created a new PR https://github.com/llvm/llvm-project/pull/195800

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


More information about the llvm-commits mailing list