[llvm] [DAG] Constant fold ISD::FSHL/FSHR nodes (PR #154480)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 21 11:14:56 PDT 2025


================
@@ -8158,6 +8180,12 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, EVT VT,
     }
     break;
   }
+  case ISD::FSHL:
+  case ISD::FSHR:
+    // Constant folding.
+    if (SDValue V = FoldConstantArithmetic(Opcode, DL, VT, {N1, N2, N3}))
+      return V;
+    break;
----------------
XChy wrote:

> Cheers - ideally we can get this deal with so we can pull out the constant folding ISD::FMA/FMAD as well.

Sorry for not noticing this response. What do you mean by "pull out the constant folding ISD::FMA/FMAD"? Is it moving the fold in `getNode` to `FoldConstantArithmetic`?

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


More information about the llvm-commits mailing list