llvm-project/llvm/test/Transforms/SimplifyLibCalls/floor.ll

40 lines
1.1 KiB
LLVM
Raw Normal View History

; RUN: opt %s -simplify-libcalls -S > %t
; RUN: not grep {call.*floor(} %t
; RUN: grep {call.*floorf(} %t
; RUN: not grep {call.*ceil(} %t
; RUN: grep {call.*ceilf(} %t
; RUN: not grep {call.*nearbyint(} %t
; RUN: grep {call.*nearbyintf(} %t
; XFAIL: sparc
2005-08-25 01:20:30 +08:00
declare double @floor(double)
2005-08-25 01:20:30 +08:00
declare double @ceil(double)
declare double @nearbyint(double)
define float @test_floor(float %C) {
%D = fpext float %C to double ; <double> [#uses=1]
; --> floorf
%E = call double @floor( double %D ) ; <double> [#uses=1]
%F = fptrunc double %E to float ; <float> [#uses=1]
2005-08-25 01:20:30 +08:00
ret float %F
}
define float @test_ceil(float %C) {
%D = fpext float %C to double ; <double> [#uses=1]
; --> ceilf
%E = call double @ceil( double %D ) ; <double> [#uses=1]
%F = fptrunc double %E to float ; <float> [#uses=1]
2006-01-23 14:24:17 +08:00
ret float %F
}
define float @test_nearbyint(float %C) {
%D = fpext float %C to double ; <double> [#uses=1]
2008-05-01 14:16:48 +08:00
; --> nearbyintf
%E = call double @nearbyint( double %D ) ; <double> [#uses=1]
%F = fptrunc double %E to float ; <float> [#uses=1]
2006-01-23 14:24:17 +08:00
ret float %F
}