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-cond.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-options "-std=gnu99 -O0" } */
2
 
3
/* C99 6.5.15 Conditional operator.
4
   Test with decimal float operands.  */
5
 
6
extern void abort (void);
7
static int failcnt = 0;
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
volatile _Decimal32 d32a, d32b, d32c;
19
volatile _Decimal64 d64a, d64b, d64c;
20
volatile _Decimal128 d128a, d128b, d128c;
21
volatile int i, yes, no;
22
 
23
void
24
init ()
25
{
26
  d32b = 123.456e94df;
27
  d64b = 12.3456789012345e383dd;
28
  d128b = 12345.6789012345678901e4000dl;
29
 
30
  d32c = 1.3df;
31
  d64c = 1.2dd;
32
  d128c = 1.1dl;
33
 
34
  i = 2;
35
  yes = 1;
36
  no = 0;
37
}
38
 
39
int
40
main ()
41
{
42
  /* Operands and the result are all the same decimal float type.  */
43
  d32a = yes ? d32b : d32c;
44
  if (d32a != d32b)
45
    FAILURE
46
  d64a = no ? d64b : d64c;
47
  if (d64a != d64b)
48
    FAILURE
49
  d128a = yes ? d128b : d128c;
50
  if (d128a != d128b)
51
    FAILURE
52
 
53
  /* Operand types are different.  */
54
  d128a = yes ? d32b : d64b;
55
  if (d128a != d32b)
56
    FAILURE
57
  d128a = yes ? d128b : d64b;
58
  if (d128a != d128b)
59
    FAILURE
60
  d128a = no ? d32b : d128b;
61
  if (d128a != d128b)
62
    FAILURE
63
 
64
  return 0;
65
}

powered by: WebSVN 2.1.0

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