2 Purpose: Check float arguments with different orders.
5 Originator: From the original ffitest.c */
8 /* { dg-options -mlong-double-128 { target powerpc64*-*-* } } */
13 static double floating_1(float a, double b, long double c)
15 return (double) a + b + (double) c;
18 static double floating_2(long double a, double b, float c)
20 return (double) a + b + (double) c;
26 ffi_type *args[MAX_ARGS];
27 void *values[MAX_ARGS];
34 args[0] = &ffi_type_float;
36 args[1] = &ffi_type_double;
38 args[2] = &ffi_type_longdouble;
41 /* Initialize the cif */
42 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
43 &ffi_type_double, args) == FFI_OK);
46 d = (double)1.0/(double)3.0;
49 floating_1 (f, d, ld);
51 ffi_call(&cif, FFI_FN(floating_1), &rd, values);
53 CHECK(rd - floating_1(f, d, ld) < DBL_EPSILON);
55 args[0] = &ffi_type_longdouble;
57 args[1] = &ffi_type_double;
59 args[2] = &ffi_type_float;
62 /* Initialize the cif */
63 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
64 &ffi_type_double, args) == FFI_OK);
66 floating_2 (ld, d, f);
68 ffi_call(&cif, FFI_FN(floating_2), &rd, values);
70 CHECK(rd - floating_2(ld, d, f) < DBL_EPSILON);