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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [c-c++-common/] [dfp/] [usual-arith-conv.c] - Blame information for rev 686

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 686 jeremybenn
/* { dg-options "-O0" } */
2
 
3
/* N1150 5.4: Usual arithmetic conversions.
4
   C99 6.3.1.8[1] (New).
5
 
6
   Test arithmetic operators with different decimal float types, and
7
   between decimal float types and integer types.  */
8
 
9
#include "dfp-dbg.h"
10
 
11
volatile _Decimal32 d32a, d32b, d32c;
12
volatile _Decimal64 d64a, d64b, d64c;
13
volatile _Decimal128 d128a, d128b, d128c;
14
volatile int i;
15
 
16
void
17
init ()
18
{
19
  d32b = 123.456e94df;
20
  d64b = 12.3456789012345e383dd;
21
  d128b = 12345.6789012345678901e4000dl;
22
 
23
  d32c = 1.3df;
24
  d64c = 1.2dd;
25
  d128c = 1.1dl;
26
 
27
  i = 2;
28
}
29
 
30
int
31
main ()
32
{
33
  init ();
34
 
35
  /* Usual arithmetic conversions between decimal float types; addition.  */
36
  d128a = d128b + d32b;
37
  if (d128a < d128b)
38
    FAILURE
39
  d128a = d32b + d128b;
40
  if (d128a < d128b)
41
    FAILURE
42
  d128a = d128b + d64b;
43
  if (d128a < d128b)
44
    FAILURE
45
  d128a = d64b + d128b;
46
  if (d128a < d128b)
47
    FAILURE
48
  d64a = d64b + d32b;
49
  if (d64a < d64b)
50
    FAILURE
51
  d64a = d32b + d64b;
52
  if (d64a < d64b)
53
    FAILURE
54
 
55
  /* Usual arithmetic conversions between decimal float types;
56
     multiplication.  */
57
  d128a = d128b * d32c;
58
  if (d128a < d128b)
59
    FAILURE
60
  d128a = d32c * d128b;
61
  if (d128a < d128b)
62
    FAILURE
63
  d128a = d128b * d64c;
64
  if (d128a < d128b)
65
    FAILURE
66
  d128a = d64c * d128b;
67
  if (d128a < d128b)
68
    FAILURE
69
  d64a = d64b * d32c;
70
  if (d64a < d64b)
71
    FAILURE
72
  d64a = d32c * d64b;
73
  if (d64a < d64b)
74
    FAILURE
75
 
76
  /* Usual arithmetic conversions between decimal float and integer types.  */
77
  d32a = d32c + i;
78
  if (d32a != d32c + 2.0df)
79
    FAILURE
80
  d32a = d32c - i;
81
  if (d32a != d32c - 2.0df)
82
    FAILURE
83
  d32a = i * d32c;
84
  if (d32a != d32c + d32c)
85
    FAILURE
86
  d32a = d32c / i;
87
  if (d32a != d32c / 2.0df)
88
    FAILURE
89
 
90
  d64a = i + d64c;
91
  if (d64a != d64c + 2.0dd)
92
    FAILURE
93
  d64a = d64c - i;
94
  if (d64a != d64c - 2.0dd)
95
    FAILURE
96
  d64a = d64c * i;
97
  if (d64a != d64c + d64c)
98
    FAILURE
99
  d64a = d64c / i;
100
  if (d64a != d64c / 2.0dd)
101
    FAILURE
102
 
103
  d128a = d128c + i;
104
  if (d128a != d128c + 2.0dl)
105
    FAILURE
106
  d128a = d128c - i;
107
  if (d128a != d128c - 2.0dl)
108
    FAILURE
109
  d128a = i * d128c;
110
  if (d128a != d128c + d128c)
111
    FAILURE
112
  d128a = d128c / i;
113
  if (d128a != d128c / 2.0dl)
114
    FAILURE
115
 
116
  FINISH
117
}

powered by: WebSVN 2.1.0

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