Debian Codegraph @

testsuite/libffi.call/return_ll1.c

raw
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: <[email protected]> 20050222 */
6
7 /* { dg-do run } */
8 /* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */
9 #include "ffitest.h"
10 static long long return_ll(int ll0, long long ll1, int ll2)
11 {
12 CHECK(ll0 == 11111111);
13 CHECK(ll1 == 11111111111000LL);
14 CHECK(ll2 == 11111111);
15 return ll0 + ll1 + ll2;
16 }
17
18 int main (void)
19 {
20 ffi_cif cif;
21 ffi_type *args[MAX_ARGS];
22 void *values[MAX_ARGS];
23 long long rlonglong;
24 long long ll1;
25 unsigned ll0, ll2;
26
27 args[0] = &ffi_type_sint;
28 args[1] = &ffi_type_sint64;
29 args[2] = &ffi_type_sint;
30 values[0] = &ll0;
31 values[1] = &ll1;
32 values[2] = &ll2;
33
34 /* Initialize the cif */
35 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
36 &ffi_type_sint64, args) == FFI_OK);
37
38 ll0 = 11111111;
39 ll1 = 11111111111000LL;
40 ll2 = 11111111;
41
42 ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values);
43 printf("res: %" PRIdLL ", %" PRIdLL "\n", rlonglong, ll0 + ll1 + ll2);
44 /* { dg-output "res: 11111133333222, 11111133333222" } */
45 CHECK(rlonglong == 11111133333222);
46 CHECK(ll0 + ll1 + ll2 == 11111133333222);
47 exit(0);
48 }