OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [dfp/] [operator-logical.c] - Blame information for rev 856

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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