[llvm] [AMDGPU] Implement getAddrSpaceCastPreservedPtrMask (PR #182658)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 28 00:22:41 PDT 2026
================
@@ -207,6 +207,30 @@ class GCNTTIImpl final : public BasicTTIImplBase<GCNTTIImpl> {
return AMDGPUAS::FLAT_ADDRESS;
}
+ APInt getAddrSpaceCastPreservedPtrMask(unsigned SrcAS,
+ unsigned DstAS) const override {
+ // Only handle casts from flat (generic) address space.
+ if (SrcAS != AMDGPUAS::FLAT_ADDRESS)
+ return BaseT::getAddrSpaceCastPreservedPtrMask(SrcAS, DstAS);
+
+ unsigned FlatPtrSize = DL.getPointerSizeInBits(AMDGPUAS::FLAT_ADDRESS);
+
+ // For global, addresses in flat and global address spaces are the same -
+ // no conversion is needed. Global memory regions are architecturally
+ // separate from the private/local aperture regions (which are 2^32-aligned
+ // and use specific high-address ranges), so all 64 bits are preserved.
+ if (DstAS == AMDGPUAS::GLOBAL_ADDRESS)
----------------
addmisol wrote:
Yeah sure, will add these
Also confirmed in the [doc](https://llvm.org/docs/AMDGPUUsage.html)
https://github.com/llvm/llvm-project/pull/182658
More information about the llvm-commits
mailing list