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/] [compare-rel-dfp.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 -O0" } */
2
 
3
/* C99 6.5.8 Relational operators.
4
   Compare decimal float values against variables of different types.  */
5
 
6
extern void abort (void);
7
static int failcnt;
8
 
9
/* Support compiling the test to report individual failures; default is
10
   to abort as soon as a check fails.  */
11
#ifdef DBG
12
#include <stdio.h>
13
#define FAILURE { printf ("failed at line %d\n", __LINE__); failcnt++; }
14
#else
15
#define FAILURE abort ();
16
#endif
17
 
18
_Decimal32 d32;
19
_Decimal64 d64;
20
_Decimal128 d128;
21
 
22
/* Use some typedefs of decimal float types, too.  */
23
typedef _Decimal32 SDtype;
24
typedef _Decimal64 DDtype;
25
typedef _Decimal128 TDtype;
26
 
27
SDtype d32b;
28
DDtype d64b;
29
TDtype d128b;
30
 
31
void
32
inits (void)
33
{
34
  d32 = 1.0df;
35
  d64 = 3.0dd;
36
  d128 = 5.0dl;
37
  d32b = -1.0df;
38
  d64b = -4.0dd;
39
  d128b = -6.0dl;
40
}
41
 
42
void
43
compare_dfp (void)
44
{
45
  if ((d32 > d64) != 0) FAILURE
46
  if ((d32 >= d128b) != 1) FAILURE
47
 
48
  if ((d64 < d32) != 0) FAILURE
49
  if ((d64 <= d128) != 1) FAILURE
50
 
51
  if ((d128 > d32) != 1) FAILURE
52
  if ((d128 >= d64) != 1) FAILURE
53
}
54
 
55
int
56
main ()
57
{
58
  inits ();
59
 
60
  compare_dfp ();
61
 
62
  if (failcnt)
63
    abort ();
64
  return 0;
65
}

powered by: WebSVN 2.1.0

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