1 | /* Implement fmal using soft-fp. |
2 | Copyright (C) 2013-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 | In addition to the permissions in the GNU Lesser General Public |
11 | License, the Free Software Foundation gives you unlimited |
12 | permission to link the compiled version of this file into |
13 | combinations with other programs, and to distribute those |
14 | combinations without any restriction coming from the use of this |
15 | file. (The Lesser General Public License restrictions do apply in |
16 | other respects; for example, they cover modification of the file, |
17 | and distribution when not linked into a combine executable.) |
18 | |
19 | The GNU C Library is distributed in the hope that it will be useful, |
20 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
22 | Lesser General Public License for more details. |
23 | |
24 | You should have received a copy of the GNU Lesser General Public |
25 | License along with the GNU C Library; if not, see |
26 | <https://www.gnu.org/licenses/>. */ |
27 | |
28 | #define NO_MATH_REDIRECT |
29 | #define f64xfmaf128 __hide_f64xfmaf128 |
30 | #include <math.h> |
31 | #undef f64xfmaf128 |
32 | #include <libc-diag.h> |
33 | #include <libm-alias-ldouble.h> |
34 | #include <math-narrow-alias.h> |
35 | |
36 | /* R_e is not set in cases where it is not used in packing, but the |
37 | compiler does not see that it is set in all cases where it is |
38 | used, resulting in warnings that it may be used uninitialized. |
39 | The location of the warning differs in different versions of GCC, |
40 | it may be where R is defined using a macro or it may be where the |
41 | macro is defined. */ |
42 | DIAG_PUSH_NEEDS_COMMENT; |
43 | DIAG_IGNORE_NEEDS_COMMENT (4.9, "-Wmaybe-uninitialized" ); |
44 | |
45 | #include "soft-fp.h" |
46 | #include "quad.h" |
47 | |
48 | long double |
49 | __fmal (long double a, long double b, long double c) |
50 | { |
51 | FP_DECL_EX; |
52 | FP_DECL_Q (A); |
53 | FP_DECL_Q (B); |
54 | FP_DECL_Q (C); |
55 | FP_DECL_Q (R); |
56 | long double r; |
57 | |
58 | FP_INIT_ROUNDMODE; |
59 | FP_UNPACK_Q (A, a); |
60 | FP_UNPACK_Q (B, b); |
61 | FP_UNPACK_Q (C, c); |
62 | FP_FMA_Q (R, A, B, C); |
63 | FP_PACK_Q (r, R); |
64 | FP_HANDLE_EXCEPTIONS; |
65 | |
66 | return r; |
67 | } |
68 | DIAG_POP_NEEDS_COMMENT; |
69 | |
70 | libm_alias_ldouble (__fma, fma) |
71 | libm_alias_ldouble_narrow (__fma, fma) |
72 | |