[llvm] [AMDGPU] Account for existing SDWA selections (PR #123221)
Frederik Harwath via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 14 06:14:45 PST 2025
================
@@ -108,6 +111,42 @@ class SDWAOperand {
MachineOperand *getReplacedOperand() const { return Replaced; }
MachineInstr *getParentInst() const { return Target->getParent(); }
+ /// Combine an SDWA instruction's existing SDWA selection \p
+ /// ExistingSel with the SDWA selection \p OpSel of its operand. If
+ /// the selections are compatible, return the combined selection,
+ /// otherwise return a nullopt. For example, if we have ExistingSel
+ /// = BYTE_0 Sel and FoldedSel WORD_1 Sel:
+ /// BYTE_0 Sel (WORD_1 Sel (%X)) -> BYTE_2 Sel (%X)
+ std::optional<SdwaSel> combineSdwaSel(SdwaSel ExistingSel,
----------------
frederik-h wrote:
> @arsenm @jrbyrnes Working on the test cases that @arsenm requested, I realized that this approach does not really work as I thought. I'll work a bit more on the tests tomorrow and see how to fix that.
I got confused by the role of the different instructions when adding the early checks for compatibility of the selections. I have now moved the checks to the places which modify the `PotentialMatches` which (as @jrbyrnes essentially suggested initially) is the right place to do it.
https://github.com/llvm/llvm-project/pull/123221
More information about the llvm-commits
mailing list