[llvm] [AMDGPU] Use SDNodeXForm to select a few VOP3P modifiers, NFC (PR #151907)
    Matt Arsenault via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon Aug  4 09:41:42 PDT 2025
    
    
  
================
@@ -908,6 +908,32 @@ def SupportedRoundMode : TImmLeaf<i32, [{
          Imm == (int)RoundingMode::TowardNegative;
 }]>;
 
+def VOP3PModsNeg : SDNodeXForm<timm, [{
+  unsigned Mods = SISrcMods::OP_SEL_1;
+  if (N->getZExtValue())
+    Mods ^= SISrcMods::NEG;
+  return CurDAG->getTargetConstant(Mods, SDLoc(N), MVT::i32);
+}]>;
+
+def VOP3PModsNegs : SDNodeXForm<timm, [{
+  unsigned Mods = SISrcMods::OP_SEL_1;
+  if (N->getZExtValue())
+    Mods ^= (SISrcMods::NEG | SISrcMods::NEG_HI);
+  return CurDAG->getTargetConstant(Mods, SDLoc(N), MVT::i32);
+}]>;
+
+def VOP3PModsNegAbs : SDNodeXForm<timm, [{
+  unsigned Val = N->getZExtValue();
+  unsigned Mods = SISrcMods::OP_SEL_1;
+  if (Val == 1)
----------------
arsenm wrote:
Magic numbers 
https://github.com/llvm/llvm-project/pull/151907
    
    
More information about the llvm-commits
mailing list