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/] [func-vararg-dfp.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-options "-std=gnu99" } */
2
 
3
/* C99 6.5.2.2 Function calls.
4
   Test passing varargs of the decimal float types.  */
5
 
6
#include <stdarg.h>
7
 
8
extern void abort (void);
9
 
10
static _Decimal32
11
vararg32 (unsigned arg, ...)
12
{
13
  int i;
14
  va_list ap;
15
  _Decimal32 result;
16
 
17
  va_start (ap, arg);
18
  for (i = 0; i <= arg; i++)
19
    result = va_arg (ap, _Decimal32);
20
  va_end (ap);
21
  return result;
22
}
23
 
24
static _Decimal64
25
vararg64 (unsigned arg, ...)
26
{
27
  int i;
28
  va_list ap;
29
  _Decimal64 result;
30
 
31
  va_start (ap, arg);
32
  for (i = 0; i <= arg; i++)
33
    result = va_arg (ap, _Decimal64);
34
  va_end (ap);
35
  return result;
36
}
37
 
38
static _Decimal128
39
vararg128 (unsigned arg, ...)
40
{
41
  int i;
42
  va_list ap;
43
  _Decimal128 result;
44
 
45
  va_start (ap, arg);
46
  for (i = 0; i <= arg; i++)
47
    result = va_arg (ap, _Decimal128);
48
  va_end (ap);
49
  return result;
50
}
51
 
52
 
53
int main()
54
{
55
  /* _Decimal32 variants.  */
56
  if (vararg32 (0, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 0.0df)
57
    abort ();
58
  if (vararg32 (1, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 1.0df)
59
    abort ();
60
  if (vararg32 (2, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 2.0df)
61
    abort ();
62
  if (vararg32 (3, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 3.0df)
63
    abort ();
64
  if (vararg32 (4, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 4.0df)
65
    abort ();
66
  if (vararg32 (5, 0.0df, 1.0df, 2.0df, 3.0df, 4.0df, 5.0df) != 5.0df)
67
    abort ();
68
 
69
  /* _Decimal64 variants.  */
70
  if (vararg64 (0, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 0.0dd)
71
    abort ();
72
  if (vararg64 (1, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 1.0dd)
73
    abort ();
74
  if (vararg64 (2, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 2.0dd)
75
    abort ();
76
  if (vararg64 (3, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 3.0dd)
77
    abort ();
78
  if (vararg64 (4, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 4.0dd)
79
    abort ();
80
  if (vararg64 (5, 0.0dd, 1.0dd, 2.0dd, 3.0dd, 4.0dd, 5.0dd) != 5.0dd)
81
    abort ();
82
 
83
  /* _Decimal128 variants.  */
84
  if (vararg128 (0, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 0.0dl)
85
    abort ();
86
  if (vararg128 (1, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 1.0dl)
87
    abort ();
88
  if (vararg128 (2, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 2.0dl)
89
    abort ();
90
  if (vararg128 (3, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 3.0dl)
91
    abort ();
92
  if (vararg128 (4, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 4.0dl)
93
    abort ();
94
  if (vararg128 (5, 0.0dl, 1.0dl, 2.0dl, 3.0dl, 4.0dl, 5.0dl) != 5.0dl)
95
    abort ();
96
 
97
  return 0;
98
}

powered by: WebSVN 2.1.0

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