[llvm] [InstCombine] fold `ldexp(x, zext(i1 y))` to `fmul x, (select y, 2.0, 1.0)` (PR #94887)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 9 12:49:19 PDT 2024
================
@@ -34,6 +34,17 @@ define double @ldexp_zext_double(double %x, i1 %bool) {
ret double %ldexp
}
+define double @ldexp_zext_double_fast_math(double %x, i1 %bool) {
+; CHECK-LABEL: @ldexp_zext_double_fast_math(
+; CHECK-NEXT: [[TMP1:%.*]] = select i1 [[BOOL:%.*]], double 2.000000e+00, double 1.000000e+00
+; CHECK-NEXT: [[LDEXP:%.*]] = fmul fast double [[TMP1]], [[X:%.*]]
+; CHECK-NEXT: ret double [[LDEXP]]
+;
+ %zext = zext i1 %bool to i32
+ %ldexp = call fast double @llvm.ldexp.f32.i32(double %x, i32 %zext)
----------------
arsenm wrote:
The test name says double, the signature says double, but this is using the .f32 intrinsic
https://github.com/llvm/llvm-project/pull/94887
More information about the llvm-commits
mailing list