diff --git a/llvm/test/Regression/Transforms/SimplifyLibCalls/Pow.ll b/llvm/test/Regression/Transforms/SimplifyLibCalls/Pow.ll index 4b10ed077ca7..3b9e48c68e30 100644 --- a/llvm/test/Regression/Transforms/SimplifyLibCalls/Pow.ll +++ b/llvm/test/Regression/Transforms/SimplifyLibCalls/Pow.ll @@ -1,17 +1,23 @@ -; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call.*pow' +; Testcase for calls to the standard C "pow" function +; +; Equivalent to: http://gcc.gnu.org/ml/gcc-patches/2003-02/msg01786.html +; RUN: llvm-as < %s | opt -simplify-libcalls -disable-output && +; RUN: llvm-as < %s | opt -simplify-libcalls | llvm-dis | not grep 'call double .pow' -declare double %pow(double,double) -%fpstorage = global double 5.0 +declare double %pow(double, double) -implementation ; Functions: - -int %main () { - %fpnum = load double* %fpstorage; - %one = call double %pow(double 1.0, double %fpnum) - %two = call double %pow(double %one, double 0.5) - %three = call double %pow(double %two, double 1.0) - %four = call double %pow(double %three, double -1.0) - %five = call double %pow(double %four, double 0.0) - %result = cast double %five to int - ret int %result +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 +} +