]> granicus.if.org Git - llvm/commit
AMDGPU: Fix MUBUF offset bugs affecting llvm.amdgcn.buffer.* intrinsics
authorNicolai Haehnle <nhaehnle@gmail.com>
Wed, 15 Jun 2016 07:13:05 +0000 (07:13 +0000)
committerNicolai Haehnle <nhaehnle@gmail.com>
Wed, 15 Jun 2016 07:13:05 +0000 (07:13 +0000)
commit682fc3e780e05c2bc038872ce5ed05b13148b841
tree95368d7e898861952a392c6e1fd7a76ea2e0edac
parentd2af64ec39d4f86cb0852939daa703771aec0a2b
AMDGPU: Fix MUBUF offset bugs affecting llvm.amdgcn.buffer.* intrinsics

Summary:
This fixes two related bugs. First, the generic optimization passes
unfortunately generate negative constant offsets but the hardware treats
SOffset as an unsigned value.

Second, there is a hardware bug on SI and CI, where address clamping in MUBUF
instructions does not work correctly when SOffset is larger than the buffer
size. This patch works around this bug by never using SOffset.

An alternative workaround would be to do the clamping manually when SOffset
is too large, but generating the required code sequence during instruction
selection would be rather involved, and in any case the resulting code would
probably be worse.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=96360

Reviewers: arsenm, tstellarAMD

Subscribers: arsenm, llvm-commits, kzhuravl

Differential Revision: http://reviews.llvm.org/D21326

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272761 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
test/CodeGen/AMDGPU/llvm.amdgcn.buffer.atomic.ll
test/CodeGen/AMDGPU/llvm.amdgcn.buffer.load.format.ll
test/CodeGen/AMDGPU/llvm.amdgcn.buffer.load.ll