1 ; RUN: opt -S -instcombine %s | FileCheck %s
3 define float @test1(float %x) nounwind readnone ssp {
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]
18 define float @test2(float %x) nounwind readnone ssp {
25 %conv = fpext float %x to double ; <double> [#uses=1]
26 %call = tail call double @sqrt(double %conv) nounwind ; <double> [#uses=1]
27 %conv1 = fptrunc double %call to float ; <float> [#uses=1]
33 ; Can't fold (fptrunc (sqrt (fpext x))) -> (sqrtf x) since there is another
35 define float @test3(float* %v) nounwind uwtable ssp {
41 %call34 = call double @sqrt(double undef) nounwind readnone
42 %call36 = call i32 (double)* @foo(double %call34) nounwind
43 %conv38 = fptrunc double %call34 to float
47 declare i32 @foo(double)
49 declare double @sqrt(double) readnone