Merged revision 156805 into branch.
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / complex-sign-mixed-add.c
blob5548fe431e8e735aa5bcc614ebacefad674286b8
1 /* Test complex arithmetic with signed zeros. Mixed real/complex
2 addition. */
3 /* { dg-do run } */
4 /* { dg-options "-std=gnu99" } */
6 #include "complex-sign.h"
8 #define CHECK_ADD(TYPE, COPY, ZERO, ZEROI) \
9 do { \
10 CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, +, +, +, +); \
11 CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, +, -, +, -); \
12 CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, -, +, +, +); \
13 CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, +, -, -, +, -); \
14 CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, +, +, +, +); \
15 CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, +, -, +, -); \
16 CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, -, +, -, +); \
17 CHECK_ARITH_RC (TYPE, COPY, ZERO, ZEROI, +, -, -, -, -, -); \
18 CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, +, +, ZERO, +, +); \
19 CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, +, -, ZERO, +, +); \
20 CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, -, +, ZERO, +, -); \
21 CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, +, -, -, ZERO, +, -); \
22 CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, +, +, ZERO, +, +); \
23 CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, +, -, ZERO, -, +); \
24 CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, -, +, ZERO, +, -); \
25 CHECK_ARITH_CR (TYPE, COPY, ZERO, ZEROI, +, -, -, -, ZERO, -, -); \
26 } while (0)
28 void
29 check_add_float (void)
31 CHECK_ADD (float, __builtin_copysignf, 0.0f, 0.0if);
34 void
35 check_add_double (void)
37 CHECK_ADD (double, __builtin_copysign, 0.0, 0.0i);
40 void
41 check_add_long_double (void)
43 CHECK_ADD (long double, __builtin_copysignl, 0.0l, 0.0il);
46 int
47 main (void)
49 check_add_float ();
50 check_add_double ();
51 check_add_long_double ();
52 exit (0);