1/* 2 * intern.h 3 * 4 * Copyright (c) 1999-2019, 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. */ 18typedef void (*funcptr)(void); 19 20/* Pointers to test function types. */ 21typedef int (*testfunc1)(mpfr_t, mpfr_t, mpfr_rnd_t); 22typedef int (*testfunc2)(mpfr_t, mpfr_t, mpfr_t, mpfr_rnd_t); 23typedef int (*testrred)(mpfr_t, mpfr_t, int *); 24typedef char * (*testsemi1)(uint32 *, uint32 *); 25typedef char * (*testsemi2)(uint32 *, uint32 *, uint32 *); 26typedef char * (*testsemi2f)(uint32 *, uint32 *, uint32 *); 27typedef char * (*testldexp)(uint32 *, uint32 *, uint32 *); 28typedef char * (*testfrexp)(uint32 *, uint32 *, uint32 *); 29typedef char * (*testmodf)(uint32 *, uint32 *, uint32 *); 30typedef char * (*testclassify)(uint32 *, uint32 *); 31typedef char * (*testclassifyf)(uint32 *, uint32 *); 32 33typedef int (*testfunc1c)(mpc_t, mpc_t, mpc_rnd_t); 34typedef int (*testfunc2c)(mpc_t, mpc_t, mpc_t, mpc_rnd_t); 35 36typedef int (*testfunc1cr)(mpfr_t, mpc_t, mpfr_rnd_t); 37 38/* Pointer to a function that generates random test cases. */ 39typedef void (*casegen)(uint32 *, uint32, uint32); 40 41/* 42 * List of testable functions, their types, and their testable range. 43 */ 44enum { 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 74typedef struct __testable Testable; 75struct __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 84extern Testable functions[]; 85extern const int nfunctions; 86 87extern void init_pi(void); 88 89int nargs_(Testable* f); 90 91#endif 92