Skip to content

Commit dbe9b29

Browse files
committed
madmixpat update for true16
1 parent 5a5a9e7 commit dbe9b29

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5841,6 +5841,15 @@ 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+
if (Subtarget->UseRealTrue16Insts() && MI->getOpcode() == AMDGPU::G_TRUNC) {
5848+
MO = &MI->getOperand(1);
5849+
Src = MO->getReg();
5850+
MI = getDefIgnoringCopies(Src, *MRI);
5851+
}
5852+
58445853
Matched = true;
58455854
}
58465855

0 commit comments

Comments
 (0)