[llvm] 01120fe - [InstCombine] add fmul tests with shared operand; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed May 26 05:32:18 PDT 2021


Author: Sanjay Patel
Date: 2021-05-26T08:32:08-04:00
New Revision: 01120fe5b39837f87e6fa34a5227b8f8634d7b01

URL: https://github.com/llvm/llvm-project/commit/01120fe5b39837f87e6fa34a5227b8f8634d7b01
DIFF: https://github.com/llvm/llvm-project/commit/01120fe5b39837f87e6fa34a5227b8f8634d7b01.diff

LOG: [InstCombine] add fmul tests with shared operand; NFC

Baseline tests for:
D102698

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/fmul-exp.ll
    llvm/test/Transforms/InstCombine/fmul-exp2.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/fmul-exp.ll b/llvm/test/Transforms/InstCombine/fmul-exp.ll
index ee9ee2ab0e25..8e10ebf81234 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 27c9193e013f..e2365105c432 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(


        


More information about the llvm-commits mailing list