1 /* Test complex arithmetic with signed zeros. Pure complex
2 multiplication with 1.0 + 0.0i. */
4 /* { dg-options "-std=gnu99" { target c } } */
6 #include "complex-sign.h"
8 #define CHECK_MUL_INT(TYPE, COPY, ZERO, ZEROI, ONE, S1, S2, SR, SI) \
10 _Complex TYPE a1, b1, c1; \
11 volatile _Complex TYPE a2, b2, c2; \
12 a1 = ENCODE(ZERO, ZEROI, S1, S2); \
13 CHECK_RES (a1, COPY, S1, S2); \
16 CHECK_RES (c1, COPY, SR, SI); \
17 c1 = a1 * (ONE + ZEROI); \
18 CHECK_RES (c1, COPY, SR, SI); \
19 a2 = ENCODE(ZERO, ZEROI, S1, S2); \
20 CHECK_RES (a2, COPY, S1, S2); \
23 CHECK_RES (c2, COPY, SR, SI); \
24 c2 = a2 * (ONE + ZEROI); \
25 CHECK_RES (c2, COPY, SR, SI); \
28 #define CHECK_MUL(TYPE, COPY, ZERO, ZEROI, ONE) \
30 CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, +, +, +); \
31 CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, -, +, +); \
32 CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, +, -, +); \
33 CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, -, +, -); \
37 check_mul_float (void)
39 CHECK_MUL (float, __builtin_copysignf
, 0.0f
, 0.0if, 1.0f
);
43 check_mul_double (void)
45 CHECK_MUL (double, __builtin_copysign
, 0.0, 0.0i
, 1.0);
49 check_mul_long_double (void)
51 CHECK_MUL (long double, __builtin_copysignl
, 0.0l, 0.0il
, 1.0l);
59 check_mul_long_double ();