xref: /freebsd/contrib/arm-optimized-routines/pl/math/test/pl_test.h (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1 /*
2  * PL macros for emitting various details about routines for consumption by
3  * runulp.sh.
4  *
5  * Copyright (c) 2022-2023, Arm Limited.
6  * SPDX-License-Identifier: MIT OR Apache-2.0 WITH LLVM-exception.
7  */
8 
9 /* Emit the max ULP threshold, l, for routine f. Piggy-back PL_TEST_EXPECT_FENV
10    on PL_TEST_ULP to add EXPECT_FENV to all scalar routines.  */
11 #if !(V_SUPPORTED || SV_SUPPORTED)
12 #define PL_TEST_ULP(f, l)                                                      \
13   PL_TEST_EXPECT_FENV_ALWAYS (f)                                               \
14   PL_TEST_ULP f l
15 #else
16 #define PL_TEST_ULP(f, l) PL_TEST_ULP f l
17 #endif
18 
19 /* Emit aliases to allow test params to be mapped from aliases back to their
20    aliasees.  */
21 #define PL_ALIAS(a, b) PL_TEST_ALIAS a b
22 
23 /* Emit routine name if e == 1 and f is expected to correctly trigger fenv
24    exceptions. e allows declaration to be emitted conditionally upon certain
25    build flags - defer expansion by one pass to allow those flags to be expanded
26    properly.  */
27 #define PL_TEST_EXPECT_FENV(f, e) PL_TEST_EXPECT_FENV_ (f, e)
28 #define PL_TEST_EXPECT_FENV_(f, e) PL_TEST_EXPECT_FENV_##e (f)
29 #define PL_TEST_EXPECT_FENV_1(f) PL_TEST_EXPECT_FENV_ENABLED f
30 #define PL_TEST_EXPECT_FENV_ALWAYS(f) PL_TEST_EXPECT_FENV (f, 1)
31 
32 #define PL_TEST_INTERVAL(f, lo, hi, n) PL_TEST_INTERVAL f lo hi n
33 #define PL_TEST_INTERVAL_C(f, lo, hi, n, c) PL_TEST_INTERVAL f lo hi n c
34