Skip to content

Commit c7cae27

Browse files
author
Salinas, David
authored
[AMDGPU]: Unpack packed instructions overlapped by MFMAs post-RA sche… (llvm#4382)
2 parents 5065ac8 + abbb17f commit c7cae27

File tree

5 files changed

+1589
-13
lines changed

5 files changed

+1589
-13
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6204,6 +6204,66 @@ bool SIInstrInfo::isOperandLegal(const MachineInstr &MI, unsigned OpIdx,
62046204
return isImmOperandLegal(MI, OpIdx, *MO);
62056205
}
62066206

6207+
bool SIInstrInfo::isNeverCoissue(MachineInstr &MI) const {
6208+
bool IsGFX950Only = ST.hasGFX950Insts();
6209+
bool IsGFX940Only = ST.hasGFX940Insts();
6210+
6211+
if (!IsGFX950Only && !IsGFX940Only)
6212+
return false;
6213+
6214+
if (!isVALU(MI))
6215+
return false;
6216+
6217+
// V_COS, V_EXP, V_RCP, etc.
6218+
if (isTRANS(MI))
6219+
return true;
6220+
6221+
// DOT2, DOT2C, DOT4, etc.
6222+
if (isDOT(MI))
6223+
return true;
6224+
6225+
// MFMA, SMFMA
6226+
if (isMFMA(MI))
6227+
return true;
6228+
6229+
unsigned Opcode = MI.getOpcode();
6230+
switch (Opcode) {
6231+
case AMDGPU::V_CVT_PK_BF8_F32_e64:
6232+
case AMDGPU::V_CVT_PK_FP8_F32_e64:
6233+
case AMDGPU::V_MQSAD_PK_U16_U8_e64:
6234+
case AMDGPU::V_MQSAD_U32_U8_e64:
6235+
case AMDGPU::V_PK_ADD_F16:
6236+
case AMDGPU::V_PK_ADD_F32:
6237+
case AMDGPU::V_PK_ADD_I16:
6238+
case AMDGPU::V_PK_ADD_U16:
6239+
case AMDGPU::V_PK_ASHRREV_I16:
6240+
case AMDGPU::V_PK_FMA_F16:
6241+
case AMDGPU::V_PK_FMA_F32:
6242+
case AMDGPU::V_PK_FMAC_F16_e32:
6243+
case AMDGPU::V_PK_FMAC_F16_e64:
6244+
case AMDGPU::V_PK_LSHLREV_B16:
6245+
case AMDGPU::V_PK_LSHRREV_B16:
6246+
case AMDGPU::V_PK_MAD_I16:
6247+
case AMDGPU::V_PK_MAD_U16:
6248+
case AMDGPU::V_PK_MAX_F16:
6249+
case AMDGPU::V_PK_MAX_I16:
6250+
case AMDGPU::V_PK_MAX_U16:
6251+
case AMDGPU::V_PK_MIN_F16:
6252+
case AMDGPU::V_PK_MIN_I16:
6253+
case AMDGPU::V_PK_MIN_U16:
6254+
case AMDGPU::V_PK_MOV_B32:
6255+
case AMDGPU::V_PK_MUL_F16:
6256+
case AMDGPU::V_PK_MUL_F32:
6257+
case AMDGPU::V_PK_MUL_LO_U16:
6258+
case AMDGPU::V_PK_SUB_I16:
6259+
case AMDGPU::V_PK_SUB_U16:
6260+
case AMDGPU::V_QSAD_PK_U16_U8_e64:
6261+
return true;
6262+
default:
6263+
return false;
6264+
}
6265+
}
6266+
62076267
void SIInstrInfo::legalizeOperandsVOP2(MachineRegisterInfo &MRI,
62086268
MachineInstr &MI) const {
62096269
unsigned Opc = MI.getOpcode();

llvm/lib/Target/AMDGPU/SIInstrInfo.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,10 @@ class SIInstrInfo final : public AMDGPUGenInstrInfo {
11731173

11741174
bool isImmOperandLegal(const MachineInstr &MI, unsigned OpNo,
11751175
const MachineOperand &MO) const;
1176+
bool isNeverCoissue(MachineInstr &MI) const;
1177+
1178+
/// Check if this immediate value can be used for AV_MOV_B64_IMM_PSEUDO.
1179+
bool isLegalAV64PseudoImm(uint64_t Imm) const;
11761180

11771181
/// Return true if this 64-bit VALU instruction has a 32-bit encoding.
11781182
/// This function will return false if you pass it a 32-bit instruction.

0 commit comments

Comments
 (0)