[AMDGPU] Add A16/G16 to InstCombine
authorSebastian Neubauer <sebastian.neubauer@amd.com>
Thu, 4 Jun 2020 10:22:36 +0000 (12:22 +0200)
committerSebastian Neubauer <sebastian.neubauer@amd.com>
Thu, 20 Aug 2020 08:51:49 +0000 (10:51 +0200)
commitb8d19947782057671b0afd194116b153ccdf2c6d
treeb0597be40bebc0a9bb76bfcd1be4e0c710065c4f
parent7497b861f49629e84be1215b8d2da18898b1097c
[AMDGPU] Add A16/G16 to InstCombine

When sampling from images with coordinates that only have 16 bit
accuracy, convert the image intrinsic call to use a16 or g16.
This does only happen if the target hardware supports it.

An alternative would be to always apply this combination, independent of
the target hardware and extend 16 bit arguments to 32 bit arguments
during legalization. To me, this sounds like an unnecessary roundtrip
that could prevent some further InstCombine optimizations.

Differential Revision: https://reviews.llvm.org/D85887
llvm/include/llvm/IR/IntrinsicsAMDGPU.td
llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
llvm/lib/Target/AMDGPU/AMDGPUInstrInfo.h
llvm/lib/Target/AMDGPU/MIMGInstructions.td
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics-gfx8.ll [new file with mode: 0644]
llvm/test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll