[llvm] unpack packed instructions overlapped by MFMAs post-RA scheduling (PR #157968)
Jan Patrick Lehr via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 11 07:14:31 PDT 2025
================
@@ -39,6 +48,37 @@ class SIPreEmitPeephole {
const MachineBasicBlock &From,
const MachineBasicBlock &To) const;
bool removeExeczBranch(MachineInstr &MI, MachineBasicBlock &SrcMBB);
+ // Check if the machine instruction being processed is a supported packed
+ // instruction
+ bool isUnpackingSupportedInstr(MachineInstr &MI) const;
+ // Creates a list of packed instructions following an MFMA that are suitable
+ // for unpacking.
+ void createListOfPackedInstr(MachineInstr &BeginMI,
+ SetVector<MachineInstr *> &InstrsToUnpack,
+ uint16_t NumMFMACycles);
+ // Identify register dependencies between those used by the MFMA
+ // instruction and the following packed instructions. Conservatively ensures
+ // that we do not incorrectly read/write registers.
+ bool hasReadWriteDependencies(const MachineInstr &PredMI,
+ const MachineInstr &SuccMI);
+ // Unpack F32 packed instructions, such as V_PK_MUL, V_PK_ADD, and V_PK_FMA.
+ // Currently, only V_PK_MUL, V_PK_ADD, V_PK_FMA are supported for this
+ // transformation.
+ void processF32Unpacking(MachineInstr &I);
+ // Insert appropriate unpacked instructions into the BB
+ void insertUnpackedF32MI(MachineInstr &I, bool IsFMA);
+ // Select corresponding unpacked instruction from packed instruction as input
+ uint16_t mapToUnpackedOpcode(MachineInstr &I);
+ // Creates the unpacked instruction to be inserted. Adds source modifiers to
+ // the unpacked instructions based on the source modifiers in the packed
+ // instruction
+ MachineInstrBuilder createUnpackedMI(MachineBasicBlock &MBB, MachineInstr &I,
+ const DebugLoc &DL,
+ uint16_t UnpackedOpcode, bool IsHiBits,
+ bool IsFMA);
+ void addOperandandMods(MachineInstrBuilder NewMI, unsigned Src_Mods,
----------------
jplehr wrote:
```suggestion
void addOperandAndMods(MachineInstrBuilder NewMI, unsigned Src_Mods,
```
Is this worth adding comment too?
https://github.com/llvm/llvm-project/pull/157968
More information about the llvm-commits
mailing list