1 /* Test complex arithmetic with signed zeros. Pure complex
2 subtraction. */
3 /* { dg-do run } */
4 /* { dg-options "-std=gnu99" { target c } } */
5
6 #include "complex-sign.h"
7
8 #define CHECK_SUB(TYPE, COPY, ZERO, ZEROI) \
9 do { \
10 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, +, +, +, +); \
11 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, +, -, +, +); \
12 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, -, +, +, +); \
13 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, +, -, -, +, +); \
14 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, +, +, +, -); \
15 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, +, -, +, +); \
16 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, -, +, +, -); \
17 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, +, -, -, -, +, +); \
18 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, +, +, -, +); \
19 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, +, -, -, +); \
20 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, -, +, +, +); \
21 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, +, -, -, +, +); \
22 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, +, +, -, -); \
23 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, +, -, -, +); \
24 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, -, +, +, -); \
25 CHECK_ARITH (TYPE, COPY, ZERO, ZEROI, -, -, -, -, -, +, +); \
26 } while (0)
27
28 void
check_sub_float(void)29 check_sub_float (void)
30 {
31 CHECK_SUB (float, __builtin_copysignf, 0.0f, 0.0if);
32 }
33
34 void
check_sub_double(void)35 check_sub_double (void)
36 {
37 CHECK_SUB (double, __builtin_copysign, 0.0, 0.0i);
38 }
39
40 void
check_sub_long_double(void)41 check_sub_long_double (void)
42 {
43 CHECK_SUB (long double, __builtin_copysignl, 0.0l, 0.0il);
44 }
45
46 int
main(void)47 main (void)
48 {
49 check_sub_float ();
50 check_sub_double ();
51 check_sub_long_double ();
52 exit (0);
53 }
54