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

35 lines
863 B
LLVM
Raw Normal View History

; RUN: llvm-upgrade < %s | llvm-as | opt -simplify-libcalls | llvm-dis > %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)
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
}