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