[AMDGPU] Don't select _SGPR forms of SMEM instructions on GFX9+
authorJay Foad <jay.foad@amd.com>
Fri, 10 Mar 2023 14:14:06 +0000 (14:14 +0000)
committerJay Foad <jay.foad@amd.com>
Mon, 17 Apr 2023 15:23:30 +0000 (16:23 +0100)
commit2be31896013dd316e10e6cb36321deb62d26e8f7
tree720f99e7e248287b3ca974f6465346fd87e20853
parent9679b635002975de8454b293f06223ece66a154a
[AMDGPU] Don't select _SGPR forms of SMEM instructions on GFX9+

On GFX9+, SMEM instructions have an _SGPR_IMM form which is strictly
more powerful than the _SGPR form. It simplifies codegen if we always
select the _SGPR_IMM form with an immediate offset of 0 instead of the
_SGPR form.

Note that this patch just makes minimal changes to the selection
patterns to prove the concept. Further simplifications are possible to
reduced the number of selection patterns.

On GFX9 the _SGPR form of the Real instruction is still required for
assembly/disassembly but on GFX10+ it can be removed completely.

Differential Revision: https://reviews.llvm.org/D147334
llvm/lib/Target/AMDGPU/AMDGPU.td
llvm/lib/Target/AMDGPU/SMInstructions.td
llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-load-constant.mir
llvm/test/CodeGen/AMDGPU/GlobalISel/inst-select-load-smrd.mir
llvm/test/CodeGen/AMDGPU/amdgcn-load-offset-from-reg.ll
llvm/test/CodeGen/AMDGPU/smrd-gfx10.ll
llvm/test/CodeGen/AMDGPU/splitkit-getsubrangeformask.ll