1 /* Multiply long double (ldbl-128) values, narrowing the result to
2    double, using soft-fp.
3    Copyright (C) 2018-2022 Free Software Foundation, Inc.
4    This file is part of the GNU C Library.
5 
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10 
11    The GNU C Library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15 
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, see
18    <https://www.gnu.org/licenses/>.  */
19 
20 #define f32xmulf64x __hide_f32xmulf64x
21 #define f32xmulf128 __hide_f32xmulf128
22 #define f64mulf64x __hide_f64mulf64x
23 #define f64mulf128 __hide_f64mulf128
24 #include <math.h>
25 #undef f32xmulf64x
26 #undef f32xmulf128
27 #undef f64mulf64x
28 #undef f64mulf128
29 
30 #include <math-narrow.h>
31 #include <soft-fp.h>
32 #include <double.h>
33 #include <quad.h>
34 
35 double
__dmull(_Float128 x,_Float128 y)36 __dmull (_Float128 x, _Float128 y)
37 {
38   FP_DECL_EX;
39   FP_DECL_Q (X);
40   FP_DECL_Q (Y);
41   FP_DECL_Q (R);
42   FP_DECL_D (RN);
43   double ret;
44 
45   FP_INIT_ROUNDMODE;
46   FP_UNPACK_Q (X, x);
47   FP_UNPACK_Q (Y, y);
48   FP_MUL_Q (R, X, Y);
49 #if _FP_W_TYPE_SIZE < 64
50   FP_TRUNC_COOKED (D, Q, 2, 4, RN, R);
51 #else
52   FP_TRUNC_COOKED (D, Q, 1, 2, RN, R);
53 #endif
54   FP_PACK_D (ret, RN);
55   FP_HANDLE_EXCEPTIONS;
56   CHECK_NARROW_MUL (ret, x, y);
57   return ret;
58 }
59 libm_alias_double_ldouble (mul)
60