[llvm] InstCombine: Try to fold ldexp with select of power operand (PR #97354)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 01:28:02 PDT 2024


================
@@ -2641,6 +2641,31 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
       return BinaryOperator::CreateFMulFMF(Src, Select, II);
     }
 
+    // ldexp(x, c ? exp : 0) -> c ? ldexp(x, exp) : x
+    // ldexp(x, c ? 0 : exp) -> c ? x : ldexp(x, exp)
+    ///
----------------
arsenm wrote:

I found it in math library code for scale if out of range 

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


More information about the llvm-commits mailing list