xref: /dflybsd-src/contrib/gcc-8.0/libgcc/soft-fp/extenddftf2.c (revision 38fd149817dfbff97799f62fcb70be98c4e32523)
1*38fd1498Szrj /* Software floating-point emulation.
2*38fd1498Szrj    Return a converted to IEEE quad
3*38fd1498Szrj    Copyright (C) 1997-2016 Free Software Foundation, Inc.
4*38fd1498Szrj    This file is part of the GNU C Library.
5*38fd1498Szrj    Contributed by Richard Henderson (rth@cygnus.com) and
6*38fd1498Szrj 		  Jakub Jelinek (jj@ultra.linux.cz).
7*38fd1498Szrj 
8*38fd1498Szrj    The GNU C Library is free software; you can redistribute it and/or
9*38fd1498Szrj    modify it under the terms of the GNU Lesser General Public
10*38fd1498Szrj    License as published by the Free Software Foundation; either
11*38fd1498Szrj    version 2.1 of the License, or (at your option) any later version.
12*38fd1498Szrj 
13*38fd1498Szrj    In addition to the permissions in the GNU Lesser General Public
14*38fd1498Szrj    License, the Free Software Foundation gives you unlimited
15*38fd1498Szrj    permission to link the compiled version of this file into
16*38fd1498Szrj    combinations with other programs, and to distribute those
17*38fd1498Szrj    combinations without any restriction coming from the use of this
18*38fd1498Szrj    file.  (The Lesser General Public License restrictions do apply in
19*38fd1498Szrj    other respects; for example, they cover modification of the file,
20*38fd1498Szrj    and distribution when not linked into a combine executable.)
21*38fd1498Szrj 
22*38fd1498Szrj    The GNU C Library is distributed in the hope that it will be useful,
23*38fd1498Szrj    but WITHOUT ANY WARRANTY; without even the implied warranty of
24*38fd1498Szrj    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25*38fd1498Szrj    Lesser General Public License for more details.
26*38fd1498Szrj 
27*38fd1498Szrj    You should have received a copy of the GNU Lesser General Public
28*38fd1498Szrj    License along with the GNU C Library; if not, see
29*38fd1498Szrj    <http://www.gnu.org/licenses/>.  */
30*38fd1498Szrj 
31*38fd1498Szrj #define FP_NO_EXACT_UNDERFLOW
32*38fd1498Szrj #include "soft-fp.h"
33*38fd1498Szrj #include "double.h"
34*38fd1498Szrj #include "quad.h"
35*38fd1498Szrj 
36*38fd1498Szrj TFtype
__extenddftf2(DFtype a)37*38fd1498Szrj __extenddftf2 (DFtype a)
38*38fd1498Szrj {
39*38fd1498Szrj   FP_DECL_EX;
40*38fd1498Szrj   FP_DECL_D (A);
41*38fd1498Szrj   FP_DECL_Q (R);
42*38fd1498Szrj   TFtype r;
43*38fd1498Szrj 
44*38fd1498Szrj   FP_INIT_EXCEPTIONS;
45*38fd1498Szrj   FP_UNPACK_RAW_D (A, a);
46*38fd1498Szrj #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
47*38fd1498Szrj   FP_EXTEND (Q, D, 4, 2, R, A);
48*38fd1498Szrj #else
49*38fd1498Szrj   FP_EXTEND (Q, D, 2, 1, R, A);
50*38fd1498Szrj #endif
51*38fd1498Szrj   FP_PACK_RAW_Q (r, R);
52*38fd1498Szrj   FP_HANDLE_EXCEPTIONS;
53*38fd1498Szrj 
54*38fd1498Szrj   return r;
55*38fd1498Szrj }
56