1 ; RUN: opt < %s -simplify-libcalls -S -mtriple "i386-pc-linux" | FileCheck -check-prefix=DO-SIMPLIFY %s 2 ; RUN: opt < %s -simplify-libcalls -S -mtriple "i386-pc-win32" | FileCheck -check-prefix=DONT-SIMPLIFY %s 3 ; RUN: opt < %s -simplify-libcalls -S -mtriple "x86_64-pc-win32" | FileCheck -check-prefix=C89-SIMPLIFY %s 4 ; RUN: opt < %s -simplify-libcalls -S -mtriple "i386-pc-mingw32" | FileCheck -check-prefix=DO-SIMPLIFY %s 5 ; RUN: opt < %s -simplify-libcalls -S -mtriple "x86_64-pc-mingw32" | FileCheck -check-prefix=DO-SIMPLIFY %s 6 ; RUN: opt < %s -simplify-libcalls -S -mtriple "sparc-sun-solaris" | FileCheck -check-prefix=DO-SIMPLIFY %s 7 8 ; DO-SIMPLIFY: call float @floorf( 9 ; DO-SIMPLIFY: call float @ceilf( 10 ; DO-SIMPLIFY: call float @roundf( 11 ; DO-SIMPLIFY: call float @nearbyintf( 12 ; DO-SIMPLIFY: call float @truncf( 13 ; DO-SIMPLIFY: call float @fabsf( 14 15 ; C89-SIMPLIFY: call float @floorf( 16 ; C89-SIMPLIFY: call float @ceilf( 17 ; C89-SIMPLIFY: call double @round( 18 ; C89-SIMPLIFY: call double @nearbyint( 19 20 ; DONT-SIMPLIFY: call double @floor( 21 ; DONT-SIMPLIFY: call double @ceil( 22 ; DONT-SIMPLIFY: call double @round( 23 ; DONT-SIMPLIFY: call double @nearbyint( 24 ; DONT-SIMPLIFY: call double @trunc( 25 ; DONT-SIMPLIFY: call double @fabs( 26 27 declare double @floor(double) 28 29 declare double @ceil(double) 30 31 declare double @round(double) 32 33 declare double @nearbyint(double) 34 35 declare double @trunc(double) 36 37 declare double @fabs(double) 38 39 define float @test_floor(float %C) { 40 %D = fpext float %C to double ; <double> [#uses=1] 41 ; --> floorf 42 %E = call double @floor( double %D ) ; <double> [#uses=1] 43 %F = fptrunc double %E to float ; <float> [#uses=1] 44 ret float %F 45 } 46 47 define float @test_ceil(float %C) { 48 %D = fpext float %C to double ; <double> [#uses=1] 49 ; --> ceilf 50 %E = call double @ceil( double %D ) ; <double> [#uses=1] 51 %F = fptrunc double %E to float ; <float> [#uses=1] 52 ret float %F 53 } 54 55 define float @test_round(float %C) { 56 %D = fpext float %C to double ; <double> [#uses=1] 57 ; --> roundf 58 %E = call double @round( double %D ) ; <double> [#uses=1] 59 %F = fptrunc double %E to float ; <float> [#uses=1] 60 ret float %F 61 } 62 63 define float @test_nearbyint(float %C) { 64 %D = fpext float %C to double ; <double> [#uses=1] 65 ; --> nearbyintf 66 %E = call double @nearbyint( double %D ) ; <double> [#uses=1] 67 %F = fptrunc double %E to float ; <float> [#uses=1] 68 ret float %F 69 } 70 71 define float @test_trunc(float %C) { 72 %D = fpext float %C to double 73 ; --> truncf 74 %E = call double @trunc(double %D) 75 %F = fptrunc double %E to float 76 ret float %F 77 } 78 79 define float @test_fabs(float %C) { 80 %D = fpext float %C to double 81 ; --> fabsf 82 %E = call double @fabs(double %D) 83 %F = fptrunc double %E to float 84 ret float %F 85 } 86