aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/builtins-1.c
blob: 5dab9fe0a4e0a410eea3f14c067430e52bc8fcca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/* Copyright (C) 2002, 2003  Free Software Foundation.

   Verify that all the __builtin_ math functions are recognized
   by the compiler.

   Written by Roger Sayle, 11th July 2002.  */

/* { dg-do compile } */
/* { dg-options "" } */
/* { dg-final { scan-assembler-not "__builtin_" } } */

/* These helper macros ensure we also check the float and long double
   cases.  */

/* Test FP functions taking void.  */
#define FPTEST0(FN) \
double test_##FN(void) { return __builtin_##FN(); } \
float test_##FN##f(void) { return __builtin_##FN##f(); } \
long double test_##FN##l(void) { return __builtin_##FN##l(); } 

/* Test FP functions taking one FP argument.  */
#define FPTEST1(FN) \
double test_##FN(double x) { return __builtin_##FN(x); } \
float test_##FN##f(float x) { return __builtin_##FN##f(x); } \
long double test_##FN##l(long double x) { return __builtin_##FN##l(x); } 

/* Test FP functions taking one argument of a supplied type.  */
#define FPTEST1ARG(FN, TYPE) \
double test_##FN(TYPE x) { return __builtin_##FN(x); } \
float test_##FN##f(TYPE x) { return __builtin_##FN##f(x); } \
long double test_##FN##l(TYPE x) { return __builtin_##FN##l(x); } 

/* Test FP functions taking two arguments, the first argument is of a
   supplied type.  */
#define FPTEST2ARG1(FN, TYPE) \
double test_##FN(TYPE x, double y) { return __builtin_##FN(x, y); } \
float test_##FN##f(TYPE x, float y) { return __builtin_##FN##f(x, y); } \
long double test_##FN##l(TYPE x, long double y) { return __builtin_##FN##l(x, y); } 

/* Test FP functions taking two arguments, the second argument is of a
   supplied type.  */
#define FPTEST2ARG2(FN, TYPE) \
double test_##FN(double x, TYPE y) { return __builtin_##FN(x, y); } \
float test_##FN##f(float x, TYPE y) { return __builtin_##FN##f(x, y); } \
long double test_##FN##l(long double x, TYPE y) { return __builtin_##FN##l(x, y); } 

/* Test FP functions taking two arguments, the second argument is of a
   supplied type.  The function is named reentrant style, meaning "_r"
   appears after the possible f/l suffix.  */
#define FPTEST2ARG2_REENT(FN, TYPE) \
double test_##FN##_r(double x, TYPE y) { return __builtin_##FN##_r(x, y); } \
float test_##FN##f_r(float x, TYPE y) { return __builtin_##FN##f_r(x, y); } \
long double test_##FN##l_r(long double x, TYPE y) { return __builtin_##FN##l_r(x, y); } 

/* Test FP functions taking two arguments, the second argument is a
   FP pointer.  */
#define FPTEST2FPP2(FN) \
double test_##FN(double x, double *y) { return __builtin_##FN(x, y); } \
float test_##FN##f(float x, float *y) { return __builtin_##FN##f(x, y); } \
long double test_##FN##l(long double x, long double *y) { return __builtin_##FN##l(x, y); } 

/* Test FP functions taking one FP argument and a supplied return
   type.  */
#define FPTEST1RET(FN, TYPE) \
TYPE test_##FN(double x) { return __builtin_##FN(x); } \
TYPE test_##FN##f(float x) { return __builtin_##FN##f(x); } \
TYPE test_##FN##l(long double x) { return __builtin_##FN##l(x); } 

/* Test FP functions taking two FP arguments.  */
#define FPTEST2(FN) \
double test_##FN(double x, double y) { return __builtin_##FN(x, y); } \
float test_##FN##f(float x, float y) { return __builtin_##FN##f(x, y); } \
long double test_##FN##l(long double x, long double y) { return __builtin_##FN##l(x, y); } 

/* Test FP functions taking three FP arguments.  */
#define FPTEST3(FN) \
double test_##FN(double x, double y, double z) { return __builtin_##FN(x, y, z); } \
float test_##FN##f(float x, float y, float z) { return __builtin_##FN##f(x, y, z); } \
long double test_##FN##l(long double x, long double y, long double z) { return __builtin_##FN##l(x, y, z); } 

/* Test FP functions taking three arguments, two FP and the third is
   of a supplied type.  */
#define FPTEST3ARG3(FN, TYPE) \
double test_##FN(double x, double y, TYPE z) { return __builtin_##FN(x, y, z); } \
float test_##FN##f(float x, float y, TYPE z) { return __builtin_##FN##f(x, y, z); } \
long double test_##FN##l(long double x, long double y, TYPE z) { return __builtin_##FN##l(x, y, z); } 

/* Test FP functions taking three FP arguments.  The second and third
   are FP pointers.  The return type is void.  */
