xref: /freebsd/contrib/arm-optimized-routines/math/test/test_defs.h (revision f3087bef11543b42e0d69b708f367097a4118d24)
1 /*
2  * Helper macros for emitting various details about routines for consumption by
3  * runulp.sh.
4  *
5  * Copyright (c) 2024, Arm Limited.
6  * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception.
7  */
8 
9 #define TEST_ULP(f, l) TEST_ULP f l
10 #define TEST_ULP_NONNEAREST(f, l) TEST_ULP_NONNEAREST f l
11 
12 /* Emit routine name if e == 0 and f is expected to correctly trigger fenv
13    exceptions. e allows declaration to be emitted conditionally on
14    WANT_SIMD_EXCEPT - defer expansion by one pass to allow those flags to be
15    expanded properly.  */
16 #define TEST_DISABLE_FENV(f) TEST_DISABLE_FENV f
17 #define TEST_DISABLE_FENV_IF_NOT(f, e) TEST_DISABLE_FENV_IF_NOT_ (f, e)
18 #define TEST_DISABLE_FENV_IF_NOT_(f, e) TEST_DISABLE_FENV_IF_NOT_##e (f)
19 #define TEST_DISABLE_FENV_IF_NOT_0(f) TEST_DISABLE_FENV (f)
20 #define TEST_DISABLE_FENV_IF_NOT_1(f)
21 
22 #define TEST_INTERVAL(f, lo, hi, n) TEST_INTERVAL f lo hi n
23 #define TEST_SYM_INTERVAL(f, lo, hi, n)                                       \
24   TEST_INTERVAL (f, lo, hi, n)                                                \
25   TEST_INTERVAL (f, -lo, -hi, n)
26 // clang-format off
27 #define TEST_INTERVAL2(f, xlo, xhi, ylo, yhi, n)                            \
28   TEST_INTERVAL f xlo,ylo xhi,yhi n
29 // clang-format on
30 
31 #define TEST_CONTROL_VALUE(f, c) TEST_CONTROL_VALUE f c
32