Skip to content

Commit

Permalink
[AMDGPU] ISel for llvm.amdgcn.set.inactive.chain.arg
Browse files Browse the repository at this point in the history
Add patterns to select int_amdgcn_set_inactive_chain_arg to
V_SET_INACTIVE.

This could probably use some more testing, but at least for simple cases
V_SET_INACTIVE seems to mostly work out of the box.

Differential Revision: https://reviews.llvm.org/D158605
  • Loading branch information
rovka committed Nov 8, 2023
1 parent 4f51b2b commit 3b905a0
Show file tree
Hide file tree
Showing 3 changed files with 521 additions and 0 deletions.
1 change: 1 addition & 0 deletions llvm/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4309,6 +4309,7 @@ AMDGPURegisterBankInfo::getInstrMapping(const MachineInstr &MI) const {
case Intrinsic::amdgcn_wqm:
case Intrinsic::amdgcn_softwqm:
case Intrinsic::amdgcn_set_inactive:
case Intrinsic::amdgcn_set_inactive_chain_arg:
case Intrinsic::amdgcn_permlane64:
return getDefaultMappingAllVGPR(MI);
case Intrinsic::amdgcn_cvt_pkrtz:
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/Target/AMDGPU/SIInstructions.td
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ def V_SET_INACTIVE_B64 : VPseudoInstSI <(outs VReg_64:$vdst),
}
} // End Defs = [SCC]

def : GCNPat<(i32 (int_amdgcn_set_inactive_chain_arg i32:$src, i32:$inactive)),
(V_SET_INACTIVE_B32 VGPR_32:$src, VGPR_32:$inactive)>;

def : GCNPat<(i64 (int_amdgcn_set_inactive_chain_arg i64:$src, i64:$inactive)),
(V_SET_INACTIVE_B64 VReg_64:$src, VReg_64:$inactive)>;

let usesCustomInserter = 1, hasSideEffects = 0, mayLoad = 0, mayStore = 0, Uses = [EXEC] in {
def WAVE_REDUCE_UMIN_PSEUDO_U32 : VPseudoInstSI <(outs SGPR_32:$sdst),
(ins VSrc_b32: $src, VSrc_b32:$strategy),
Expand Down
Loading

0 comments on commit 3b905a0

Please sign in to comment.