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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 20 03:12:11 PDT 2025


================
@@ -6740,6 +6740,18 @@ static std::optional<APInt> FoldValue(unsigned Opcode, const APInt &C1,
   }
   return std::nullopt;
 }
+
+static std::optional<APInt> FoldValue(unsigned Opcode, const APInt &C1,
+                                      const APInt &C2, const APInt &C3) {
+  //switch (Opcode) {
+  //case ISD::FSHL:
+    //return APIntOps::fshl(C1, C2, C3);
+  //case ISD::FSHR:
+    //return APIntOps::fshr(C1, C2, C3);
+  //}
+  return std::nullopt;
----------------
arsenm wrote:

Move the switch directly into the caller? The optional isn't doing much help here, this will succeed or not based only on the opcode 

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


More information about the llvm-commits mailing list