mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-18 10:31:57 +00:00
979ed44feb
turning (fptrunc (sqrt (fpext x))) -> (sqrtf x) is great, but we have to delete the original sqrt as well. Not doing so causes us to do two sqrt's when building with -fmath-errno (the default on linux). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113260 91177308-0d34-0410-b5e6-96231b3b80d8
33 lines
915 B
LLVM
33 lines
915 B
LLVM
; RUN: opt -S -instcombine %s | FileCheck %s
|
|
|
|
define float @test1(float %x) nounwind readnone ssp {
|
|
entry:
|
|
; CHECK: @test1
|
|
; 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) readnone nounwind ; <double> [#uses=1]
|
|
%conv1 = fptrunc double %call to float ; <float> [#uses=1]
|
|
; CHECK: ret float
|
|
ret float %conv1
|
|
}
|
|
|
|
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
|
|
}
|