69e511bfb3bd48734bf98c7082af785cf6af20c5
[oota-llvm.git] / test / Transforms / InstCombine / sqrt.ll
1 ; RUN: opt -S -instcombine %s | FileCheck %s
2
3 define float @test1(float %x) nounwind readnone ssp {
4 entry:
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
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 }