1 /* C99 Logical AND operator.
2 C99 Logical OR operator.
3 Test with decimal float operands. */
4
5 #include "dfp-dbg.h"
6
7 #define OPERATE(OPRD1,OPRT,OPRD2,RLT) \
8 do \
9 { \
10 if (( (OPRD1) OPRT (OPRD2) )!= RLT) \
11 __builtin_abort (); \
12 } while (0)
13
14 #define DECIMAL_LOGICAL_OR(OPRD) \
15 do \
16 { \
17 OPRD = 1.0; \
18 OPERATE(1,||,OPRD,1); \
19 OPERATE(0,||,OPRD,1); \
20 OPERATE(OPRD,||,1,1); \
21 OPERATE(OPRD,||,0,1); \
22 OPRD = 0.0; \
23 OPERATE(1,||,OPRD,1); \
24 OPERATE(0,||,OPRD,0); \
25 OPERATE(OPRD,||,1,1); \
26 OPERATE(OPRD,||,0,0); \
27 } while (0)
28
29 #define DECIMAL_LOGICAL_AND(OPRD) \
30 do \
31 { \
32 OPRD = 1.0; \
33 OPERATE(1,&&,OPRD,1); \
34 OPERATE(0,&&,OPRD,0); \
35 OPERATE(OPRD,&&,1,1); \
36 OPERATE(OPRD,&&,0,0); \
37 OPRD = 0.0; \
38 OPERATE(1,&&,OPRD,0); \
39 OPERATE(0,&&,OPRD,0); \
40 OPERATE(OPRD,&&,1,0); \
41 OPERATE(OPRD,&&,0,0); \
42 } while (0)
43
44 int
main()45 main ()
46 {
47 _Decimal32 d32;
48 _Decimal64 d64;
49 _Decimal128 d128;
50
51 /* C99 Section 6.5.{13,14} Logical operator. Constraints Each of the
52 operands shall have scalar type. DFP types would obey this. */
53 DECIMAL_LOGICAL_OR (d32);
54 DECIMAL_LOGICAL_AND (d32);
55
56 DECIMAL_LOGICAL_OR (d64);
57 DECIMAL_LOGICAL_AND (d64);
58
59 DECIMAL_LOGICAL_OR (d128);
60 DECIMAL_LOGICAL_AND (d128);
61
62 return 0;
63 }
64