[llvm] [AMDGPU] Select S_CSELECT_B32/64 for uniform extensions from i1 (PR #204238)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 24 05:00:27 PDT 2026
================
@@ -8687,14 +8687,30 @@ void SIInstrInfo::lowerSelect(SIInstrWorklist &Worklist, MachineInstr &Inst,
Register CondReg = Cond.getReg();
bool IsSCC = (CondReg == AMDGPU::SCC);
- // If this is a trivial select where the condition is effectively not SCC
- // (CondReg is a source of copy to SCC), then the select is semantically
- // equivalent to copying CondReg. Hence, there is no need to create
- // V_CNDMASK, we can just use that and bail out.
+ // Remove S_CSELECT instructions that we previously inserted to feed the SCC
+ // condition output from S_CMP into the SGPR condition input of V_CNDMASK. If
+ // the S_CMP has been promoted to V_CMP then we can feed its SGPR condition
+ // output directly into the V_CNDMASK.
if (!IsSCC && Src0.isImm() && (Src0.getImm() == -1) && Src1.isImm() &&
(Src1.getImm() == 0)) {
- MRI.replaceRegWith(Dest.getReg(), CondReg);
----------------
arsenm wrote:
The problem was the result had `$scc = COPY %0:sreg_64_exec` due to instremitter's register class logic
https://github.com/llvm/llvm-project/pull/204238
More information about the llvm-commits
mailing list