annotate gcc/testsuite/c-c++-common/torture/complex-sign-mul-one.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test complex arithmetic with signed zeros. Pure complex
kono
parents:
diff changeset
2 multiplication with 1.0 + 0.0i. */
kono
parents:
diff changeset
3 /* { dg-do run } */
kono
parents:
diff changeset
4 /* { dg-options "-std=gnu99" { target c } } */
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 #include "complex-sign.h"
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 #define CHECK_MUL_INT(TYPE, COPY, ZERO, ZEROI, ONE, S1, S2, SR, SI) \
kono
parents:
diff changeset
9 do { \
kono
parents:
diff changeset
10 _Complex TYPE a1, b1, c1; \
kono
parents:
diff changeset
11 volatile _Complex TYPE a2, b2, c2; \
kono
parents:
diff changeset
12 a1 = ENCODE(ZERO, ZEROI, S1, S2); \
kono
parents:
diff changeset
13 CHECK_RES (a1, COPY, S1, S2); \
kono
parents:
diff changeset
14 b1 = ONE + ZEROI; \
kono
parents:
diff changeset
15 c1 = a1 * b1; \
kono
parents:
diff changeset
16 CHECK_RES (c1, COPY, SR, SI); \
kono
parents:
diff changeset
17 c1 = a1 * (ONE + ZEROI); \
kono
parents:
diff changeset
18 CHECK_RES (c1, COPY, SR, SI); \
kono
parents:
diff changeset
19 a2 = ENCODE(ZERO, ZEROI, S1, S2); \
kono
parents:
diff changeset
20 CHECK_RES (a2, COPY, S1, S2); \
kono
parents:
diff changeset
21 b2 = ONE + ZEROI; \
kono
parents:
diff changeset
22 c2 = a2 * b2; \
kono
parents:
diff changeset
23 CHECK_RES (c2, COPY, SR, SI); \
kono
parents:
diff changeset
24 c2 = a2 * (ONE + ZEROI); \
kono
parents:
diff changeset
25 CHECK_RES (c2, COPY, SR, SI); \
kono
parents:
diff changeset
26 } while (0)
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 #define CHECK_MUL(TYPE, COPY, ZERO, ZEROI, ONE) \
kono
parents:
diff changeset
29 do { \
kono
parents:
diff changeset
30 CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, +, +, +); \
kono
parents:
diff changeset
31 CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, +, -, +, +); \
kono
parents:
diff changeset
32 CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, +, -, +); \
kono
parents:
diff changeset
33 CHECK_MUL_INT (TYPE, COPY, ZERO, ZEROI, ONE, -, -, +, -); \
kono
parents:
diff changeset
34 } while (0)
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 void
kono
parents:
diff changeset
37 check_mul_float (void)
kono
parents:
diff changeset
38 {
kono
parents:
diff changeset
39 CHECK_MUL (float, __builtin_copysignf, 0.0f, 0.0if, 1.0f);
kono
parents:
diff changeset
40 }
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 void
kono
parents:
diff changeset
43 check_mul_double (void)
kono
parents:
diff changeset
44 {
kono
parents:
diff changeset
45 CHECK_MUL (double, __builtin_copysign, 0.0, 0.0i, 1.0);
kono
parents:
diff changeset
46 }
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 void
kono
parents:
diff changeset
49 check_mul_long_double (void)
kono
parents:
diff changeset
50 {
kono
parents:
diff changeset
51 CHECK_MUL (long double, __builtin_copysignl, 0.0l, 0.0il, 1.0l);
kono
parents:
diff changeset
52 }
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 int
kono
parents:
diff changeset
55 main (void)
kono
parents:
diff changeset
56 {
kono
parents:
diff changeset
57 check_mul_float ();
kono
parents:
diff changeset
58 check_mul_double ();
kono
parents:
diff changeset
59 check_mul_long_double ();
kono
parents:
diff changeset
60 exit (0);
kono
parents:
diff changeset
61 }