build-many-glibcs.py: Add openrisc hard float glibc variant
[glibc.git] / sysdeps / generic / math-narrow-alias.h
blobe318e1070b1fe65e226a3c205fcaf34e68739a76
1 /* Alias macros for functions returning a narrower type.
2 Copyright (C) 2018-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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/>. */
19 #ifndef _MATH_NARROW_ALIAS_H
20 #define _MATH_NARROW_ALIAS_H 1
22 #include <bits/floatn.h>
23 #include <bits/long-double.h>
25 /* The following macros declare aliases for a narrowing function. The
26 sole argument is the base name of a family of functions, such as
27 "add". If any platform changes long double format after the
28 introduction of narrowing functions, in a way requiring symbol
29 versioning compatibility, additional variants of these macros will
30 be needed. */
32 #define libm_alias_float_double_main(func) \
33 weak_alias (__f ## func, f ## func) \
34 weak_alias (__f ## func, f32 ## func ## f64) \
35 weak_alias (__f ## func, f32 ## func ## f32x)
37 #ifdef NO_LONG_DOUBLE
38 # define libm_alias_float_double(func) \
39 libm_alias_float_double_main (func) \
40 weak_alias (__f ## func, f ## func ## l)
41 #else
42 # define libm_alias_float_double(func) \
43 libm_alias_float_double_main (func)
44 #endif
46 #define libm_alias_float32x_float64_main(func) \
47 weak_alias (__f32x ## func ## f64, f32x ## func ## f64)
49 #ifdef NO_LONG_DOUBLE
50 # define libm_alias_float32x_float64(func) \
51 libm_alias_float32x_float64_main (func) \
52 weak_alias (__f32x ## func ## f64, d ## func ## l)
53 #elif defined __LONG_DOUBLE_MATH_OPTIONAL
54 # define libm_alias_float32x_float64(func) \
55 libm_alias_float32x_float64_main (func) \
56 weak_alias (__f32x ## func ## f64, __nldbl_d ## func ## l)
57 #else
58 # define libm_alias_float32x_float64(func) \
59 libm_alias_float32x_float64_main (func)
60 #endif
62 #if __HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128
63 # define libm_alias_float_ldouble_f128(func) \
64 weak_alias (__f ## func ## l, f32 ## func ## f128)
65 # define libm_alias_double_ldouble_f128(func) \
66 weak_alias (__d ## func ## l, f32x ## func ## f128) \
67 weak_alias (__d ## func ## l, f64 ## func ## f128)
68 #else
69 # define libm_alias_float_ldouble_f128(func)
70 # define libm_alias_double_ldouble_f128(func)
71 #endif
73 #if __HAVE_FLOAT64X_LONG_DOUBLE
74 # define libm_alias_float_ldouble_f64x(func) \
75 weak_alias (__f ## func ## l, f32 ## func ## f64x)
76 # define libm_alias_double_ldouble_f64x(func) \
77 weak_alias (__d ## func ## l, f32x ## func ## f64x) \
78 weak_alias (__d ## func ## l, f64 ## func ## f64x)
79 #else
80 # define libm_alias_float_ldouble_f64x(func)
81 # define libm_alias_double_ldouble_f64x(func)
82 #endif
84 #define libm_alias_float_ldouble(func) \
85 weak_alias (__f ## func ## l, f ## func ## l) \
86 libm_alias_float_ldouble_f128 (func) \
87 libm_alias_float_ldouble_f64x (func)
89 #define libm_alias_double_ldouble(func) \
90 weak_alias (__d ## func ## l, d ## func ## l) \
91 libm_alias_double_ldouble_f128 (func) \
92 libm_alias_double_ldouble_f64x (func)
94 #define libm_alias_float64x_float128(func) \
95 weak_alias (__f64x ## func ## f128, f64x ## func ## f128)
97 #define libm_alias_float32_float128_main(func) \
98 weak_alias (__f32 ## func ## f128, f32 ## func ## f128)
100 #define libm_alias_float64_float128_main(func) \
101 weak_alias (__f64 ## func ## f128, f64 ## func ## f128) \
102 weak_alias (__f64 ## func ## f128, f32x ## func ## f128)
104 #include <math-narrow-alias-float128.h>
106 /* The following macros declare narrowing-named aliases for a
107 non-narrowing function. */
109 #define libm_alias_double_narrow_main(from, to) \
110 weak_alias (from, f32x ## to ## f64)
112 #ifdef NO_LONG_DOUBLE
113 # define libm_alias_double_narrow(from, to) \
114 libm_alias_double_narrow_main (from, to) \
115 weak_alias (from, d ## to ## l)
116 #else
117 # define libm_alias_double_narrow(from, to) \
118 libm_alias_double_narrow_main (from, to)
119 #endif
121 #if __HAVE_FLOAT64X_LONG_DOUBLE && __HAVE_FLOAT128 && !__HAVE_DISTINCT_FLOAT128
122 # define libm_alias_ldouble_narrow(from, to) \
123 weak_alias (from ## l, f64x ## to ## f128)
124 #else
125 # define libm_alias_ldouble_narrow(from, to)
126 #endif
128 #if __HAVE_DISTINCT_FLOAT128 && __HAVE_FLOAT64X && !__HAVE_FLOAT64X_LONG_DOUBLE
129 # define libm_alias_float128_narrow(from, to) \
130 weak_alias (from ## f128, f64x ## to ## f128)
131 #else
132 # define libm_alias_float128_narrow(from, to)
133 #endif
135 #endif /* math-narrow-alias.h. */