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

Subversion Repositories openrisc

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

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 stdcall many call on X86_WIN32 systems.
3
   Limitations: none.
4
   PR:          none.
5
   Originator:  From the original ffitest.c  */
6
 
7
/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */
8
 
9
#include "ffitest.h"
10
#include <float.h>
11
 
12
static float __attribute__((stdcall)) stdcall_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
  return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13);
27
}
28
 
29
int main (void)
30
{
31
  ffi_cif cif;
32
  ffi_type *args[13];
33
  void *values[13];
34
  float fa[13];
35
  float f, ff;
36
  unsigned long ul;
37
 
38
  for (ul = 0; ul < 13; ul++)
39
    {
40
      args[ul] = &ffi_type_float;
41
      values[ul] = &fa[ul];
42
        fa[ul] = (float) ul;
43
    }
44
 
45
  /* Initialize the cif */
46
  CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 13,
47
                     &ffi_type_float, args) == FFI_OK);
48
 
49
  ff =  stdcall_many(fa[0], fa[1],
50
                     fa[2], fa[3],
51
                     fa[4], fa[5],
52
                     fa[6], fa[7],
53
                     fa[8], fa[9],
54
                     fa[10], fa[11], fa[12]);
55
 
56
  ffi_call(&cif, FFI_FN(stdcall_many), &f, values);
57
 
58
  if (f - ff < FLT_EPSILON)
59
    printf("stdcall many arg tests ok!\n");
60
  else
61
    CHECK(0);
62
  exit(0);
63
}

powered by: WebSVN 2.1.0

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