2 Purpose: Check multiple values passing from different type.
3 Also, exceed the limit of gpr and fpr registers on PowerPC
7 Originator: <andreast@gcc.gnu.org> 20030828 */
9 /* { dg-do run { xfail mips*-*-* arm*-*-* strongarm*-*-* xscale*-*-* } } */
12 static void closure_test_fn1(ffi_cif* cif,void* resp,void** args,
16 (int)*(float *)args[0] +(int)(*(float *)args[1]) +
17 (int)(*(float *)args[2]) + (int)*(float *)args[3] +
18 (int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) +
19 (int)*(float *)args[6] + (int)(*(int *)args[7]) +
20 (int)(*(double*)args[8]) + (int)*(int *)args[9] +
21 (int)(*(int *)args[10]) + (int)(*(float *)args[11]) +
22 (int)*(int *)args[12] + (int)(*(int *)args[13]) +
23 (int)(*(int *)args[14]) + *(int *)args[15] + (int)(long)userdata;
25 printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n",
26 (int)*(float *)args[0], (int)(*(float *)args[1]),
27 (int)(*(float *)args[2]), (int)*(float *)args[3],
28 (int)(*(signed short *)args[4]), (int)(*(float *)args[5]),
29 (int)*(float *)args[6], (int)(*(int *)args[7]),
30 (int)(*(double *)args[8]), (int)*(int *)args[9],
31 (int)(*(int *)args[10]), (int)(*(float *)args[11]),
32 (int)*(int *)args[12], (int)(*(int *)args[13]),
33 (int)(*(int *)args[14]), *(int *)args[15],
34 (int)(long)userdata, (int)*(ffi_arg *)resp);
37 typedef int (*closure_test_type1)(float, float, float, float, signed short,
38 float, float, int, double, int, int, float,
43 static ffi_closure cl;
44 ffi_closure *pcl = &cl;
45 ffi_type * cl_arg_types[17];
48 cl_arg_types[0] = &ffi_type_float;
49 cl_arg_types[1] = &ffi_type_float;
50 cl_arg_types[2] = &ffi_type_float;
51 cl_arg_types[3] = &ffi_type_float;
52 cl_arg_types[4] = &ffi_type_sshort;
53 cl_arg_types[5] = &ffi_type_float;
54 cl_arg_types[6] = &ffi_type_float;
55 cl_arg_types[7] = &ffi_type_uint;
56 cl_arg_types[8] = &ffi_type_double;
57 cl_arg_types[9] = &ffi_type_uint;
58 cl_arg_types[10] = &ffi_type_uint;
59 cl_arg_types[11] = &ffi_type_float;
60 cl_arg_types[12] = &ffi_type_uint;
61 cl_arg_types[13] = &ffi_type_uint;
62 cl_arg_types[14] = &ffi_type_uint;
63 cl_arg_types[15] = &ffi_type_uint;
64 cl_arg_types[16] = NULL;
66 /* Initialize the cif */
67 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16,
68 &ffi_type_sint, cl_arg_types) == FFI_OK);
70 CHECK(ffi_prep_closure(pcl, &cif, closure_test_fn1,
71 (void *) 3 /* userdata */) == FFI_OK);
73 res = (*((closure_test_type1)pcl))
74 (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13,
76 /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */
77 printf("res: %d\n",res);
78 /* { dg-output "\nres: 255" } */