[llvm-branch-commits] [llvm] [AMDGPU] Lower loads and stores for address space 13 (PR #209541)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Aug 3 06:13:28 PDT 2026
================
@@ -13169,13 +13170,97 @@ static bool addressMayBeAccessedAsPrivate(const MachineMemOperand *MMO,
return true;
}
+// Lower a load or store of the VGPR ("as memory") address space (13) to a
+// REG_LOAD / REG_STORE target node. The 32-bit pointer is a byte offset into
+// the wave's view of its vector registers; the target node carries the dword
+// index (pointer >> 2). Recognizing a constant dword offset is left to the
+// selection patterns, which fold an (add index, imm) shape into the pseudo.
+//
+// TODO: sub-dword (8/16-bit) accesses are not yet supported; they are
+// diagnosed as unsupported below.
+SDValue SITargetLowering::LowerLoadStoreVGPR(SDValue Op,
+ SelectionDAG &DAG) const {
+ SDLoc DL(Op);
+ MemSDNode *MemOp = cast<MemSDNode>(Op);
+ EVT MemVT = MemOp->getMemoryVT();
+ unsigned BitWidth = MemVT.getSizeInBits();
+
+ // Only whole-dword, non-extending/non-truncating accesses are implemented.
+ // Reject anything else with a diagnostic (replacing the value with poison)
+ // instead of failing instruction selection. Both callers - operation
+ // legalization and the pre-ISel combine - replace the node with this result,
+ // so the diagnostic is emitted exactly once.
+ auto reportUnsupported = [&]() -> SDValue {
+ const Function &F = DAG.getMachineFunction().getFunction();
----------------
arsenm wrote:
There's supposed to be a utility now in SelectionDAG to report unsupported and return an appropriate poison for the type
https://github.com/llvm/llvm-project/pull/209541
More information about the llvm-branch-commits
mailing list