diff --git a/llvm/test/Transforms/InstCombine/fmul-exp.ll b/llvm/test/Transforms/InstCombine/fmul-exp.ll index ee9ee2ab0e25c..8e10ebf812346 100644 --- a/llvm/test/Transforms/InstCombine/fmul-exp.ll +++ b/llvm/test/Transforms/InstCombine/fmul-exp.ll @@ -65,6 +65,32 @@ define double @exp_a_exp_b_reassoc(double %a, double %b) { ret double %mul } +; TODO: Multiple uses, but only 1 user. + +define double @exp_a_a(double %a) { +; CHECK-LABEL: @exp_a_a( +; CHECK-NEXT: [[T:%.*]] = call double @llvm.exp.f64(double [[A:%.*]]) +; CHECK-NEXT: [[M:%.*]] = fmul reassoc double [[T]], [[T]] +; CHECK-NEXT: ret double [[M]] +; + %t = call double @llvm.exp.f64(double %a) + %m = fmul reassoc double %t, %t + ret double %m +} + +define double @exp_a_a_extra_use(double %a) { +; CHECK-LABEL: @exp_a_a_extra_use( +; CHECK-NEXT: [[T:%.*]] = call double @llvm.exp.f64(double [[A:%.*]]) +; CHECK-NEXT: call void @use(double [[T]]) +; CHECK-NEXT: [[M:%.*]] = fmul reassoc double [[T]], [[T]] +; CHECK-NEXT: ret double [[M]] +; + %t = call double @llvm.exp.f64(double %a) + call void @use(double %t) + %m = fmul reassoc double %t, %t + ret double %m +} + ; exp(a) * exp(b) * exp(c) * exp(d) => exp(a+b+c+d) with reassoc define double @exp_a_exp_b_exp_c_exp_d_fast(double %a, double %b, double %c, double %d) { ; CHECK-LABEL: @exp_a_exp_b_exp_c_exp_d_fast( diff --git a/llvm/test/Transforms/InstCombine/fmul-exp2.ll b/llvm/test/Transforms/InstCombine/fmul-exp2.ll index 27c9193e013fe..e2365105c4320 100644 --- a/llvm/test/Transforms/InstCombine/fmul-exp2.ll +++ b/llvm/test/Transforms/InstCombine/fmul-exp2.ll @@ -34,6 +34,19 @@ define double @exp2_a_exp2_b_multiple_uses(double %a, double %b) { ret double %mul } +; TODO: Multiple uses, but only 1 user. + +define double @exp2_a_a(double %a) { +; CHECK-LABEL: @exp2_a_a( +; CHECK-NEXT: [[T:%.*]] = call double @llvm.exp2.f64(double [[A:%.*]]) +; CHECK-NEXT: [[M:%.*]] = fmul reassoc double [[T]], [[T]] +; CHECK-NEXT: ret double [[M]] +; + %t = call double @llvm.exp2.f64(double %a) + %m = fmul reassoc double %t, %t + ret double %m +} + ; exp2(a) * exp2(b) reassoc, both with multiple uses define double @exp2_a_exp2_b_multiple_uses_both(double %a, double %b) { ; CHECK-LABEL: @exp2_a_exp2_b_multiple_uses_both(