1 /* Define aliases for libm long double functions.  ldbl-opt version.
2    Copyright (C) 2017-2022 Free Software Foundation, Inc.
3    This file is part of the GNU C Library.
4 
5    The GNU C Library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    The GNU C Library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, see
17    <https://www.gnu.org/licenses/>.  */
18 
19 #ifndef _LIBM_ALIAS_LDOUBLE_H
20 #define _LIBM_ALIAS_LDOUBLE_H
21 
22 #include <bits/floatn.h>
23 #include <math_ldbl_opt.h>
24 #include <ldbl-compat-choose.h>
25 
26 #if __HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128
27 # define libm_alias_ldouble_other_r_f128(from, to, r)	\
28   weak_alias (from ## l ## r, to ## f128 ## r)
29 #else
30 # define libm_alias_ldouble_other_r_f128(from, to, r)
31 #endif
32 
33 #if __HAVE_FLOAT64X_LONG_DOUBLE
34 # define libm_alias_ldouble_other_r_f64x(from, to, r)	\
35   weak_alias (from ## l ## r, to ## f64x ## r)
36 #else
37 # define libm_alias_ldouble_other_r_f64x(from, to, r)
38 #endif
39 
40 /* Define _FloatN / _FloatNx aliases for a long double libm function
41    that has internal name FROM ## l ## R and public names TO ## suffix
42    ## R for each suffix of a supported _FloatN / _FloatNx
43    floating-point type with the same format as long double.  */
44 #define libm_alias_ldouble_other_r(from, to, r)		\
45   libm_alias_ldouble_other_r_f128 (from, to, r);	\
46   libm_alias_ldouble_other_r_f64x (from, to, r)
47 
48 /* Likewise, but without the R suffix.  */
49 #define libm_alias_ldouble_other(from, to)	\
50   libm_alias_ldouble_other_r (from, to, )
51 
52 /* Define aliases for a long double libm function that has internal
53    name FROM ## l ## R and public names TO ## suffix ## R for each
54    suffix of a supported floating-point type with the same format as
55    long double.  This should only be used for functions where such
56    public names exist for _FloatN types, not for
57    implementation-namespace exported names (where there is one name
58    per format, not per type) or for obsolescent functions not provided
59    for _FloatN types.  */
60 #define libm_alias_ldouble_r(from, to, r)			\
61   LONG_DOUBLE_COMPAT_CHOOSE_libm_ ## to ## l ## r		\
62     (long_double_symbol (libm, from ## l ## r, to ## l ## r),	\
63      weak_alias (from ## l ## r, to ## l ## r));		\
64   libm_alias_ldouble_other_r (from, to, r)
65 
66 /* Likewise, but without the R suffix.  */
67 #define libm_alias_ldouble(from, to) libm_alias_ldouble_r (from, to, )
68 
69 #endif
70