#define FPTEST3FPP23VOID(FN) \
double test_##FN(double x, double *y, double *z) { __builtin_##FN(x, y, z); return *y * *z; } \
float test_##FN##f(float x, float *y, float *z) { __builtin_##FN##f(x, y, z); return *y * *z; } \
long double test_##FN##l(long double x, long double *y, long double *z) { __builtin_##FN##l(x, y, z); return *y * *z; } 

/* Test Complex functions taking one Complex argument.  */
#define CPTEST1(FN) \
_Complex double test_##FN(_Complex double x) { return __builtin_##FN(x); } \
_Complex float test_##FN##f(_Complex float x) { return __builtin_##FN##f(x); } \
_Complex long double test_##FN##l(_Complex long double x) { return __builtin_##FN##l(x); } 

/* Test Complex functions taking one Complex argument and returning an FP type.  */
#define CPTEST1RETFP(FN) \
double test_##FN(_Complex double x) { return __builtin_##FN(x); } \
float test_##FN##f(_Complex float x) { return __builtin_##FN##f(x); } \
long double test_##FN##l(_Complex long double x) { return __builtin_##FN##l(x); } 

/* Test Complex functions taking two Complex arguments.  */
#define CPTEST2(FN) \
_Complex double test_##FN(_Complex double x, _Complex double y) { return __builtin_##FN(x,y); } \
_Complex float test_##FN##f(_Complex float x, _Complex float y) { return __builtin_##FN##f(x,y); } \
_Complex long double test_##FN##l(_Complex long double x, _Complex long double y) { return __builtin_##FN##l(x,y); } 


/* Keep this list sorted alphabetically by function name.  */
FPTEST1     (acos)
FPTEST1     (acosh)
FPTEST1     (asin)
FPTEST1     (asinh)
FPTEST1     (atan)
FPTEST2     (atan2)
FPTEST1     (atanh)
FPTEST1     (cbrt)
FPTEST1     (ceil)
FPTEST2     (copysign)
FPTEST1     (cos)
FPTEST1     (cosh)
FPTEST2     (drem)
FPTEST1     (erf)
FPTEST1     (erfc)
FPTEST1     (exp)
FPTEST1     (exp10)
FPTEST1     (exp2)
FPTEST1     (expm1)
FPTEST1     (fabs)
FPTEST2     (fdim)
FPTEST1     (floor)
FPTEST3     (fma)
FPTEST2     (fmax)
FPTEST2     (fmin)
FPTEST2     (fmod)
FPTEST2ARG2 (frexp, int *)
FPTEST1     (gamma)
FPTEST2ARG2_REENT (gamma, int *) /* gamma_r */
FPTEST0     (huge_val)
FPTEST2     (hypot)
FPTEST1     (ilogb)
FPTEST0     (inf)  /* { dg-warning "target format does not support infinity" "inf" {target spu-*-*} } */
FPTEST1     (j0)
FPTEST1     (j1)
FPTEST2ARG1 (jn, int)
FPTEST2ARG2 (ldexp, int)
FPTEST1     (lgamma)
FPTEST2ARG2_REENT (lgamma, int *) /* lgamma_r */
FPTEST1RET  (llrint, long long)
FPTEST1RET  (llround, long long)
FPTEST1     (log)
FPTEST1     (log10)
FPTEST1     (log1p)
FPTEST1     (log2)
FPTEST1     (logb)
FPTEST1RET  (lrint, long)
FPTEST1RET  (lround, long)
FPTEST2FPP2 (modf)
FPTEST1     (nearbyint)
FPTEST2     (nextafter)
FPTEST2     (nexttoward)
FPTEST2     (pow)
FPTEST1     (pow10)
FPTEST2     (remainder)
FPTEST3ARG3 (remquo, int *)
FPTEST1     (rint)
FPTEST1     (round)
FPTEST2     (scalb)
FPTEST2ARG2 (scalbln, int)
FPTEST2ARG2 (scalbn, int)
FPTEST1RET  (signbit, int)
FPTEST1     (significand)
FPTEST1     (sin)
FPTEST3FPP23VOID (sincos)
FPTEST1     (sinh)
FPTEST1     (sqrt)
FPTEST1     (tan)
FPTEST1     (tanh)
FPTEST1     (tgamma)
FPTEST1     (trunc)
FPTEST1     (y0)
FPTEST1     (y1)
FPTEST2ARG1 (yn, int)

/* Keep this list sorted alphabetically by function name.  */
CPTEST1RETFP (cabs)
CPTEST1      (cacos)
CPTEST1      (cacosh)
CPTEST1RETFP (carg)
CPTEST1      (casin)
CPTEST1      (casinh)
CPTEST1      (catan)
CPTEST1      (catanh)
CPTEST1      (ccos)
CPTEST1      (ccosh)
CPTEST1      (cexp)
CPTEST1RETFP (cimag)
CPTEST1      (clog)
CPTEST1      (conj)
CPTEST2      (cpow)
CPTEST1      (cproj)
CPTEST1RETFP (creal)
CPTEST1      (csin)
CPTEST1      (csinh)
CPTEST1      (csqrt)
CPTEST1      (ctan)
CPTEST1      (ctanh)