diff options
author | Dmitry Venikov <quolyk@gmail.com> | 2019-02-04 10:32:07 +0000 |
---|---|---|
committer | Dmitry Venikov <quolyk@gmail.com> | 2019-02-04 10:32:07 +0000 |
commit | 3643cbbf9ca1c69b94b604620c1e6f4debab5c88 (patch) | |
tree | 7bb30a1af10d965ac29fcf84229f43cfdcf27098 /llvm | |
parent | 09802f41ccd9f8119bbcf80047962ab855f2b017 (diff) | |
download | bcm5719-llvm-3643cbbf9ca1c69b94b604620c1e6f4debab5c88.tar.gz bcm5719-llvm-3643cbbf9ca1c69b94b604620c1e6f4debab5c88.zip |
Commit tests for changes in revision D41608
llvm-svn: 353037
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/test/Transforms/InstCombine/fmul-pow.ll | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fmul-pow.ll b/llvm/test/Transforms/InstCombine/fmul-pow.ll new file mode 100644 index 00000000000..c85994cea71 --- /dev/null +++ b/llvm/test/Transforms/InstCombine/fmul-pow.ll @@ -0,0 +1,91 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py +; RUN: opt -S -instcombine < %s | FileCheck %s + +declare double @llvm.pow.f64(double, double) + +define double @pow_ab_a(double %a, double %b) { +; CHECK-LABEL: @pow_ab_a( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.pow.f64(double [[A:%.*]], double [[B:%.*]]) +; CHECK-NEXT: [[MUL:%.*]] = fmul double [[TMP1]], [[A]] +; CHECK-NEXT: ret double [[MUL]] +; + %1 = call double @llvm.pow.f64(double %a, double %b) + %mul = fmul double %1, %a + ret double %mul +} + +define double @pow_ab_a_reassoc(double %a, double %b) { +; CHECK-LABEL: @pow_ab_a_reassoc( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.pow.f64(double [[A:%.*]], double [[B:%.*]]) +; CHECK-NEXT: [[MUL:%.*]] = fmul reassoc double [[TMP1]], [[A]] +; CHECK-NEXT: ret double [[MUL]] +; + %1 = call double @llvm.pow.f64(double %a, double %b) + %mul = fmul reassoc double %1, %a + ret double %mul +} + +define double @pow_ab_a_reassoc_commute(double %a, double %b) { +; CHECK-LABEL: @pow_ab_a_reassoc_commute( +; CHECK-NEXT: [[TMP1:%.*]] = fdiv double 1.000000e+00, [[A:%.*]] +; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.pow.f64(double [[A]], double [[B:%.*]]) +; CHECK-NEXT: [[MUL:%.*]] = fmul reassoc double [[TMP1]], [[TMP2]] +; CHECK-NEXT: ret double [[MUL]] +; + %1 = fdiv double 1.0, %a + %2 = call double @llvm.pow.f64(double %a, double %b) + %mul = fmul reassoc double %1, %2 + ret double %mul +} + +define double @pow_ab_pow_cb(double %a, double %b, double %c) { +; CHECK-LABEL: @pow_ab_pow_cb( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.pow.f64(double [[A:%.*]], double [[B:%.*]]) +; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.pow.f64(double [[C:%.*]], double [[B]]) +; CHECK-NEXT: [[MUL:%.*]] = fmul double [[TMP2]], [[TMP1]] +; CHECK-NEXT: ret double [[MUL]] +; + %1 = call double @llvm.pow.f64(double %a, double %b) + %2 = call double @llvm.pow.f64(double %c, double %b) + %mul = fmul double %2, %1 + ret double %mul +} + +define double @pow_ab_pow_cb_reassoc(double %a, double %b, double %c) { +; CHECK-LABEL: @pow_ab_pow_cb_reassoc( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.pow.f64(double [[A:%.*]], double [[B:%.*]]) +; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.pow.f64(double [[C:%.*]], double [[B]]) +; CHECK-NEXT: [[MUL:%.*]] = fmul reassoc double [[TMP2]], [[TMP1]] +; CHECK-NEXT: ret double [[MUL]] +; + %1 = call double @llvm.pow.f64(double %a, double %b) + %2 = call double @llvm.pow.f64(double %c, double %b) + %mul = fmul reassoc double %2, %1 + ret double %mul +} + +define double @pow_ab_pow_ac(double %a, double %b, double %c) { +; CHECK-LABEL: @pow_ab_pow_ac( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.pow.f64(double [[A:%.*]], double [[B:%.*]]) +; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.pow.f64(double [[A]], double [[C:%.*]]) +; CHECK-NEXT: [[MUL:%.*]] = fmul double [[TMP2]], [[TMP1]] +; CHECK-NEXT: ret double [[MUL]] +; + %1 = call double @llvm.pow.f64(double %a, double %b) + %2 = call double @llvm.pow.f64(double %a, double %c) + %mul = fmul double %2, %1 + ret double %mul +} + +define double @pow_ab_x_pow_ac_reassoc(double %a, double %b, double %c) { +; CHECK-LABEL: @pow_ab_x_pow_ac_reassoc( +; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.pow.f64(double [[A:%.*]], double [[B:%.*]]) +; CHECK-NEXT: [[TMP2:%.*]] = call double @llvm.pow.f64(double [[A]], double [[C:%.*]]) +; CHECK-NEXT: [[MUL:%.*]] = fmul reassoc double [[TMP2]], [[TMP1]] +; CHECK-NEXT: ret double [[MUL]] +; + %1 = call double @llvm.pow.f64(double %a, double %b) + %2 = call double @llvm.pow.f64(double %a, double %c) + %mul = fmul reassoc double %2, %1 + ret double %mul +} |