1 ; RUN: opt < %s -instcombine -S -mtriple "i386-pc-linux" | FileCheck -check-prefix=DO-SIMPLIFY %s 2 ; RUN: opt < %s -instcombine -S -mtriple "i386-pc-win32" | FileCheck -check-prefix=DONT-SIMPLIFY %s 3 ; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-win32" | FileCheck -check-prefix=C89-SIMPLIFY %s 4 ; RUN: opt < %s -instcombine -S -mtriple "i386-pc-mingw32" | FileCheck -check-prefix=DO-SIMPLIFY %s 5 ; RUN: opt < %s -instcombine -S -mtriple "x86_64-pc-mingw32" | FileCheck -check-prefix=DO-SIMPLIFY %s 6 ; RUN: opt < %s -instcombine -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 declare double @ceil(double) 29 declare double @round(double) 30 declare double @nearbyint(double) 31 declare double @trunc(double) 32 declare double @fabs(double) 33 34 define float @test_floor(float %C) { 35 %D = fpext float %C to double 36 ; --> floorf 37 %E = call double @floor(double %D) 38 %F = fptrunc double %E to float 39 ret float %F 40 } 41 42 define float @test_ceil(float %C) { 43 %D = fpext float %C to double 44 ; --> ceilf 45 %E = call double @ceil(double %D) 46 %F = fptrunc double %E to float 47 ret float %F 48 } 49 50 define float @test_round(float %C) { 51 %D = fpext float %C to double 52 ; --> roundf 53 %E = call double @round(double %D) 54 %F = fptrunc double %E to float 55 ret float %F 56 } 57 58 define float @test_nearbyint(float %C) { 59 %D = fpext float %C to double 60 ; --> nearbyintf 61 %E = call double @nearbyint(double %D) 62 %F = fptrunc double %E to float 63 ret float %F 64 } 65 66 define float @test_trunc(float %C) { 67 %D = fpext float %C to double 68 ; --> truncf 69 %E = call double @trunc(double %D) 70 %F = fptrunc double %E to float 71 ret float %F 72 } 73 74 define float @test_fabs(float %C) { 75 %D = fpext float %C to double 76 ; --> fabsf 77 %E = call double @fabs(double %D) 78 %F = fptrunc double %E to float 79 ret float %F 80 } 81