[AMDGPU] Handle SMRD signed offset immediate
authorAustin Kerbow <Austin.Kerbow@amd.com>
Mon, 30 Mar 2020 06:32:20 +0000 (23:32 -0700)
committerAustin Kerbow <Austin.Kerbow@amd.com>
Fri, 3 Apr 2020 00:41:52 +0000 (17:41 -0700)
commit30f18ed387c128a12fc1027c066c2f81b6d55fce
treec2b8543fb6548962df374a48662ee8eb71bd2d6f
parent93fe58c9cf532d8ddb166d8d00667707bc017ed7
[AMDGPU] Handle SMRD signed offset immediate

Summary:
This fixes a few issues related to SMRD offsets. On gfx9 and gfx10 we have a
signed byte offset immediate, however we can overflow into a negative since we
treat it as unsigned.

Also, the SMRD SOFFSET sgpr is an unsigned offset on all subtargets. We
sometimes tried to use negative values here.

Third, S_BUFFER instructions should never use a signed offset immediate.

Differential Revision: https://reviews.llvm.org/D77082
llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp
llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
llvm/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h
llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-load-constant.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/smrd.ll
llvm/test/CodeGen/AMDGPU/smrd.ll