2010-07-19 10:14:26 +02:00
|
|
|
; RUN: opt -S -instcombine %s | FileCheck %s
|
|
|
|
|
2010-09-07 22:01:38 +02:00
|
|
|
define float @test1(float %x) nounwind readnone ssp {
|
2010-07-19 10:14:26 +02:00
|
|
|
entry:
|
2010-09-07 22:01:38 +02:00
|
|
|
; CHECK: @test1
|
2010-07-19 10:14:26 +02:00
|
|
|
; CHECK-NOT: fpext
|
|
|
|
; CHECK-NOT: sqrt(
|
|
|
|
; CHECK: sqrtf(
|
|
|
|
; CHECK-NOT: fptrunc
|
|
|
|
%conv = fpext float %x to double ; <double> [#uses=1]
|
2010-09-07 22:01:38 +02:00
|
|
|
%call = tail call double @sqrt(double %conv) readnone nounwind ; <double> [#uses=1]
|
2010-07-19 10:14:26 +02:00
|
|
|
%conv1 = fptrunc double %call to float ; <float> [#uses=1]
|
|
|
|
; CHECK: ret float
|
|
|
|
ret float %conv1
|
|
|
|
}
|
|
|
|
|
2010-09-07 22:01:38 +02:00
|
|
|
declare double @sqrt(double)
|
|
|
|
|
|
|
|
; PR8096
|
|
|
|
define float @test2(float %x) nounwind readnone ssp {
|
|
|
|
entry:
|
|
|
|
; CHECK: @test2
|
|
|
|
; CHECK-NOT: fpext
|
|
|
|
; CHECK-NOT: sqrt(
|
|
|
|
; CHECK: sqrtf(
|
|
|
|
; CHECK-NOT: fptrunc
|
|
|
|
%conv = fpext float %x to double ; <double> [#uses=1]
|
|
|
|
%call = tail call double @sqrt(double %conv) nounwind ; <double> [#uses=1]
|
|
|
|
%conv1 = fptrunc double %call to float ; <float> [#uses=1]
|
|
|
|
; CHECK: ret float
|
|
|
|
ret float %conv1
|
|
|
|
}
|