Avoid is_constant calls in vectorizable_bswap
[official-gcc.git] / libffi / testsuite / libffi.call / float3.c
blobbab3206a174fb84366638c13516d25d179666c4d
1 /* Area: ffi_call
2 Purpose: Check float arguments with different orders.
3 Limitations: none.
4 PR: none.
5 Originator: From the original ffitest.c */
7 /* { dg-do run } */
9 #include "ffitest.h"
10 #include "float.h"
12 #include <math.h>
14 static double floating_1(float a, double b, long double c)
16 return (double) a + b + (double) c;
19 static double floating_2(long double a, double b, float c)
21 return (double) a + b + (double) c;
24 int main (void)
26 ffi_cif cif;
27 ffi_type *args[MAX_ARGS];
28 void *values[MAX_ARGS];
29 double rd;
31 float f;
32 double d;
33 long double ld;
35 args[0] = &ffi_type_float;
36 values[0] = &f;
37 args[1] = &ffi_type_double;
38 values[1] = &d;
39 args[2] = &ffi_type_longdouble;
40 values[2] = &ld;
42 /* Initialize the cif */
43 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
44 &ffi_type_double, args) == FFI_OK);
46 f = 3.14159;
47 d = (double)1.0/(double)3.0;
48 ld = 2.71828182846L;
50 floating_1 (f, d, ld);
52 ffi_call(&cif, FFI_FN(floating_1), &rd, values);
54 CHECK(fabs(rd - floating_1(f, d, ld)) < DBL_EPSILON);
56 args[0] = &ffi_type_longdouble;
57 values[0] = &ld;
58 args[1] = &ffi_type_double;
59 values[1] = &d;
60 args[2] = &ffi_type_float;
61 values[2] = &f;
63 /* Initialize the cif */
64 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3,
65 &ffi_type_double, args) == FFI_OK);
67 floating_2 (ld, d, f);
69 ffi_call(&cif, FFI_FN(floating_2), &rd, values);
71 CHECK(fabs(rd - floating_2(ld, d, f)) < DBL_EPSILON);
73 exit (0);