1 /* 2 * intern.h 3 * 4 * Copyright (c) 1999-2018, Arm Limited. 5 * SPDX-License-Identifier: MIT 6 */ 7 8 #ifndef mathtest_intern_h 9 #define mathtest_intern_h 10 11 #include <mpfr.h> 12 #include <mpc.h> 13 14 #include "types.h" 15 #include "wrappers.h" 16 17 /* Generic function pointer. */ 18 typedef void (*funcptr)(void); 19 20 /* Pointers to test function types. */ 21 typedef int (*testfunc1)(mpfr_t, mpfr_t, mpfr_rnd_t); 22 typedef int (*testfunc2)(mpfr_t, mpfr_t, mpfr_t, mpfr_rnd_t); 23 typedef int (*testrred)(mpfr_t, mpfr_t, int *); 24 typedef char * (*testsemi1)(uint32 *, uint32 *); 25 typedef char * (*testsemi2)(uint32 *, uint32 *, uint32 *); 26 typedef char * (*testsemi2f)(uint32 *, uint32 *, uint32 *); 27 typedef char * (*testldexp)(uint32 *, uint32 *, uint32 *); 28 typedef char * (*testfrexp)(uint32 *, uint32 *, uint32 *); 29 typedef char * (*testmodf)(uint32 *, uint32 *, uint32 *); 30 typedef char * (*testclassify)(uint32 *, uint32 *); 31 typedef char * (*testclassifyf)(uint32 *, uint32 *); 32 33 typedef int (*testfunc1c)(mpc_t, mpc_t, mpc_rnd_t); 34 typedef int (*testfunc2c)(mpc_t, mpc_t, mpc_t, mpc_rnd_t); 35 36 typedef int (*testfunc1cr)(mpfr_t, mpc_t, mpfr_rnd_t); 37 38 /* Pointer to a function that generates random test cases. */ 39 typedef void (*casegen)(uint32 *, uint32, uint32); 40 41 /* 42 * List of testable functions, their types, and their testable range. 43 */ 44 enum { 45 args1, /* afloat-based, one argument */ 46 args1f, /* same as args1 but in single prec */ 47 args2, /* afloat-based, two arguments */ 48 args2f, /* same as args2 but in single prec */ 49 rred, /* afloat-based, one arg, aux return */ 50 rredf, /* same as rred but in single prec */ 51 semi1, /* seminumerical, one argument */ 52 semi1f, /* seminumerical, 1 arg, float */ 53 semi2, /* seminumerical, two arguments */ 54 semi2f, /* seminumerical, 2 args, floats */ 55 t_ldexp, /* dbl * int -> dbl */ 56 t_ldexpf, /* sgl * int -> sgl */ 57 t_frexp, /* dbl -> dbl * int */ 58 t_frexpf, /* sgl -> sgl * int */ 59 t_modf, /* dbl -> dbl * dbl */ 60 t_modff, /* sgl -> sgl * sgl */ 61 classify, /* classify double: dbl -> int */ 62 classifyf, /* classify float: flt -> int */ 63 compare, /* compare doubles, returns int */ 64 comparef, /* compare floats, returns int */ 65 66 args1c, /* acomplex-base, one argument */ 67 args2c, 68 args1fc, 69 args2fc, 70 args1cr, /* dbl-complex -> complex */ 71 args1fcr /* sgl-complex -> complex */ 72 }; 73 74 typedef struct __testable Testable; 75 struct __testable { 76 char *name; 77 funcptr func; 78 int type; 79 wrapperfunc wrappers[MAXWRAPPERS]; 80 casegen cases; /* complex functions use the same casegen for both real and complex args */ 81 uint32 caseparam1, caseparam2; 82 }; 83 84 extern Testable functions[]; 85 extern const int nfunctions; 86 87 extern void init_pi(void); 88 89 int nargs_(Testable* f); 90 91 #endif 92