Owen Anderson | 3ccd818 | 2010-07-19 08:14:26 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -instcombine %s | FileCheck %s |
| 2 | |
Chris Lattner | 6e27b3e | 2010-09-07 20:01:38 +0000 | [diff] [blame] | 3 | define float @test1(float %x) nounwind readnone ssp { |
Owen Anderson | 3ccd818 | 2010-07-19 08:14:26 +0000 | [diff] [blame] | 4 | entry: |
Chris Lattner | 6e27b3e | 2010-09-07 20:01:38 +0000 | [diff] [blame] | 5 | ; CHECK: @test1 |
| 6 | ; CHECK-NOT: fpext |
| 7 | ; CHECK-NOT: sqrt( |
| 8 | ; CHECK: sqrtf( |
| 9 | ; CHECK-NOT: fptrunc |
| 10 | %conv = fpext float %x to double ; <double> [#uses=1] |
| 11 | %call = tail call double @sqrt(double %conv) readnone nounwind ; <double> [#uses=1] |
| 12 | %conv1 = fptrunc double %call to float ; <float> [#uses=1] |
| 13 | ; CHECK: ret float |
| 14 | ret float %conv1 |
| 15 | } |
| 16 | |
| 17 | declare double @sqrt(double) |
| 18 | |
| 19 | ; PR8096 |
| 20 | define float @test2(float %x) nounwind readnone ssp { |
| 21 | entry: |
| 22 | ; CHECK: @test2 |
Owen Anderson | 3ccd818 | 2010-07-19 08:14:26 +0000 | [diff] [blame] | 23 | ; CHECK-NOT: fpext |
| 24 | ; CHECK-NOT: sqrt( |
| 25 | ; CHECK: sqrtf( |
| 26 | ; CHECK-NOT: fptrunc |
| 27 | %conv = fpext float %x to double ; <double> [#uses=1] |
| 28 | %call = tail call double @sqrt(double %conv) nounwind ; <double> [#uses=1] |
| 29 | %conv1 = fptrunc double %call to float ; <float> [#uses=1] |
| 30 | ; CHECK: ret float |
| 31 | ret float %conv1 |
| 32 | } |