[llvm] AMDGPU: Implement MC layer support for gfx1250 wmma instructions. (PR #148570)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 13 23:58:44 PDT 2025


================
@@ -3260,6 +3260,47 @@ bool AMDGPUDAGToDAGISel::SelectVOP3PModsNeg(SDValue In, SDValue &Src) const {
   return true;
 }
 
+// Select both neg_lo and neg_hi from the i1 immediate operand. This is
+// specifically for F16/BF16 operands in WMMA instructions, where neg_lo applies
+// to matrix's even k elements, and neg_hi applies to matrix's odd k elements.
+bool AMDGPUDAGToDAGISel::SelectVOP3PModsNegs(SDValue In, SDValue &Src) const {
+  const ConstantSDNode *C = cast<ConstantSDNode>(In);
+  // Literal i1 value set in intrinsic, represents SrcMods for the next operand.
+  // 1 promotes packed values to signed, 0 treats them as unsigned.
+  assert(C->getAPIntValue().getBitWidth() == 1 && "expected i1 value");
+
+  unsigned Mods = SISrcMods::OP_SEL_1;
+  unsigned SrcSign = C->getZExtValue();
----------------
arsenm wrote:

Safer to check !C->isNullValue() and drop the assert?

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


More information about the llvm-commits mailing list