* es.po: Update.
[official-gcc.git] / gcc / testsuite / gcc.dg / builtins-1.c
blob5dab9fe0a4e0a410eea3f14c067430e52bc8fcca
1 /* Copyright (C) 2002, 2003 Free Software Foundation.
3 Verify that all the __builtin_ math functions are recognized
4 by the compiler.
6 Written by Roger Sayle, 11th July 2002. */
8 /* { dg-do compile } */
9 /* { dg-options "" } */
10 /* { dg-final { scan-assembler-not "__builtin_" } } */
12 /* These helper macros ensure we also check the float and long double
13 cases. */
15 /* Test FP functions taking void. */
16 #define FPTEST0(FN) \
17 double test_##FN(void) { return __builtin_##FN(); } \
18 float test_##FN##f(void) { return __builtin_##FN##f(); } \
19 long double test_##FN##l(void) { return __builtin_##FN##l(); }
21 /* Test FP functions taking one FP argument. */
22 #define FPTEST1(FN) \
23 double test_##FN(double x) { return __builtin_##FN(x); } \
24 float test_##FN##f(float x) { return __builtin_##FN##f(x); } \
25 long double test_##FN##l(long double x) { return __builtin_##FN##l(x); }
27 /* Test FP functions taking one argument of a supplied type. */
28 #define FPTEST1ARG(FN, TYPE) \
29 double test_##FN(TYPE x) { return __builtin_##FN(x); } \
30 float test_##FN##f(TYPE x) { return __builtin_##FN##f(x); } \
31 long double test_##FN##l(TYPE x) { return __builtin_##FN##l(x); }
33 /* Test FP functions taking two arguments, the first argument is of a
34 supplied type. */
35 #define FPTEST2ARG1(FN, TYPE) \
36 double test_##FN(TYPE x, double y) { return __builtin_##FN(x, y); } \
37 float test_##FN##f(TYPE x, float y) { return __builtin_##FN##f(x, y); } \
38 long double test_##FN##l(TYPE x, long double y) { return __builtin_##FN##l(x, y); }
40 /* Test FP functions taking two arguments, the second argument is of a
41 supplied type. */
42 #define FPTEST2ARG2(FN, TYPE) \
43 double test_##FN(double x, TYPE y) { return __builtin_##FN(x, y); } \
44 float test_##FN##f(float x, TYPE y) { return __builtin_##FN##f(x, y); } \
45 long double test_##FN##l(long double x, TYPE y) { return __builtin_##FN##l(x, y); }
47 /* Test FP functions taking two arguments, the second argument is of a
48 supplied type. The function is named reentrant style, meaning "_r"
49 appears after the possible f/l suffix. */
50 #define FPTEST2ARG2_REENT(FN, TYPE) \
51 double test_##FN##_r(double x, TYPE y) { return __builtin_##FN##_r(x, y); } \
52 float test_##FN##f_r(float x, TYPE y) { return __builtin_##FN##f_r(x, y); } \
53 long double test_##FN##l_r(long double x, TYPE y) { return __builtin_##FN##l_r(x, y); }
55 /* Test FP functions taking two arguments, the second argument is a
56 FP pointer. */
57 #define FPTEST2FPP2(FN) \
58 double test_##FN(double x, double *y) { return __builtin_##FN(x, y); } \
59 float test_##FN##f(float x, float *y) { return __builtin_##FN##f(x, y); } \
60 long double test_##FN##l(long double x, long double *y) { return __builtin_##FN##l(x, y); }
62 /* Test FP functions taking one FP argument and a supplied return
63 type. */
64 #define FPTEST1RET(FN, TYPE) \
65 TYPE test_##FN(double x) { return __builtin_##FN(x); } \
66 TYPE test_##FN##f(float x) { return __builtin_##FN##f(x); } \
67 TYPE test_##FN##l(long double x) { return __builtin_##FN##l(x); }
69 /* Test FP functions taking two FP arguments. */
70 #define FPTEST2(FN) \
71 double test_##FN(double x, double y) { return __builtin_##FN(x, y); } \
72 float test_##FN##f(float x, float y) { return __builtin_##FN##f(x, y); } \
73 long double test_##FN##l(long double x, long double y) { return __builtin_##FN##l(x, y); }
75 /* Test FP functions taking three FP arguments. */
76 #define FPTEST3(FN) \
77 double test_##FN(double x, double y, double z) { return __builtin_##FN(x, y, z); } \
78 float test_##FN##f(float x, float y, float z) { return __builtin_##FN##f(x, y, z); } \
79 long double test_##FN##l(long double x, long double y, long double z) { return __builtin_##FN##l(x, y, z); }
81 /* Test FP functions taking three arguments, two FP and the third is
82 of a supplied type. */
83 #define FPTEST3ARG3(FN, TYPE) \
84 double test_##FN(double x, double y, TYPE z) { return __builtin_##FN(x, y, z); } \
85 float test_##FN##f(float x, float y, TYPE z) { return __builtin_##FN##f(x, y, z); } \
86 long double test_##FN##l(long double x, long double y, TYPE z) { return __builtin_##FN##l(x, y, z); }
88 /* Test FP functions taking three FP arguments. The second and third
89 are FP pointers. The return type is void. */
90 #define FPTEST3FPP23VOID(FN) \
91 double test_##FN(double x, double *y, double *z) { __builtin_##FN(x, y, z); return *y * *z; } \
92 float test_##FN##f(float x, float *y, float *z) { __builtin_##FN##f(x, y, z); return *y * *z; } \
93 long double test_##FN##l(long double x, long double *y, long double *z) { __builtin_##FN##l(x, y, z); return *y * *z; }
95 /* Test Complex functions taking one Complex argument. */
96 #define CPTEST1(FN) \
97 _Complex double test_##FN(_Complex double x) { return __builtin_##FN(x); } \
98 _Complex float test_##FN##f(_Complex float x) { return __builtin_##FN##f(x); } \
99 _Complex long double test_##FN##l(_Complex long double x) { return __builtin_##FN##l(x); }
101 /* Test Complex functions taking one Complex argument and returning an FP type. */
102 #define CPTEST1RETFP(FN) \
103 double test_##FN(_Complex double x) { return __builtin_##FN(x); } \
104 float test_##FN##f(_Complex float x) { return __builtin_##FN##f(x); } \
105 long double test_##FN##l(_Complex long double x) { return __builtin_##FN##l(x); }
107 /* Test Complex functions taking two Complex arguments. */
108 #define CPTEST2(FN) \
109 _Complex double test_##FN(_Complex double x, _Complex double y) { return __builtin_##FN(x,y); } \
110 _Complex float test_##FN##f(_Complex float x, _Complex float y) { return __builtin_##FN##f(x,y); } \
111 _Complex long double test_##FN##l(_Complex long double x, _Complex long double y) { return __builtin_##FN##l(x,y); }
114 /* Keep this list sorted alphabetically by function name. */
115 FPTEST1 (acos)
116 FPTEST1 (acosh)
117 FPTEST1 (asin)
118 FPTEST1 (asinh)
119 FPTEST1 (atan)
120 FPTEST2 (atan2)
121 FPTEST1 (atanh)
122 FPTEST1 (cbrt)
123 FPTEST1 (ceil)
124 FPTEST2 (copysign)
125 FPTEST1 (cos)
126 FPTEST1 (cosh)
127 FPTEST2 (drem)
128 FPTEST1 (erf)
129 FPTEST1 (erfc)
130 FPTEST1 (exp)
131 FPTEST1 (exp10)
132 FPTEST1 (exp2)
133 FPTEST1 (expm1)
134 FPTEST1 (fabs)
135 FPTEST2 (fdim)
136 FPTEST1 (floor)
137 FPTEST3 (fma)
138 FPTEST2 (fmax)
139 FPTEST2 (fmin)
140 FPTEST2 (fmod)
141 FPTEST2ARG2 (frexp, int *)
142 FPTEST1 (gamma)
143 FPTEST2ARG2_REENT (gamma, int *) /* gamma_r */
144 FPTEST0 (huge_val)
145 FPTEST2 (hypot)
146 FPTEST1 (ilogb)
147 FPTEST0 (inf) /* { dg-warning "target format does not support infinity" "inf" {target spu-*-*} } */
148 FPTEST1 (j0)
149 FPTEST1 (j1)
150 FPTEST2ARG1 (jn, int)
151 FPTEST2ARG2 (ldexp, int)
152 FPTEST1 (lgamma)
153 FPTEST2ARG2_REENT (lgamma, int *) /* lgamma_r */
154 FPTEST1RET (llrint, long long)
155 FPTEST1RET (llround, long long)
156 FPTEST1 (log)
157 FPTEST1 (log10)
158 FPTEST1 (log1p)
159 FPTEST1 (log2)
160 FPTEST1 (logb)
161 FPTEST1RET (lrint, long)
162 FPTEST1RET (lround, long)
163 FPTEST2FPP2 (modf)
164 FPTEST1 (nearbyint)
165 FPTEST2 (nextafter)
166 FPTEST2 (nexttoward)
167 FPTEST2 (pow)
168 FPTEST1 (pow10)
169 FPTEST2 (remainder)
170 FPTEST3ARG3 (remquo, int *)
171 FPTEST1 (rint)
172 FPTEST1 (round)
173 FPTEST2 (scalb)
174 FPTEST2ARG2 (scalbln, int)
175 FPTEST2ARG2 (scalbn, int)
176 FPTEST1RET (signbit, int)
177 FPTEST1 (significand)
178 FPTEST1 (sin)
179 FPTEST3FPP23VOID (sincos)
180 FPTEST1 (sinh)
181 FPTEST1 (sqrt)
182 FPTEST1 (tan)
183 FPTEST1 (tanh)
184 FPTEST1 (tgamma)
185 FPTEST1 (trunc)
186 FPTEST1 (y0)
187 FPTEST1 (y1)
188 FPTEST2ARG1 (yn, int)
190 /* Keep this list sorted alphabetically by function name. */
191 CPTEST1RETFP (cabs)
192 CPTEST1 (cacos)
193 CPTEST1 (cacosh)
194 CPTEST1RETFP (carg)
195 CPTEST1 (casin)
196 CPTEST1 (casinh)
197 CPTEST1 (catan)
198 CPTEST1 (catanh)
199 CPTEST1 (ccos)
200 CPTEST1 (ccosh)
201 CPTEST1 (cexp)
202 CPTEST1RETFP (cimag)
203 CPTEST1 (clog)
204 CPTEST1 (conj)
205 CPTEST2 (cpow)
206 CPTEST1 (cproj)
207 CPTEST1RETFP (creal)
208 CPTEST1 (csin)
209 CPTEST1 (csinh)
210 CPTEST1 (csqrt)
211 CPTEST1 (ctan)
212 CPTEST1 (ctanh)