Home | History | Annotate | Download | only in SimplifyLibCalls
      1 ; RUN: opt < %s -simplify-libcalls -S > %t
      2 ; RUN: not grep {call.*floor(} %t
      3 ; RUN: grep {call.*floorf(} %t
      4 ; RUN: not grep {call.*ceil(} %t
      5 ; RUN: grep {call.*ceilf(} %t
      6 ; RUN: not grep {call.*nearbyint(} %t
      7 ; RUN: grep {call.*nearbyintf(} %t
      8 ; XFAIL: sparc
      9 
     10 declare double @floor(double)
     11 
     12 declare double @ceil(double)
     13 
     14 declare double @nearbyint(double)
     15 
     16 define float @test_floor(float %C) {
     17 	%D = fpext float %C to double		; <double> [#uses=1]
     18         ; --> floorf
     19 	%E = call double @floor( double %D )		; <double> [#uses=1]
     20 	%F = fptrunc double %E to float		; <float> [#uses=1]
     21 	ret float %F
     22 }
     23 
     24 define float @test_ceil(float %C) {
     25 	%D = fpext float %C to double		; <double> [#uses=1]
     26 	; --> ceilf
     27         %E = call double @ceil( double %D )		; <double> [#uses=1]
     28 	%F = fptrunc double %E to float		; <float> [#uses=1]
     29 	ret float %F
     30 }
     31 
     32 ; PR8466
     33 ; XFAIL: win32
     34 define float @test_nearbyint(float %C) {
     35 	%D = fpext float %C to double		; <double> [#uses=1]
     36 	; --> nearbyintf
     37         %E = call double @nearbyint( double %D )		; <double> [#uses=1]
     38 	%F = fptrunc double %E to float		; <float> [#uses=1]
     39 	ret float %F
     40 }
     41 
     42