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 (y0)
FPTEST1 (y1)
FPTEST2ARG1 (yn, int)
+
+/* Keep this list sorted alphabetically by function name. */
+CPTEST1RETFP (cabs)
+CPTEST1RETFP (cimag)
+CPTEST1 (conj)
+CPTEST1RETFP (creal)
void test_builtin_##FN##l(long double ld1, long double ld2, long double ld3) \
{ if (__builtin_##FN##l(ld1,ld2,ld3) != __builtin_##FN##l(ld1,ld2,ld3)) link_failure_builtin_##FN##l(); }
+/* Test the __builtin_ functions taking one complex argument (with the
+ "f" and "l" variants). */
+#define BUILTIN_CPTEST1(FN) \
+extern void link_failure_builtin_##FN(void); \
+extern void link_failure_builtin_##FN##f(void); \
+extern void link_failure_builtin_##FN##l(void); \
+void test_builtin_##FN(_Complex double d) \
+{ if (__builtin_##FN(d) != __builtin_##FN(d)) link_failure_builtin_##FN(); } \
+void test_builtin_##FN##f(_Complex float f) \
+{ if (__builtin_##FN##f(f) != __builtin_##FN##f(f)) link_failure_builtin_##FN##f(); } \
+void test_builtin_##FN##l(_Complex long double ld) \
+{ if (__builtin_##FN##l(ld) != __builtin_##FN##l(ld)) link_failure_builtin_##FN##l(); }
+
+/* Test the __builtin_ functions taking two complex arguments (with
+ the "f" and "l" variants). */
+#define BUILTIN_CPTEST2(FN) \
+extern void link_failure_builtin_##FN(void); \
+extern void link_failure_builtin_##FN##f(void); \
+extern void link_failure_builtin_##FN##l(void); \
+void test_builtin_##FN(_Complex double d1, _Complex double d2) \
+{ if (__builtin_##FN(d1,d2) != __builtin_##FN(d1,d2)) link_failure_builtin_##FN(); } \
+void test_builtin_##FN##f(_Complex float f1, _Complex float f2) \
+{ if (__builtin_##FN##f(f1,f2) != __builtin_##FN##f(f1,f2)) link_failure_builtin_##FN##f(); } \
+void test_builtin_##FN##l(_Complex long double ld1, _Complex long double ld2) \
+{ if (__builtin_##FN##l(ld1,ld2) != __builtin_##FN##l(ld1,ld2)) link_failure_builtin_##FN##l(); }
+
/* These macros additionally test the non-__builtin_ functions. */
/* Test the functions taking one FP argument (with the "f" and "l"
void test_##FN##l(long double ld1, long double ld2, long double ld3) \
{ if (FN##l(ld1,ld2,ld3) != FN##l(ld1,ld2,ld3)) link_failure_##FN##l(); }
+/* Test the functions taking one complex argument (with the "f" and
+ "l" variants). */
+#define CPTEST1(FN) \
+BUILTIN_CPTEST1(FN) \
+extern void link_failure_##FN(void); \
+extern void link_failure_##FN##f(void); \
+extern void link_failure_##FN##l(void); \
+void test_##FN(_Complex double d) \
+{ if (FN(d) != FN(d)) link_failure_##FN(); } \
+void test_##FN##f(_Complex float f) \
+{ if (FN##f(f) != FN##f(f)) link_failure_##FN##f(); } \
+void test_##FN##l(_Complex long double ld) \
+{ if (FN##l(ld) != FN##l(ld)) link_failure_##FN##l(); }
+
+/* Test the functions taking two complex arguments (with the "f" and
+ "l" variants). */
+#define CPTEST2(FN) \
+BUILTIN_CPTEST2(FN) \
+extern void link_failure_##FN(void); \
+extern void link_failure_##FN##f(void); \
+extern void link_failure_##FN##l(void); \
+void test_##FN(_Complex double d1, _Complex double d2) \
+{ if (FN(d1,d2) != FN(d1,d2)) link_failure_##FN(); } \
+void test_##FN##f(_Complex float f1, _Complex float f2) \
+{ if (FN##f(f1,f2) != FN##f(f1,f2)) link_failure_##FN##f(); } \
+void test_##FN##l(_Complex long double ld1, _Complex long double ld2) \
+{ if (FN##l(ld1,ld2) != FN##l(ld1,ld2)) link_failure_##FN##l(); }
+
/* Test the math builtins. */
FPTEST1 (acos)
FPTEST1 (y1)
FPTEST2ARG1 (yn, int)
+/* Test the complex math builtins. */
+/*CPTEST1 (cabs) See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00040.html */
+CPTEST1 (cimag)
+CPTEST1 (conj)
+CPTEST1 (creal)
+
/* Various other const builtins. */
TEST1 (abs, int)
BUILTIN_TEST1 (clz, int)