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