[llvm] [AMDGPU] ISel for @llvm.amdgcn.cs.chain intrinsic (PR #68186)
Nicolai Hähnle via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 10:50:06 PDT 2023
================
@@ -1283,6 +1293,23 @@ bool AMDGPUCallLowering::lowerTailCall(
MIRBuilder.buildInstr(AMDGPU::ADJCALLSTACKDOWN).addImm(NumBytes).addImm(0);
}
+ // If this is a chain call, we need to set EXEC right before the call.
+ if (AMDGPU::isChainCC(Info.CallConv)) {
+ ArgInfo ExecArg = Info.OrigArgs[1];
+ assert(ExecArg.Regs.size() == 1 && "Too many regs for EXEC");
+
+ if (!ExecArg.Ty->isIntegerTy(ST.getWavefrontSize()))
+ return false;
+
+ unsigned MovOpc = ST.isWave32() ? AMDGPU::S_MOV_B32 : AMDGPU::S_MOV_B64;
+ MCRegister Exec = TRI->getExec();
+ auto SetExec =
+ MIRBuilder.buildInstr(MovOpc).addDef(Exec).addReg(ExecArg.Regs[0]);
----------------
nhaehnle wrote:
That seems like a fair point, well spotted. Generally, EXEC modifications are dicey. Not sure, but perhaps this can somehow be integrated into the main call instruction and then expanded later?
https://github.com/llvm/llvm-project/pull/68186
More information about the llvm-commits
mailing list