[ARM/AArch64][testsuite] Add vpadd, vpmax and vpmin tests.
[official-gcc.git] / libffi / testsuite / libffi.call / float2.c
blob20a8c402ba4680d1fab53ede572ad8cf436a1485
1 /* Area: ffi_call
2 Purpose: Check return value long double.
3 Limitations: none.
4 PR: none.
5 Originator: From the original ffitest.c */
6 /* { dg-do run } */
8 #include "ffitest.h"
9 #include "float.h"
11 #include <math.h>
13 static long double ldblit(float f)
15 return (long double) (((long double) f)/ (long double) 3.0);
18 int main (void)
20 ffi_cif cif;
21 ffi_type *args[MAX_ARGS];
22 void *values[MAX_ARGS];
23 float f;
24 long double ld;
26 args[0] = &ffi_type_float;
27 values[0] = &f;
29 /* Initialize the cif */
30 CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
31 &ffi_type_longdouble, args) == FFI_OK);
33 f = 3.14159;
35 #if 1
36 /* This is ifdef'd out for now. long double support under SunOS/gcc
37 is pretty much non-existent. You'll get the odd bus error in library
38 routines like printf(). */
39 printf ("%Lf\n", ldblit(f));
40 #endif
41 ld = 666;
42 ffi_call(&cif, FFI_FN(ldblit), &ld, values);
44 #if 1
45 /* This is ifdef'd out for now. long double support under SunOS/gcc
46 is pretty much non-existent. You'll get the odd bus error in library
47 routines like printf(). */
48 printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON);
49 #endif
51 /* These are not always the same!! Check for a reasonable delta */
52 if (fabsl(ld - ldblit(f)) < LDBL_EPSILON)
53 puts("long double return value tests ok!");
54 else
55 CHECK(0);
57 exit(0);