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-unary.c] - Blame information for rev 823

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 6.5.3 Unary operators.  */
4
 
5
extern void abort (void);
6
 
7
#define AUTO_INCREASE_DECREASE(TYPE,SUFFIX)             \
8
do                                                      \
9
{                                                       \
10
  _Decimal##TYPE in_de_d##TYPE = 0.0##SUFFIX;           \
11
  if (in_de_d##TYPE++) abort ();                        \
12
  if (--in_de_d##TYPE) abort ();                        \
13
  if (++in_de_d##TYPE == 0.0##SUFFIX) abort ();         \
14
  if (in_de_d##TYPE-- == 0.0##SUFFIX) abort ();         \
15
} while(0)
16
 
17
#define UNARY_OPERATOR(TYPE,SUFFIX)                     \
18
do                                                      \
19
{                                                       \
20
 _Decimal##TYPE unary_d##TYPE = 1.0##SUFFIX;            \
21
 _Decimal##TYPE* unary_dp##TYPE;                        \
22
 /*  & operator.  */                                    \
23
 unary_dp##TYPE = &(unary_d##TYPE);                     \
24
 /*  * operator.  */                                    \
25
 unary_d##TYPE = *(unary_dp##TYPE);                     \
26
 /*  - operator.  */                                    \
27
 unary_d##TYPE = -unary_d##TYPE;                        \
28
 if (unary_d##TYPE != -1.0##SUFFIX) abort ();           \
29
 /*  + operator.  */                                    \
30
 unary_d##TYPE = +unary_d##TYPE;                        \
31
 if (unary_d##TYPE != -1.0##SUFFIX) abort ();           \
32
 if (!unary_d##TYPE) abort (); /*! operator.  */        \
33
} while (0)
34
 
35
int
36
main ()
37
{
38
  /*  C99 6.5.3.1 Prefix increment and decrement operators. */
39
  AUTO_INCREASE_DECREASE(32, DF);
40
  AUTO_INCREASE_DECREASE(64, DD);
41
  AUTO_INCREASE_DECREASE(128, DL);
42
 
43
  /*  C99 6.5.3 Unary operators.  */
44
  UNARY_OPERATOR(32, DF);
45
  UNARY_OPERATOR(64, DD);
46
  UNARY_OPERATOR(128, DL);
47
 
48
  /*  C99 6.5.3 Unary operators for zero values.  */
49
  if (- +0.df != -0.df) abort ();
50
  if (+ -0.df != -0.df) abort ();
51
  if (- -0.df != +0.df) abort ();
52
 
53
  return 0;
54
}

powered by: WebSVN 2.1.0

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