OSDN Git Service

[AMDGPU] Fix for negative offsets in buffer/tbuffer intrinsics
authorTim Renouf <tpr.llvm@botech.co.uk>
Wed, 3 Oct 2018 10:29:43 +0000 (10:29 +0000)
committerTim Renouf <tpr.llvm@botech.co.uk>
Wed, 3 Oct 2018 10:29:43 +0000 (10:29 +0000)
commit5c738478d09ac1b68102bd6a7b8a548f24f4a877
treeb1fc15aa4eb2d8465905ae72aeae90f1acd2ba24
parent2b610ad483765810c7ae4e7563f4810d0631e804
[AMDGPU] Fix for negative offsets in buffer/tbuffer intrinsics

Summary:
The new buffer/tbuffer intrinsics handle an out-of-range immediate
offset by moving/adding offset&-4096 to a vgpr, leaving an in-range
immediate offset, with a chance of the move/add being CSEd for similar
loads/stores.

However it turns out that a negative offset in a vgpr is illegal, even
if adding the immediate offset makes it legal again.

Therefore, this commit disables the offset&-4096 thing if the offset is
negative.

Differential Revision: https://reviews.llvm.org/D52683

Change-Id: Ie02f0a74f240a138dc2a29d17cfbd9e350e4ed13

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343672 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AMDGPU/SIISelLowering.cpp
test/CodeGen/AMDGPU/llvm.amdgcn.raw.buffer.load.ll
test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.load.ll