OSDN Git Service

* doc/loop.texi: Document possibility not to perform disambiguation
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtins-53.c
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 /* { dg-options "-O2 -ffast-math -mmacosx-version-min=10.3" { target powerpc-*-darwin* } } */
14 /* { dg-options "-O2 -ffast-math -std=c99" { target *-*-solaris2* } } */
15
16 #include "builtins-config.h"
17
18 extern double floor(double);
19 extern double ceil(double);
20 extern double trunc(double);
21
22 extern float floorf(float);
23 extern float ceilf(float);
24 extern float truncf(float);
25
26 extern long double floorl(long double);
27 extern long double ceill(long double);
28 extern long double truncl(long double);
29
30
31 long int test1(double x)
32 {
33   return floor(x);
34 }
35
36 long long int test2(double x)
37 {
38   return floor(x);
39 }
40
41 long int test3(double x)
42 {
43   return ceil(x);
44 }
45
46 long long int test4(double x)
47 {
48   return ceil(x);
49 }
50
51 long int test5(double x)
52 {
53   return trunc(x);
54 }
55
56 long long int test6(double x)
57 {
58   return trunc(x);
59 }
60
61 #ifdef HAVE_C99_RUNTIME
62 long int test1f(float x)
63 {
64   return floorf(x);
65 }
66
67 long long int test2f(float x)
68 {
69   return floorf(x);
70 }
71
72 long int test3f(float x)
73 {
74   return ceilf(x);
75 }
76
77 long long int test4f(float x)
78 {
79   return ceilf(x);
80 }
81 #endif
82
83 long int test5f(float x)
84 {
85   return truncf(x);
86 }
87
88 long long int test6f(float x)
89 {
90   return truncf(x);
91 }
92
93 #ifdef HAVE_C99_RUNTIME
94 long int test1l(long double x)
95 {
96   return floorl(x);
97 }
98
99 long long int test2l(long double x)
100 {
101   return floorl(x);
102 }
103
104 long int test3l(long double x)
105 {
106   return ceill(x);
107 }
108
109 long long int test4l(long double x)
110 {
111   return ceill(x);
112 }
113 #endif
114
115 long int test5l(long double x)
116 {
117   return truncl(x);
118 }
119
120 long long int test6l(long double x)
121 {
122   return truncl(x);
123 }