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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 01:11:11 PST 2025


================
@@ -451,13 +497,33 @@ bool SDWASrcOperand::convertToSDWA(MachineInstr &MI, const SIInstrInfo *TII) {
   }
   copyRegOperand(*Src, *getTargetOperand());
   if (!IsPreserveSrc) {
-    SrcSel->setImm(getSrcSel());
+    SdwaSel ExistingSel = static_cast<SdwaSel>(SrcSel->getImm());
+    SrcSel->setImm(combineSdwaSel(ExistingSel, getSrcSel()).value());
----------------
arsenm wrote:

```suggestion
    SrcSel->setImm(*combineSdwaSel(ExistingSel, getSrcSel()));
```

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


More information about the llvm-commits mailing list