OSDN Git Service

* gcc.dg/dfp/dfp.exp: Also run tests in c-c++-common/dfp.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / c-c++-common / dfp / compare-eq-dfp.c
1 /* { dg-options "-O0" } */
2
3 /* C99 6.5.9 Equality operators.
4    Compare decimal float values against variables of different types.  */
5
6 #include "dfp-dbg.h"
7
8 _Decimal32 d32;
9 _Decimal64 d64;
10 _Decimal128 d128;
11
12 /* Use some typedefs of decimal float types, too.  */
13 typedef _Decimal32 SDtype;
14 typedef _Decimal64 DDtype;
15 typedef _Decimal128 TDtype;
16
17 SDtype d32b;
18 DDtype d64b;
19 TDtype d128b;
20
21 void
22 inits (void)
23 {
24   d32 = 1.0df;
25   d64 = 3.0dd;
26   d128 = 5.0dl;
27   d32b = -1.0df;
28   d64b = -4.0dd;
29   d128b = -6.0dl;
30 }
31
32 void
33 compare_dfp (void)
34 {
35   if ((d32 == d64) != 0) FAILURE
36   if ((d32 != d128b) != 1) FAILURE
37
38   if ((d64 != d32) != 1) FAILURE
39   if ((d64 == d128) != 0) FAILURE
40
41   if ((d128 != d32) != 1) FAILURE
42   if ((d128 == d64) != 0) FAILURE
43 }
44
45 int
46 main ()
47 {
48   inits ();
49
50   compare_dfp ();
51
52   FINISH
53 }