diff options
Diffstat (limited to 'llvm/test/Transforms/SimplifyLibCalls/Pow.ll')
-rw-r--r-- | llvm/test/Transforms/SimplifyLibCalls/Pow.ll | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyLibCalls/Pow.ll b/llvm/test/Transforms/SimplifyLibCalls/Pow.ll new file mode 100644 index 00000000000..df7d46004af --- /dev/null +++ b/llvm/test/Transforms/SimplifyLibCalls/Pow.ll @@ -0,0 +1,23 @@ +; Testcase for calls to the standard C "pow" function +; +; Equivalent to: http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01786.html +; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls -disable-output && +; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | not grep 'call double .pow' + +declare double %pow(double, double) + +double %test1(double %X) { + %Y = call double %pow(double %X, double 0.0) + ret double %Y ; x^0.0 always equals 1.0 +} + +double %test2(double %X) { + %Y = call double %pow(double %X, double -0.0) + ret double %Y ; x^-0.0 always equals 1.0 +} + +double %test3(double %X) { + %Y = call double %pow(double 1.0, double %X) + ret double %Y ; 1.0^x always equals 1.0 +} + |