OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [dfp/] [operator-bitwise.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do compile } */
2
 
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.
6
 
7
   Test that these operators do not accept decimal float operands.  */
8
 
9
#define OPERATE(OPRD1,OPRT,OPRD2)               \
10
do                                              \
11
{                                               \
12
  OPRD1 OPRT OPRD2;                             \
13
} while (0)
14
 
15
 
16
 
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)
27
 
28
void operator_notfor_decimal()
29
{
30
  _Decimal32 d32;
31
  _Decimal64 d64;
32
  _Decimal128 d128;
33
 
34
  /* C99 Section 6.5.7 Bitwise shift operators.  Operands must have
35
     integer type (which the decimal float types are not).  */
36
 
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" } */
43
 
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" } */
47
 
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.  */
51
 
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" } */
55
 
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" } */
59
 
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" } */
63
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.