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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libffi/] [testsuite/] [libffi.call/] [return_ll1.c] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* Area:        ffi_call
2
   Purpose:     Check if long long are passed in the corresponding regs on ppc.
3
   Limitations: none.
4
   PR:          20104.
5
   Originator:  <andreast@gcc.gnu.org> 20050222  */
6
 
7
/* { dg-do run } */
8
#include "ffitest.h"
9
static long long return_ll(int ll0, long long ll1, int ll2)
10
{
11
  return ll0 + ll1 + ll2;
12
}
13
 
14
int main (void)
15
{
16
  ffi_cif cif;
17
  ffi_type *args[MAX_ARGS];
18
  void *values[MAX_ARGS];
19
  long long rlonglong;
20
  long long ll1;
21
  unsigned ll0, ll2;
22
 
23
  args[0] = &ffi_type_uint32;
24
  args[1] = &ffi_type_sint64;
25
  args[2] = &ffi_type_uint32;
26
  values[0] = &ll0;
27
  values[1] = &ll1;
28
  values[2] = &ll2;
29
 
30
  /* Initialize the cif */
31
  CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
32
                     &ffi_type_sint64, args) == FFI_OK);
33
 
34
  ll0 = 11111111;
35
  ll1 = 11111111111000LL;
36
  ll2 = 11111111;
37
 
38
  ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
39
  printf("res: %lld, %lld\n", rlonglong, ll0 + ll1 + ll2);
40
  /* { dg-output "res: 11111133333222, 11111133333222" } */
41
  exit(0);
42
}

powered by: WebSVN 2.1.0

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