When the offset doesn't fit in the immediate field, move some to
voffset.
Details
Diff Detail
Event Timeline
llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp | ||
---|---|---|
1830–1831 | This todo is not relevant anymore. | |
1836 | If you have several consequtive loads this logic will result in reinitialization of vaddr before each load. You could probably mask few low bits in MaxOffset for this purpose to create a window of instructions which can use the same base registers. |
llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp | ||
---|---|---|
1836 | I copied this from the new splitting logic in 760af7a0743278b6dd7782b177f4d6d086c726e0. This won't be re-initialized since in the common case the common base part will CSE |
llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp | ||
---|---|---|
1836 | Yeah, I understand it is a copy. I had the same sentiment while looking at it earlier. If you have a same base it will be resused. But then if you have an address different by 4 bytes these 4 bytes will go to register and immediate will be MaxOffset, right? Also since this is a copy it makes sense to factor it into an utility function. |
llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp | ||
---|---|---|
1834 | I would add && COffsetVal >= 0. I don't think there's any point trying this for large negative offsets, because it will always fail at the isUint<32> check below. That will simplify the code because you don't need to bother with the "signed division by a power of two" thing. |
LGTM, although I think we need to look into consecutive addressing which will always use max imm offset and reinitialize base. This problem is pre-existing though.
This todo is not relevant anymore.