Skip to content

Commit 0c4b16a

Browse files
Introduce readfirstlane if dst reg is sgpr
1 parent 50ca316 commit 0c4b16a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3220,6 +3220,7 @@ SITargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
32203220
const SDLoc &DL, SelectionDAG &DAG) const {
32213221
MachineFunction &MF = DAG.getMachineFunction();
32223222
SIMachineFunctionInfo *Info = MF.getInfo<SIMachineFunctionInfo>();
3223+
const SIRegisterInfo *TRI = getSubtarget()->getRegisterInfo();
32233224

32243225
if (AMDGPU::isKernel(CallConv)) {
32253226
return AMDGPUTargetLowering::LowerReturn(Chain, CallConv, isVarArg, Outs,
@@ -3275,8 +3276,9 @@ SITargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
32753276
default:
32763277
llvm_unreachable("Unknown loc info!");
32773278
}
3278-
Arg = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, DL, Arg.getValueType(),
3279-
ReadFirstLane, Arg);
3279+
if (TRI->isSGPRPhysReg(VA.getLocReg()))
3280+
Arg = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, DL, Arg.getValueType(),
3281+
ReadFirstLane, Arg);
32803282
Chain = DAG.getCopyToReg(Chain, DL, VA.getLocReg(), Arg, Glue);
32813283
Glue = Chain.getValue(1);
32823284
RetOps.push_back(DAG.getRegister(VA.getLocReg(), VA.getLocVT()));

0 commit comments

Comments
 (0)