Implement C _FloatN, _FloatNx types.
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / builtin-cproj-2.c
blob39331651f193f37d387797397f605531881788b5
1 /* Copyright (C) 2010 Free Software Foundation.
3 Verify that folding of built-in cproj is correctly performed by the
4 compiler. With -ffinite-math-only all cproj calls should be
5 eliminated regardless of what the argument is, or what is known
6 about it.
8 Origin: Kaveh R. Ghazi, April 9, 2010. */
10 /* { dg-do link } */
11 /* { dg-options "-ffinite-math-only" } */
13 /* All references to link_error should go away at compile-time. The
14 argument is the __LINE__ number. It appears in the tree dump file
15 and aids in debugging should any of the tests fail. */
16 extern void link_error(int);
18 #define CPROJ(X) __builtin_cproj(X)
19 #define CPROJF(X) __builtin_cprojf(X)
20 #define CPROJL(X) __builtin_cprojl(X)
22 /* Test that the supplied expressions eliminte the cproj call. */
23 #define TEST_EXPRS(LD_EXPR, D_EXPR, F_EXPR) do { \
24 if (CPROJF(F_EXPR) != (F_EXPR)) \
25 link_error (__LINE__); \
26 if (CPROJ(D_EXPR) != (D_EXPR)) \
27 link_error (__LINE__); \
28 if (CPROJL(LD_EXPR) != (LD_EXPR)) \
29 link_error (__LINE__); \
30 } while (0)
32 void foo (_Complex long double cld, _Complex double cd, _Complex float cf)
34 #ifdef __OPTIMIZE__
35 TEST_EXPRS (cld, cd, cf);
36 TEST_EXPRS (cld*2, cd*2, cf*2);
37 TEST_EXPRS (cld*cld, cd*cd, cf*cf);
38 #endif
40 return;
43 int main (void)
45 return 0;