The immediate offset of flat instructions is signed for the global_
and scratch_ variants and unsigned for the flat_ variant.
We can deduce the signdness of the offset automatically from the address
space instead of passing it through everywhere.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This isn't a property of the address space, but of the instruction. You can use flat instructions to access global address space. You cannot go backwards this way
We already use this connection in SIInstrInfo::isLegalFLATOffset, there is a check for ST.hasFlatSegmentOffsetBug() && AddrSpace == AMDGPUAS::FLAT_ADDRESS. I guess this is already broken then.
Is there a good way to find the instruction variant (global, scratch or flat) from the instruction (or intrinsic) or do we need to pass this through everywhere?
Yeah, that's wrong
Is there a good way to find the instruction variant (global, scratch or flat) from the instruction (or intrinsic) or do we need to pass this through everywhere?
Something directly from the instruction should work, but that won't help you in the pattern matching contexts