| 1 |
/* Copyright (C) 2005 Free Software Foundation. |
| 2 |
|
| 3 |
Check that (long)floor, (long)floorf, (long)floorl, |
| 4 |
(long long)floor, (long long)floorf, (long long)floorl, |
| 5 |
(long)ceil, (long)ceilf, (long)ceill, |
| 6 |
(long long)ceil, (long long)ceilf, (long long)ceill |
| 7 |
built-in functions compile. |
| 8 |
|
| 9 |
Written by Uros Bizjak, 5th April 2005. */ |
| 10 |
|
| 11 |
/* { dg-do compile } */ |
| 12 |
/* { dg-options "-O2 -ffast-math" } */ |
| 13 |
|
| 14 |
#include "builtins-config.h" |
| 15 |
|
| 16 |
extern double floor(double); |
| 17 |
extern double ceil(double); |
| 18 |
extern double trunc(double); |
| 19 |
|
| 20 |
extern float floorf(float); |
| 21 |
extern float ceilf(float); |
| 22 |
extern float truncf(float); |
| 23 |
|
| 24 |
extern long double floorl(long double); |
| 25 |
extern long double ceill(long double); |
| 26 |
extern long double truncl(long double); |
| 27 |
|
| 28 |
|
| 29 |
long int test1(double x) |
| 30 |
{ |
| 31 |
return floor(x); |
| 32 |
} |
| 33 |
|
| 34 |
long long int test2(double x) |
| 35 |
{ |
| 36 |
return floor(x); |
| 37 |
} |
| 38 |
|
| 39 |
long int test3(double x) |
| 40 |
{ |
| 41 |
return ceil(x); |
| 42 |
} |
| 43 |
|
| 44 |
long long int test4(double x) |
| 45 |
{ |
| 46 |
return ceil(x); |
| 47 |
} |
| 48 |
|
| 49 |
long int test5(double x) |
| 50 |
{ |
| 51 |
return trunc(x); |
| 52 |
} |
| 53 |
|
| 54 |
long long int test6(double x) |
| 55 |
{ |
| 56 |
return trunc(x); |
| 57 |
} |
| 58 |
|
| 59 |
#ifdef HAVE_C99_RUNTIME |
| 60 |
long int test1f(float x) |
| 61 |
{ |
| 62 |
return floorf(x); |
| 63 |
} |
| 64 |
|
| 65 |
long long int test2f(float x) |
| 66 |
{ |
| 67 |
return floorf(x); |
| 68 |
} |
| 69 |
|
| 70 |
long int test3f(float x) |
| 71 |
{ |
| 72 |
return ceilf(x); |
| 73 |
} |
| 74 |
|
| 75 |
long long int test4f(float x) |
| 76 |
{ |
| 77 |
return ceilf(x); |
| 78 |
} |
| 79 |
#endif |
| 80 |
|
| 81 |
long int test5f(float x) |
| 82 |
{ |
| 83 |
return truncf(x); |
| 84 |
} |
| 85 |
|
| 86 |
long long int test6f(float x) |
| 87 |
{ |
| 88 |
return truncf(x); |
| 89 |
} |
| 90 |
|
| 91 |
#ifdef HAVE_C99_RUNTIME |
| 92 |
long int test1l(long double x) |
| 93 |
{ |
| 94 |
return floorl(x); |
| 95 |
} |
| 96 |
|
| 97 |
long long int test2l(long double x) |
| 98 |
{ |
| 99 |
return floorl(x); |
| 100 |
} |
| 101 |
|
| 102 |
long int test3l(long double x) |
| 103 |
{ |
| 104 |
return ceill(x); |
| 105 |
} |
| 106 |
|
| 107 |
long long int test4l(long double x) |
| 108 |
{ |
| 109 |
return ceill(x); |
| 110 |
} |
| 111 |
#endif |
| 112 |
|
| 113 |
long int test5l(long double x) |
| 114 |
{ |
| 115 |
return truncl(x); |
| 116 |
} |
| 117 |
|
| 118 |
long long int test6l(long double x) |
| 119 |
{ |
| 120 |
return truncl(x); |
| 121 |
} |