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-assignment.c] - Blame information for rev 867

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.16 Assignment operators.
4
   Verify the compound assignment operator for decimal float types,
5
   using it with other decimal float types, integers, and other binary
6
   float types cast to decimal float types.  */
7
 
8
extern void abort (void);
9
 
10
#define OPERATE(OPRD1,OPRT,OPRD2,RLT)           \
11
  if (( OPRD1 OPRT OPRD2 )!= RLT)               \
12
    abort ();
13
 
14
#define DECIMAL_COMPOUND_ASSIGNMENT(TYPE, OPRD) \
15
{                                               \
16
  _Decimal##TYPE d = OPRD;                      \
17
  OPERATE(d,+=,1,(OPRD + 1));           \
18
  d = OPRD;                             \
19
  OPERATE(d,+=,0,OPRD);                  \
20
  d = OPRD;                             \
21
  OPERATE(d,+=,(-1),(OPRD - 1));        \
22
  d = OPRD;                             \
23
  OPERATE(d,+=,d32a,(OPRD + d32a));     \
24
  d = OPRD;                             \
25
  OPERATE(d,+=,d64a,(OPRD + d64a));     \
26
  d = OPRD;                             \
27
  OPERATE(d,+=,d128a,(OPRD + d128a));   \
28
  d = OPRD;                             \
29
  OPERATE(d,+=,(_Decimal##TYPE)1.1,(OPRD + (_Decimal##TYPE)1.1));       \
30
  d = OPRD;                             \
31
  OPERATE(d,+=,(_Decimal##TYPE)2.2f,(OPRD + (_Decimal##TYPE)2.2f));     \
32
  d = OPRD;                             \
33
  OPERATE(d,-=,1,(OPRD - 1));           \
34
  d = OPRD;                             \
35
  OPERATE(d,-=,0,OPRD);                  \
36
  d = OPRD;                             \
37
  OPERATE(d,-=,(-1),(OPRD + 1));        \
38
  d = OPRD;                             \
39
  OPERATE(d,-=,d32a,OPRD-d32a);         \
40
  d = OPRD;                             \
41
  OPERATE(d,-=,d64a,OPRD-d64a);         \
42
  d = OPRD;                             \
43
  OPERATE(d,-=,d128a,OPRD-d128a);       \
44
}
45
 
46
int
47
main ()
48
{
49
  _Decimal32 d32 = 1.23456fd, d32a = 1.2df;
50
  _Decimal64 d64 = 23.456789dd, d64a = 2.8dd;
51
  _Decimal128 d128 = 345.67890123456789ld, d128a = 4.7dl;
52
 
53
  DECIMAL_COMPOUND_ASSIGNMENT(32, d32);
54
  DECIMAL_COMPOUND_ASSIGNMENT(64, d64);
55
  DECIMAL_COMPOUND_ASSIGNMENT(128, d128);
56
 
57
  return 0;
58
}

powered by: WebSVN 2.1.0

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