OSDN Git Service

* gcc.dg/tls/tls.exp: Remove temporary file.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / builtins-1.c
1 /* Copyright (C) 2002, 2003  Free Software Foundation.
2
3    Verify that all the __builtin_ math functions are recognized
4    by the compiler.
5
6    Written by Roger Sayle, 11th July 2002.  */
7
8 /* { dg-do compile } */
9 /* { dg-options "" } */
10 /* { dg-final { scan-assembler-not "__builtin_" } } */
11
12 /* These helper macros ensure we also check the float and long double
13    cases.  */
14
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(); } 
20
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); } 
26
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); } 
32
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); } 
39
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); } 
46
47 /* Test FP functions taking two arguments, the second argument is a
48    FP pointer.  */
49 #define FPTEST2FPP2(FN) \
50 double test_##FN(double x, double *y) { return __builtin_##FN(x, y); } \
51 float test_##FN##f(float x, float *y) { return __builtin_##FN##f(x, y); } \
52 long double test_##FN##l(long double x, long double *y) { return __builtin_##FN##l(x, y); } 
53
54 /* Test FP functions taking one FP argument and a supplied return
55    type.  */
56 #define FPTEST1RET(FN, TYPE) \
57 TYPE test_##FN(double x) { return __builtin_##FN(x); } \
58 TYPE test_##FN##f(float x) { return __builtin_##FN##f(x); } \
59 TYPE test_##FN##l(long double x) { return __builtin_##FN##l(x); } 
60
61 /* Test FP functions taking two FP arguments.  */
62 #define FPTEST2(FN) \
63 double test_##FN(double x, double y) { return __builtin_##FN(x, y); } \
64 float test_##FN##f(float x, float y) { return __builtin_##FN##f(x, y); } \
65 long double test_##FN##l(long double x, long double y) { return __builtin_##FN##l(x, y); } 
66
67 /* Test FP functions taking three FP arguments.  */
68 #define FPTEST3(FN) \
69 double test_##FN(double x, double y, double z) { return __builtin_##FN(x, y, z); } \
70 float test_##FN##f(float x, float y, float z) { return __builtin_##FN##f(x, y, z); } \
71 long double test_##FN##l(long double x, long double y, long double z) { return __builtin_##FN##l(x, y, z); } 
72
73 /* Test FP functions taking three arguments, two FP and the third is
74    of a supplied type.  */
75 #define FPTEST3ARG3(FN, TYPE) \
76 double test_##FN(double x, double y, TYPE z) { return __builtin_##FN(x, y, z); } \
77 float test_##FN##f(float x, float y, TYPE z) { return __builtin_##FN##f(x, y, z); } \
78 long double test_##FN##l(long double x, long double y, TYPE z) { return __builtin_##FN##l(x, y, z); } 
79
80 /* Test FP functions taking three FP arguments.  The second and third
81    are FP pointers.  The return type is void.  */
82 #define FPTEST3FPP23VOID(FN) \
83 double test_##FN(double x, double *y, double *z) { __builtin_##FN(x, y, z); return *y * *z; } \
84 float test_##FN##f(float x, float *y, float *z) { __builtin_##FN##f(x, y, z); return *y * *z; } \
85 long double test_##FN##l(long double x, long double *y, long double *z) { __builtin_##FN##l(x, y, z); return *y * *z; } 
86
87 /* Test Complex functions taking one Complex argument.  */
88 #define CPTEST1(FN) \
89 _Complex double test_##FN(_Complex double x) { return __builtin_##FN(x); } \
90 _Complex float test_##FN##f(_Complex float x) { return __builtin_##FN##f(x); } \
91 _Complex long double test_##FN##l(_Complex long double x) { return __builtin_##FN##l(x); } 
92
93 /* Test Complex functions taking one Complex argument and returning an FP type.  */
94 #define CPTEST1RETFP(FN) \
95 double test_##FN(_Complex double x) { return __builtin_##FN(x); } \
96 float test_##FN##f(_Complex float x) { return __builtin_##FN##f(x); } \
97 long double test_##FN##l(_Complex long double x) { return __builtin_##FN##l(x); } 
98
99 /* Test Complex functions taking two Complex arguments.  */
100 #define CPTEST2(FN) \
101 _Complex double test_##FN(_Complex double x, _Complex double y) { return __builtin_##FN(x,y); } \
102 _Complex float test_##FN##f(_Complex float x, _Complex float y) { return __builtin_##FN##f(x,y); } \
103 _Complex long double test_##FN##l(_Complex long double x, _Complex long double y) { return __builtin_##FN##l(x,y); } 
104
105
106 /* Keep this list sorted alphabetically by function name.  */
107 FPTEST1     (acos)
108 FPTEST1     (acosh)
109 FPTEST1     (asin)
110 FPTEST1     (asinh)
111 FPTEST1     (atan)
112 FPTEST2     (atan2)
113 FPTEST1     (atanh)
114 FPTEST1     (cbrt)
115 FPTEST1     (ceil)
116 FPTEST2     (copysign)
117 FPTEST1     (cos)
118 FPTEST1     (cosh)
119 FPTEST2     (drem)
120 FPTEST1     (erf)
121 FPTEST1     (erfc)
122 FPTEST1     (exp)
123 FPTEST1     (exp10)
124 FPTEST1     (exp2)
125 FPTEST1     (expm1)
126 FPTEST1     (fabs)
127 FPTEST2     (fdim)
128 FPTEST1     (floor)
129 FPTEST3     (fma)
130 FPTEST2     (fmax)
131 FPTEST2     (fmin)
132 FPTEST2     (fmod)
133 FPTEST2ARG2 (frexp, int *)
134 FPTEST1     (gamma)
135 FPTEST0     (huge_val)
136 FPTEST2     (hypot)
137 FPTEST1     (ilogb)
138 FPTEST0     (inf)
139 FPTEST1     (j0)
140 FPTEST1     (j1)
141 FPTEST2ARG1 (jn, int)
142 FPTEST2ARG2 (ldexp, int)
143 FPTEST1     (lgamma)
144 FPTEST1RET  (llrint, long long)
145 FPTEST1RET  (llround, long long)
146 FPTEST1     (log)
147 FPTEST1     (log10)
148 FPTEST1     (log1p)
149 FPTEST1     (log2)
150 FPTEST1     (logb)
151 FPTEST1RET  (lrint, long)
152 FPTEST1RET  (lround, long)
153 FPTEST2FPP2 (modf)
154 FPTEST1     (nearbyint)
155 FPTEST2     (nextafter)
156 FPTEST2     (nexttoward)
157 FPTEST2     (pow)
158 FPTEST1     (pow10)
159 FPTEST2     (remainder)
160 FPTEST3ARG3 (remquo, int *)
161 FPTEST1     (rint)
162 FPTEST1     (round)
163 FPTEST2     (scalb)
164 FPTEST2ARG2 (scalbln, int)
165 FPTEST2ARG2 (scalbn, int)
166 FPTEST1RET  (signbit, int)
167 FPTEST1     (significand)
168 FPTEST1     (sin)
169 FPTEST3FPP23VOID (sincos)
170 FPTEST1     (sinh)
171 FPTEST1     (sqrt)
172 FPTEST1     (tan)
173 FPTEST1     (tanh)
174 FPTEST1     (tgamma)
175 FPTEST1     (trunc)
176 FPTEST1     (y0)
177 FPTEST1     (y1)
178 FPTEST2ARG1 (yn, int)
179
180 /* Keep this list sorted alphabetically by function name.  */
181 CPTEST1RETFP (cabs)
182 CPTEST1      (cacos)
183 CPTEST1      (cacosh)
184 CPTEST1RETFP (carg)
185 CPTEST1      (casin)
186 CPTEST1      (casinh)
187 CPTEST1      (catan)
188 CPTEST1      (catanh)
189 CPTEST1      (ccos)
190 CPTEST1      (ccosh)
191 CPTEST1      (cexp)
192 CPTEST1RETFP (cimag)
193 /*CPTEST1      (clog)*/
194 CPTEST1      (conj)
195 CPTEST2      (cpow)
196 CPTEST1      (cproj)
197 CPTEST1RETFP (creal)
198 CPTEST1      (csin)
199 CPTEST1      (csinh)
200 CPTEST1      (csqrt)
201 CPTEST1      (ctan)
202 CPTEST1      (ctanh)