Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / dfp / operator-bitwise.c
blobf895a970578b3f87ac1820906b5e823bece679f1
1 /* { dg-do compile } */
3 /* C99 6.5.10: Bitwise AND operator.
4 C99 6.5.11: Bitwise exclusive OR operator.
5 C99 6.5.12: Bitwise inclusive OR operator.
7 Test that these operators do not accept decimal float operands. */
9 #define OPERATE(OPRD1,OPRT,OPRD2) \
10 do \
11 { \
12 OPRD1 OPRT OPRD2; \
13 } while (0)
17 #define DECIMAL_BITWISE_OPERATOR(OPRT,OPRD) \
18 do \
19 { \
20 OPERATE(OPRD,OPRT,1); \
21 OPERATE(OPRD,OPRT,0); \
22 OPERATE(OPRD,OPRT,0x15); \
23 OPERATE(0,OPRT,OPRD); \
24 OPERATE(1,OPRT,OPRD); \
25 OPERATE(0x15,OPRT,OPRD); \
26 } while (0)
28 void operator_notfor_decimal()
30 _Decimal32 d32;
31 _Decimal64 d64;
32 _Decimal128 d128;
34 /* C99 Section 6.5.7 Bitwise shift operators. Operands must have
35 integer type (which the decimal float types are not). */
37 d32 << 1; /* { dg-error "invalid operands to binary" } */
38 d32 >> 1; /* { dg-error "invalid operands to binary" } */
39 d64 << 1; /* { dg-error "invalid operands to binary" } */
40 d64 >> 1; /* { dg-error "invalid operands to binary" } */
41 d128 << 1; /* { dg-error "invalid operands to binary" } */
42 d128 >> 1; /* { dg-error "invalid operands to binary" } */
44 DECIMAL_BITWISE_OPERATOR(&,d32); /* { dg-error "invalid operands to binary" } */
45 DECIMAL_BITWISE_OPERATOR(&,d64); /* { dg-error "invalid operands to binary" } */
46 DECIMAL_BITWISE_OPERATOR(&,d128); /* { dg-error "invalid operands to binary" } */
48 /* C99 Section 6.5.{10,11,12} Bitwise operator. Constraints: Each of
49 the operands shall have integer type. DFP type is reject by compiler
50 when bitwise operation is performed. */
52 DECIMAL_BITWISE_OPERATOR(&,d32); /* { dg-error "invalid operands to binary" } */
53 DECIMAL_BITWISE_OPERATOR(&,d64); /* { dg-error "invalid operands to binary" } */
54 DECIMAL_BITWISE_OPERATOR(&,d128); /* { dg-error "invalid operands to binary" } */
56 DECIMAL_BITWISE_OPERATOR(|,d32); /* { dg-error "invalid operands to binary" } */
57 DECIMAL_BITWISE_OPERATOR(|,d64); /* { dg-error "invalid operands to binary" } */
58 DECIMAL_BITWISE_OPERATOR(|,d128); /* { dg-error "invalid operands to binary" } */
60 DECIMAL_BITWISE_OPERATOR(^,d32); /* { dg-error "invalid operands to binary" } */
61 DECIMAL_BITWISE_OPERATOR(^,d64); /* { dg-error "invalid operands to binary" } */
62 DECIMAL_BITWISE_OPERATOR(^,d128); /* { dg-error "invalid operands to binary" } */