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