AMDGPU/GlobalISel: Add integer med3 combines
authorPetar Avramovic <Petar.Avramovic@amd.com>
Tue, 27 Apr 2021 09:51:22 +0000 (11:51 +0200)
committerPetar Avramovic <Petar.Avramovic@amd.com>
Tue, 27 Apr 2021 09:52:23 +0000 (11:52 +0200)
commit4a9bc59867b64a24ff628c5a7ab2ca5e727dd9c1
treea3dab5e0fa108fe5c2ac93e3566d3e30608d65c4
parent646b007d1128143ecbe1fee28d81b613cbbe031e
AMDGPU/GlobalISel: Add integer med3 combines

Add signed and unsigned integer version of med3 combine.
Source pattern is min(max(Val, K0), K1) or max(min(Val, K1), K0)
where K0 and K1 are constants and K0 <= K1. Destination is med3
that corresponds to signedness of min/max in source.

Differential Revision: https://reviews.llvm.org/D90050
llvm/lib/Target/AMDGPU/AMDGPUCombine.td
llvm/lib/Target/AMDGPU/AMDGPUGISel.td
llvm/lib/Target/AMDGPU/AMDGPUPreLegalizerCombiner.cpp
llvm/lib/Target/AMDGPU/AMDGPURegBankCombiner.cpp
llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
llvm/lib/Target/AMDGPU/SIInstructions.td
llvm/test/CodeGen/AMDGPU/GlobalISel/regbankcombiner-smed3.mir [new file with mode: 0644]
llvm/test/CodeGen/AMDGPU/GlobalISel/regbankcombiner-umed3.mir [new file with mode: 0644]
llvm/test/CodeGen/AMDGPU/GlobalISel/smed3.ll [new file with mode: 0644]
llvm/test/CodeGen/AMDGPU/GlobalISel/umed3.ll [new file with mode: 0644]