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

34 lines
1.1 KiB
LLVM
Raw Normal View History

; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | not grep 'call.*floor(' &&
; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | grep 'call.*floorf('
; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | not grep 'call.*ceil(' &&
; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | grep 'call.*ceilf('
; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | not grep 'call.*nearbyint(' &&
; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | grep 'call.*nearbyintf('
; XFAIL: sparc
2005-08-25 01:20:30 +08:00
declare double %floor(double)
2006-01-23 14:24:17 +08:00
declare double %ceil(double)
declare double %nearbyint(double)
2005-08-25 01:20:30 +08:00
2006-01-23 14:24:17 +08:00
float %test_floor(float %C) {
2005-08-25 01:20:30 +08:00
%D = cast float %C to double
%E = call double %floor(double %D) ; --> floorf
%F = cast double %E to float
ret float %F
}
2006-01-23 14:24:17 +08:00
float %test_ceil(float %C) {
%D = cast float %C to double
%E = call double %ceil(double %D) ; --> ceilf
%F = cast double %E to float
ret float %F
}
float %test_nearbyint(float %C) {
%D = cast float %C to double
%E = call double %nearbyint(double %D) ; --> floorf
%F = cast double %E to float
ret float %F
}