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
8 Origin: Kaveh R. Ghazi, April 9, 2010. */
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__); \
32 void foo (_Complex
long double cld
, _Complex
double cd
, _Complex
float cf
)
35 TEST_EXPRS (cld
, cd
, cf
);
36 TEST_EXPRS (cld
*2, cd
*2, cf
*2);
37 TEST_EXPRS (cld
*cld
, cd
*cd
, cf
*cf
);