2009-09-12 02:01:28 +08:00
|
|
|
; RUN: opt < %s -simplify-libcalls -S > %t
|
2007-04-17 01:36:08 +08:00
|
|
|
; 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
|
2006-01-23 13:56:34 +08:00
|
|
|
; XFAIL: sparc
|
2005-08-25 01:20:30 +08:00
|
|
|
|
2008-03-10 15:21:50 +08:00
|
|
|
declare double @floor(double)
|
2005-08-25 01:20:30 +08:00
|
|
|
|
2008-03-10 15:21:50 +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
|
|
|
|
}
|
|
|
|
|
2008-03-10 15:21:50 +08:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2010-10-28 14:46:04 +08:00
|
|
|
; PR8466
|
|
|
|
; XFAIL: win32
|
2008-03-10 15:21:50 +08:00
|
|
|
define float @test_nearbyint(float %C) {
|
|
|
|
%D = fpext float %C to double ; <double> [#uses=1]
|
2008-05-01 14:16:48 +08:00
|
|
|
; --> nearbyintf
|
2008-03-10 15:21:50 +08:00
|
|
|
%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
|
|
|
|
}
|
|
|
|
|