[llvm] [AMDGPU] Recognise bitmask operations as srcmods (PR #149110)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 18 04:15:03 PDT 2025


================
@@ -3036,6 +3036,36 @@ bool AMDGPUDAGToDAGISel::SelectVOP3ModsImpl(SDValue In, SDValue &Src,
     Src = Src.getOperand(0);
   }
 
+  // Convert various sign-bit masks to src mods. Currently disabled for 16-bit
+  // types as the codegen replaces the operand without adding a srcmod.
+  // Recognise (xor a, 0x80000000) as NEG SrcMod.
+  if (Src->getOpcode() == ISD::XOR &&
+      Src.getValueType().getFixedSizeInBits() != 16)
----------------
arsenm wrote:

I'd have to double check gfx11/true16 but this probably works with the 16-bit case there. But generally positively checking the cases you do support, rather than the ones you do not, is safer 

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


More information about the llvm-commits mailing list