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