blob: 69e511bfb3bd48734bf98c7082af785cf6af20c5 [file] [log] [blame]
Owen Anderson3ccd8182010-07-19 08:14:26 +00001; RUN: opt -S -instcombine %s | FileCheck %s
2
Chris Lattner6e27b3e2010-09-07 20:01:38 +00003define float @test1(float %x) nounwind readnone ssp {
Owen Anderson3ccd8182010-07-19 08:14:26 +00004entry:
Chris Lattner6e27b3e2010-09-07 20:01:38 +00005; 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
17declare double @sqrt(double)
18
19; PR8096
20define float @test2(float %x) nounwind readnone ssp {
21entry:
22; CHECK: @test2
Owen Anderson3ccd8182010-07-19 08:14:26 +000023; 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}