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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libffi/] [testsuite/] [libffi.call/] [many.c] - Blame information for rev 742

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

Line No. Rev Author Line
1 732 jeremybenn
/* Area:        ffi_call
2
   Purpose:     Check return value float, with many arguments
3
   Limitations: none.
4
   PR:          none.
5
   Originator:  From the original ffitest.c  */
6
 
7
/* { dg-do run } */
8
#include "ffitest.h"
9
 
10
#include <float.h>
11
 
12
static float many(float f1,
13
                  float f2,
14
                  float f3,
15
                  float f4,
16
                  float f5,
17
                  float f6,
18
                  float f7,
19
                  float f8,
20
                  float f9,
21
                  float f10,
22
                  float f11,
23
                  float f12,
24
                  float f13)
25
{
26
#if 0
27
  printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n",
28
         (double) f1, (double) f2, (double) f3, (double) f4, (double) f5,
29
         (double) f6, (double) f7, (double) f8, (double) f9, (double) f10,
30
         (double) f11, (double) f12, (double) f13);
31
#endif
32
 
33
  return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13);
34
}
35
 
36
int main (void)
37
{
38
  ffi_cif cif;
39
  ffi_type *args[13];
40
  void *values[13];
41
  float fa[13];
42
  float f, ff;
43
  int i;
44
 
45
  for (i = 0; i < 13; i++)
46
    {
47
      args[i] = &ffi_type_float;
48
      values[i] = &fa[i];
49
      fa[i] = (float) i;
50
    }
51
 
52
    /* Initialize the cif */
53
    CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13,
54
                       &ffi_type_float, args) == FFI_OK);
55
 
56
    ffi_call(&cif, FFI_FN(many), &f, values);
57
 
58
    ff =  many(fa[0], fa[1],
59
               fa[2], fa[3],
60
               fa[4], fa[5],
61
               fa[6], fa[7],
62
               fa[8], fa[9],
63
               fa[10],fa[11],fa[12]);
64
 
65
    if (f - ff < FLT_EPSILON)
66
      exit(0);
67
    else
68
      abort();
69
}

powered by: WebSVN 2.1.0

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