comparison gcc/testsuite/c-c++-common/dfp/operator-arith-fold.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-options "-O2" } */
2
3 /* C99 6.5.5: Multiplicative operators.
4 C99 6.5.6: Additive operators. */
5
6 #include "dfp-dbg.h"
7
8 extern void link_error (void);
9
10 int
11 main ()
12 {
13 _Decimal32 d32_1, d32_2;
14
15 /* Compare like-typed positive constants. */
16 if (2.99df + 5.1df != 8.09df)
17 link_error ();
18
19 if (5.77df - 2.22dd != 3.55df)
20 link_error ();
21
22 if (2.0dl * 3.7dd * -2 != -14.8df)
23 link_error ();
24
25 if (.18df / -.2df + 1 != 1.e-1dd)
26 link_error ();
27
28 d32_1 = 3.0df;
29 d32_2 = 1.0df;
30
31 if (!__builtin_constant_p (d32_1 + 0.2df))
32 link_error ();
33
34 if (!__builtin_constant_p (1.0df / 3.0df))
35 link_error ();
36
37 if (!__builtin_constant_p (d32_2 / d32_1))
38 link_error ();
39
40 d32_2 = 2.0df;
41 if (!__builtin_constant_p (d32_2 / d32_1))
42 link_error ();
43
44 return 0;
45 }