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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [ieee/] [20000320-1.c] - Blame information for rev 149

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

Line No. Rev Author Line
1 149 jeremybenn
#if defined(__mips__) && defined(__sgi__)
2
#include <sys/fpu.h>
3
#endif /* defined(__mips__) && defined(__sgi__) */
4
#include <limits.h>
5
#if UINT_MAX != 4294967295u || (ULONG_LONG_MAX != 18446744073709551615ull && ULONG_MAX != 18446744073709551615ull)
6
int main(void) { exit (0); }
7
#else
8
#if ULONG_MAX != 18446744073709551615ull
9
typedef unsigned long long ull;
10
#else
11
typedef unsigned long ull;
12
#endif
13
typedef unsigned ul;
14
 
15
union fl {
16
  float f;
17
  ul l;
18
} uf;
19
union dl {
20
  double d;
21
  ull ll;
22
} ud;
23
 
24
int failed = 0;
25
 
26
void c(ull d, ul f)
27
{
28
  ud.ll = d;
29
  uf.f = (float) ud.d;
30
  if (uf.l != f)
31
    {
32
      failed++;
33
    }
34
}
35
 
36
int main()
37
{
38
#if defined(__mips__) && defined(__sgi__)
39
  /* Many MIPS chips round denormalized floating point numbers to zero
40
     rather than follow the IEEE standard.  Change the rounding mode
41
     to correspond to the IEEE rounding mode that rounds numbers to
42
     the nearest representable mode, the most common IEEE rounding
43
     mode.  */
44
  set_fpc_csr(0);
45
#endif /* defined(__mips__) && defined(__sgi__) */
46
 
47
  if (sizeof (float) != sizeof (ul)
48
      || sizeof (double) != sizeof (ull))
49
    exit (0);
50
 
51
  c(0x3690000000000000ULL, 0x00000000U);
52
#if (defined __arm__ || defined __thumb__) && ! (defined __ARMEB__ || defined __VFP_FP__)
53
  /* The ARM always stores FP numbers in big-wordian format,
54
     even when running in little-byteian mode.  */
55
  c(0x0000000136900000ULL, 0x00000001U);
56
  c(0xffffffff369fffffULL, 0x00000001U);
57
  c(0x0000000036A00000ULL, 0x00000001U);
58
  c(0xffffffff36A7ffffULL, 0x00000001U);
59
  c(0x0000000036A80000ULL, 0x00000002U);
60
  c(0xffffffff36AfffffULL, 0x00000002U);
61
  c(0x0000000036b00000ULL, 0x00000002U);
62
  c(0x0000000136b00000ULL, 0x00000002U);
63
 
64
  c(0xdfffffff380fffffULL, 0x007fffffU);
65
  c(0xe0000000380fffffULL, 0x00800000U);
66
  c(0xe0000001380fffffULL, 0x00800000U);
67
  c(0xffffffff380fffffULL, 0x00800000U);
68
  c(0x0000000038100000ULL, 0x00800000U);
69
  c(0x0000000138100000ULL, 0x00800000U);
70
  c(0x1000000038100000ULL, 0x00800000U);
71
  c(0x1000000138100000ULL, 0x00800001U);
72
  c(0x2fffffff38100000ULL, 0x00800001U);
73
  c(0x3000000038100000ULL, 0x00800002U);
74
  c(0x5000000038100000ULL, 0x00800002U);
75
  c(0x5000000138100000ULL, 0x00800003U);
76
#else
77
  c(0x3690000000000001ULL, 0x00000001U);
78
  c(0x369fffffffffffffULL, 0x00000001U);
79
  c(0x36A0000000000000ULL, 0x00000001U);
80
  c(0x36A7ffffffffffffULL, 0x00000001U);
81
  c(0x36A8000000000000ULL, 0x00000002U);
82
  c(0x36AfffffffffffffULL, 0x00000002U);
83
  c(0x36b0000000000000ULL, 0x00000002U);
84
  c(0x36b0000000000001ULL, 0x00000002U);
85
 
86
  c(0x380fffffdfffffffULL, 0x007fffffU);
87
  c(0x380fffffe0000000ULL, 0x00800000U);
88
  c(0x380fffffe0000001ULL, 0x00800000U);
89
  c(0x380fffffffffffffULL, 0x00800000U);
90
  c(0x3810000000000000ULL, 0x00800000U);
91
  c(0x3810000000000001ULL, 0x00800000U);
92
  c(0x3810000010000000ULL, 0x00800000U);
93
  c(0x3810000010000001ULL, 0x00800001U);
94
  c(0x381000002fffffffULL, 0x00800001U);
95
  c(0x3810000030000000ULL, 0x00800002U);
96
  c(0x3810000050000000ULL, 0x00800002U);
97
  c(0x3810000050000001ULL, 0x00800003U);
98
#endif
99
 
100
  if (failed)
101
    abort ();
102
  else
103
    exit (0);
104
}
105
#endif

powered by: WebSVN 2.1.0

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