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

40 lines
1.2 KiB
LLVM
Raw Normal View History

; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | \
; RUN: not grep {call.*floor(} &&
; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | \
; RUN: grep {call.*floorf(}
; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | \
; RUN: not grep {call.*ceil(} &&
; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | \
; RUN: grep {call.*ceilf(}
; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | \
; RUN: not grep {call.*nearbyint(} &&
; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis | \
; RUN: 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
}