Blame sysdeps/generic/math-tests.h

Packit 6c4009
/* Configuration for math tests.  Generic version.
Packit 6c4009
   Copyright (C) 2013-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#include <bits/floatn.h>
Packit 6c4009
Packit 6c4009
/* Expand the appropriate macro for whether to enable tests for a
Packit 6c4009
   given type.  */
Packit 6c4009
#if __HAVE_DISTINCT_FLOAT128
Packit 6c4009
# define MATH_TESTS_TG(PREFIX, ARGS, TYPE)				\
Packit 6c4009
  (sizeof (TYPE) == sizeof (float) ? PREFIX ## float ARGS		\
Packit 6c4009
   : sizeof (TYPE) == sizeof (double) ? PREFIX ## double ARGS		\
Packit 6c4009
   : __builtin_types_compatible_p (TYPE, _Float128) ? PREFIX ## float128 ARGS \
Packit 6c4009
   : PREFIX ## long_double ARGS)
Packit 6c4009
# else
Packit 6c4009
# define MATH_TESTS_TG(PREFIX, ARGS, TYPE)				\
Packit 6c4009
  (sizeof (TYPE) == sizeof (float) ? PREFIX ## float ARGS		\
Packit 6c4009
   : sizeof (TYPE) == sizeof (double) ? PREFIX ## double ARGS		\
Packit 6c4009
   : PREFIX ## long_double ARGS)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Indicate whether to run tests involving sNaN values for the float, double,
Packit 6c4009
   and long double C data types, respectively.  All are run unless
Packit 6c4009
   overridden.  */
Packit 6c4009
#ifndef SNAN_TESTS_float
Packit 6c4009
# define SNAN_TESTS_float	1
Packit 6c4009
#endif
Packit 6c4009
#ifndef SNAN_TESTS_double
Packit 6c4009
# define SNAN_TESTS_double	1
Packit 6c4009
#endif
Packit 6c4009
#ifndef SNAN_TESTS_long_double
Packit 6c4009
# define SNAN_TESTS_long_double	1
Packit 6c4009
#endif
Packit 6c4009
#ifndef SNAN_TESTS_float128
Packit 6c4009
# define SNAN_TESTS_float128	1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Return nonzero value if to run tests involving sNaN values for X.  */
Packit 6c4009
#define SNAN_TESTS(x) MATH_TESTS_TG (SNAN_TESTS_, , x)
Packit 6c4009
Packit 6c4009
/* Indicate whether to run tests involving type casts of sNaN values.  These
Packit 6c4009
   are run unless overridden.  */
Packit 6c4009
#ifndef SNAN_TESTS_TYPE_CAST
Packit 6c4009
# define SNAN_TESTS_TYPE_CAST	1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Indicate whether operations on signaling NaNs preserve the payload
Packit 6c4009
   (if possible; it is not possible with a zero payload if the high
Packit 6c4009
   bit is set for signaling NaNs) when generating a quiet NaN, and
Packit 6c4009
   this should be tested.  */
Packit 6c4009
#ifndef SNAN_TESTS_PRESERVE_PAYLOAD
Packit 6c4009
# define SNAN_TESTS_PRESERVE_PAYLOAD	1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Indicate whether to run tests involving a given rounding mode for a
Packit 6c4009
   given floating-point type, given that fesetround succeeds for that
Packit 6c4009
   mode.  All are run if fesetround succeeds unless overridden.  */
Packit 6c4009
#ifndef ROUNDING_TESTS_float
Packit 6c4009
# define ROUNDING_TESTS_float(MODE)	1
Packit 6c4009
#endif
Packit 6c4009
#ifndef ROUNDING_TESTS_double
Packit 6c4009
# define ROUNDING_TESTS_double(MODE)	1
Packit 6c4009
#endif
Packit 6c4009
#ifndef ROUNDING_TESTS_long_double
Packit 6c4009
# define ROUNDING_TESTS_long_double(MODE)	1
Packit 6c4009
#endif
Packit 6c4009
#ifndef ROUNDING_TESTS_float128
Packit 6c4009
# define ROUNDING_TESTS_float128(MODE)	1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#define ROUNDING_TESTS(TYPE, MODE)		\
Packit 6c4009
  MATH_TESTS_TG (ROUNDING_TESTS_, (MODE), TYPE)
Packit 6c4009
Packit 6c4009
/* Indicate whether to run tests of floating-point exceptions for a
Packit 6c4009
   given floating-point type, given that the exception macros are
Packit 6c4009
   defined.  All are run unless overridden.  */
Packit 6c4009
#ifndef EXCEPTION_TESTS_float
Packit 6c4009
# define EXCEPTION_TESTS_float	1
Packit 6c4009
#endif
Packit 6c4009
#ifndef EXCEPTION_TESTS_double
Packit 6c4009
# define EXCEPTION_TESTS_double	1
Packit 6c4009
#endif
Packit 6c4009
#ifndef EXCEPTION_TESTS_long_double
Packit 6c4009
# define EXCEPTION_TESTS_long_double	1
Packit 6c4009
#endif
Packit 6c4009
#ifndef EXCEPTION_TESTS_float128
Packit 6c4009
# define EXCEPTION_TESTS_float128	1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#define EXCEPTION_TESTS(TYPE) MATH_TESTS_TG (EXCEPTION_TESTS_, , TYPE)
Packit 6c4009
Packit 6c4009
/* Indicate whether the given exception trap(s) can be enabled
Packit 6c4009
   in feenableexcept.  If non-zero, the traps are always supported.
Packit 6c4009
   If zero, traps may or may not be supported depending on the
Packit 6c4009
   target (this can be determined by checking the return value
Packit 6c4009
   of feenableexcept).  This enables skipping of tests which use
Packit 6c4009
   traps.  By default traps are supported unless overridden.  */
Packit 6c4009
#ifndef EXCEPTION_ENABLE_SUPPORTED
Packit 6c4009
# define EXCEPTION_ENABLE_SUPPORTED(EXCEPT)			\
Packit 6c4009
   (EXCEPTION_TESTS_float || EXCEPTION_TESTS_double)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Indicate whether exception traps, if enabled, occur whenever an
Packit 6c4009
   exception flag is set explicitly, so it is not possible to set flag
Packit 6c4009
   bits with traps enabled without causing traps to be taken.  If
Packit 6c4009
   traps cannot be enabled, the value of this macro does not
Packit 6c4009
   matter.  */
Packit 6c4009
#ifndef EXCEPTION_SET_FORCES_TRAP
Packit 6c4009
# define EXCEPTION_SET_FORCES_TRAP 0
Packit 6c4009
#endif