Skip to content

Commit 2a27a85

Browse files
committed
madmixpat update for true16
1 parent bc91acc commit 2a27a85

File tree

5 files changed

+2674
-826
lines changed

5 files changed

+2674
-826
lines changed

llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3651,6 +3651,10 @@ bool AMDGPUDAGToDAGISel::SelectVOP3PMadMixModsImpl(SDValue In, SDValue &Src,
36513651
// TODO: Should we try to look for neg/abs here?
36523652
}
36533653

3654+
// Prevent unnecessary subreg COPY to VGPR_16
3655+
if (Subtarget->useRealTrue16Insts() && Src.getOpcode() == ISD::TRUNCATE) {
3656+
Src = Src.getOperand(0);
3657+
}
36543658
return true;
36553659
}
36563660

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5841,6 +5841,14 @@ AMDGPUInstructionSelector::selectVOP3PMadMixModsImpl(MachineOperand &Root,
58415841
CheckAbsNeg();
58425842
}
58435843

5844+
// Since we looked through FPEXT and removed it, we must also remove
5845+
// G_TRUNC. G_TRUNC to 16-bits would have a destination in RC VGPR_16, which
5846+
// is not compatible with MadMix instructions
5847+
Register PeekSrc = Src;
5848+
if (Subtarget->useRealTrue16Insts() &&
5849+
mi_match(PeekSrc, *MRI, m_GTrunc(m_Reg(PeekSrc))))
5850+
Src = PeekSrc;
5851+
58445852
Matched = true;
58455853
}
58465854

0 commit comments

Comments
 (0)