2008-05-22 Kai Tietz <kai.tietz@onevision.com>
[official-gcc.git] / libffi / testsuite / libffi.call / return_ll1.c
blob5681d84b407e93e1767bdead1675d9f3a773dad6
1 /* 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 */
7 /* { dg-do run } */
8 #include "ffitest.h"
9 static long long return_ll(int ll0, long long ll1, int ll2)
11 return ll0 + ll1 + ll2;
14 int main (void)
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;
23 args[0] = &ffi_type_sint;
24 args[1] = &ffi_type_sint64;
25 args[2] = &ffi_type_sint;
26 values[0] = &ll0;
27 values[1] = &ll1;
28 values[2] = &ll2;
30 /* Initialize the cif */
31 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
32 &ffi_type_sint64, args) == FFI_OK);
34 ll0 = 11111111;
35 ll1 = 11111111111000LL;
36 ll2 = 11111111;
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);