[llvm] [AMDGPU] Account for existing SDWA selections (PR #123221)

Frederik Harwath via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 12 10:11:12 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.

https://github.com/llvm/llvm-project/pull/123221


More information about the llvm-commits mailing list