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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 686 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O" } */
3
 
4
/* DFP TR 24732 == WG14 / N1176, N1312 */
5
/* Based on a test from Fred Tydeman.  */
6
 
7
#include "dfp-dbg.h"
8
 
9
/* Test runtime computations.  */
10
 
11
void
12
runtime32 (void)
13
{
14
  volatile float v1 = 28.f, v2 = 3.f, v3 = 9.f, v4 = 31.f, v5 = 3.f, v6 = 10.f;
15
  float      b32 = (float)((v1/v2-v3) - (v4/v5-v6));
16
  _Decimal32 d32 = (float)((v1/v2-v3) - (v4/v5-v6));
17
 
18
  if (b32)
19
    FAILURE
20
  if (d32)
21
    FAILURE
22
}
23
 
24
void
25
runtime64 (void)
26
{
27
  volatile double v1 = 28., v2 = 3., v3 = 9., v4 = 31., v5 = 3., v6 = 10.;
28
  double     b64 = (double)((v1/v2-v3) - (v4/v5-v6));
29
  _Decimal64 d64 = (double)((v1/v2-v3) - (v4/v5-v6));
30
 
31
  if (b64)
32
    FAILURE
33
  if (d64)
34
    FAILURE
35
}
36
 
37
void
38
runtime128 (void)
39
{
40
  volatile long double v1 = 28.l, v2 = 3.l, v3 = 9.l,
41
                       v4 = 31.l, v5 = 3.l, v6 = 10.l;
42
  long double b128 = (long double)((v1/v2-v3) - (v4/v5-v6));
43
  _Decimal128 d128 = (long double)((v1/v2-v3) - (v4/v5-v6));
44
 
45
  if (b128)
46
    FAILURE
47
  if (d128)
48
    FAILURE
49
}
50
 
51
/* Test constant folding.  */
52
 
53
void
54
fold32 (void)
55
{
56
  double     d32 = (float)((28.f/3.f-9.f) - (31.f/3.f-10.f));
57
  _Decimal32 b32 = (float)((28.f/3.f-9.f) - (31.f/3.f-10.f));
58
 
59
  if (b32)
60
    FAILURE
61
  if (d32)
62
    FAILURE
63
}
64
 
65
void
66
fold64 (void)
67
{
68
  double     b64 = (double)((28./3.-9.) - (31./3.-10.));
69
  _Decimal64 d64 = (double)((28./3.-9.) - (31./3.-10.));
70
 
71
  if (b64)
72
    FAILURE
73
  if (d64)
74
    FAILURE
75
}
76
 
77
void
78
fold128 (void)
79
{
80
  long double b128 = (long double)((28./3.-9.) - (31./3.-10.));
81
  _Decimal128 d128 = (long double)((28./3.-9.) - (31./3.-10.));
82
 
83
  if (b128)
84
    FAILURE
85
  if (d128)
86
    FAILURE
87
}
88
 
89
int
90
main ()
91
{
92
  runtime32 ();
93
  runtime64 ();
94
  runtime128 ();
95
  fold32 ();
96
  fold64 ();
97
  fold128 ();
98
 
99
  FINISH
100
}

powered by: WebSVN 2.1.0

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