xref: /netbsd-src/external/gpl3/gcc.old/dist/libgcc/soft-fp/extendhftf2.c (revision 4c3eb207d36f67d31994830c0a694161fc1ca39b)
13ad841b2Smrg /* Software floating-point emulation.
23ad841b2Smrg    Return an IEEE half converted to IEEE quad
3*4c3eb207Smrg    Copyright (C) 1997-2019 Free Software Foundation, Inc.
43ad841b2Smrg    This file is part of the GNU C Library.
53ad841b2Smrg 
63ad841b2Smrg    The GNU C Library is free software; you can redistribute it and/or
73ad841b2Smrg    modify it under the terms of the GNU Lesser General Public
83ad841b2Smrg    License as published by the Free Software Foundation; either
93ad841b2Smrg    version 2.1 of the License, or (at your option) any later version.
103ad841b2Smrg 
113ad841b2Smrg    In addition to the permissions in the GNU Lesser General Public
123ad841b2Smrg    License, the Free Software Foundation gives you unlimited
133ad841b2Smrg    permission to link the compiled version of this file into
143ad841b2Smrg    combinations with other programs, and to distribute those
153ad841b2Smrg    combinations without any restriction coming from the use of this
163ad841b2Smrg    file.  (The Lesser General Public License restrictions do apply in
173ad841b2Smrg    other respects; for example, they cover modification of the file,
183ad841b2Smrg    and distribution when not linked into a combine executable.)
193ad841b2Smrg 
203ad841b2Smrg    The GNU C Library is distributed in the hope that it will be useful,
213ad841b2Smrg    but WITHOUT ANY WARRANTY; without even the implied warranty of
223ad841b2Smrg    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
233ad841b2Smrg    Lesser General Public License for more details.
243ad841b2Smrg 
253ad841b2Smrg    You should have received a copy of the GNU Lesser General Public
263ad841b2Smrg    License along with the GNU C Library; if not, see
273ad841b2Smrg    <http://www.gnu.org/licenses/>.  */
283ad841b2Smrg 
293ad841b2Smrg #define FP_NO_EXACT_UNDERFLOW
303ad841b2Smrg #include "soft-fp.h"
313ad841b2Smrg #include "half.h"
323ad841b2Smrg #include "quad.h"
333ad841b2Smrg 
343ad841b2Smrg TFtype
__extendhftf2(HFtype a)353ad841b2Smrg __extendhftf2 (HFtype a)
363ad841b2Smrg {
373ad841b2Smrg   FP_DECL_EX;
383ad841b2Smrg   FP_DECL_H (A);
393ad841b2Smrg   FP_DECL_Q (R);
403ad841b2Smrg   TFtype r;
413ad841b2Smrg 
423ad841b2Smrg   FP_INIT_EXCEPTIONS;
433ad841b2Smrg   FP_UNPACK_RAW_H (A, a);
44*4c3eb207Smrg #if _FP_W_TYPE_SIZE < 64
453ad841b2Smrg   FP_EXTEND (Q, H, 4, 1, R, A);
463ad841b2Smrg #else
473ad841b2Smrg   FP_EXTEND (Q, H, 2, 1, R, A);
483ad841b2Smrg #endif
493ad841b2Smrg   FP_PACK_RAW_Q (r, R);
503ad841b2Smrg   FP_HANDLE_EXCEPTIONS;
513ad841b2Smrg 
523ad841b2Smrg   return r;
533ad841b2Smrg }
54