Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | ; Testcase for calls to the standard C "pow" function |
| 2 | ; |
Dan Gohman | 3c7d308 | 2009-09-11 18:01:28 +0000 | [diff] [blame] | 3 | ; RUN: opt < %s -simplify-libcalls -S | not grep {call .pow} |
Chris Lattner | 89c3e3d | 2008-04-09 00:07:45 +0000 | [diff] [blame] | 4 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 5 | |
Tanya Lattner | 003eae5 | 2008-03-10 07:21:50 +0000 | [diff] [blame] | 6 | declare double @pow(double, double) |
Chris Lattner | 89c3e3d | 2008-04-09 00:07:45 +0000 | [diff] [blame] | 7 | declare float @powf(float, float) |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 8 | |
Tanya Lattner | 003eae5 | 2008-03-10 07:21:50 +0000 | [diff] [blame] | 9 | define double @test1(double %X) { |
| 10 | %Y = call double @pow( double %X, double 0.000000e+00 ) ; <double> [#uses=1] |
| 11 | ret double %Y |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 12 | } |
| 13 | |
Tanya Lattner | 003eae5 | 2008-03-10 07:21:50 +0000 | [diff] [blame] | 14 | define double @test2(double %X) { |
| 15 | %Y = call double @pow( double %X, double -0.000000e+00 ) ; <double> [#uses=1] |
| 16 | ret double %Y |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 17 | } |
| 18 | |
Tanya Lattner | 003eae5 | 2008-03-10 07:21:50 +0000 | [diff] [blame] | 19 | define double @test3(double %X) { |
| 20 | %Y = call double @pow( double 1.000000e+00, double %X ) ; <double> [#uses=1] |
| 21 | ret double %Y |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 22 | } |
| 23 | |
Chris Lattner | 89c3e3d | 2008-04-09 00:07:45 +0000 | [diff] [blame] | 24 | define double @test4(double %X) { |
| 25 | %Y = call double @pow( double %X, double 2.0) |
| 26 | ret double %Y |
| 27 | } |
| 28 | |
| 29 | define float @test4f(float %X) { |
| 30 | %Y = call float @powf( float %X, float 2.0) |
| 31 | ret float %Y |
| 32 | } |
Chris Lattner | 184b84e | 2008-04-09 17:48:11 +0000 | [diff] [blame] | 33 | |
| 34 | define float @test5f(float %X) { |
| 35 | %Y = call float @powf(float 2.0, float %X) ;; exp2 |
| 36 | ret float %Y |
| 37 | } |