xref: /netbsd-src/external/gpl3/gcc.old/dist/libgcc/soft-fp/extendxftf2.c (revision 8feb0f0b7eaff0608f8350bbfa3098827b4bb91b)
11debfc3dSmrg /* Software floating-point emulation.
21debfc3dSmrg    Return a converted to IEEE quad
3*8feb0f0bSmrg    Copyright (C) 2007-2019 Free Software Foundation, Inc.
41debfc3dSmrg    This file is part of the GNU C Library.
51debfc3dSmrg    Contributed by Uros Bizjak (ubizjak@gmail.com).
61debfc3dSmrg 
71debfc3dSmrg    The GNU C Library is free software; you can redistribute it and/or
81debfc3dSmrg    modify it under the terms of the GNU Lesser General Public
91debfc3dSmrg    License as published by the Free Software Foundation; either
101debfc3dSmrg    version 2.1 of the License, or (at your option) any later version.
111debfc3dSmrg 
121debfc3dSmrg    In addition to the permissions in the GNU Lesser General Public
131debfc3dSmrg    License, the Free Software Foundation gives you unlimited
141debfc3dSmrg    permission to link the compiled version of this file into
151debfc3dSmrg    combinations with other programs, and to distribute those
161debfc3dSmrg    combinations without any restriction coming from the use of this
171debfc3dSmrg    file.  (The Lesser General Public License restrictions do apply in
181debfc3dSmrg    other respects; for example, they cover modification of the file,
191debfc3dSmrg    and distribution when not linked into a combine executable.)
201debfc3dSmrg 
211debfc3dSmrg    The GNU C Library is distributed in the hope that it will be useful,
221debfc3dSmrg    but WITHOUT ANY WARRANTY; without even the implied warranty of
231debfc3dSmrg    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
241debfc3dSmrg    Lesser General Public License for more details.
251debfc3dSmrg 
261debfc3dSmrg    You should have received a copy of the GNU Lesser General Public
271debfc3dSmrg    License along with the GNU C Library; if not, see
281debfc3dSmrg    <http://www.gnu.org/licenses/>.  */
291debfc3dSmrg 
301debfc3dSmrg #include "soft-fp.h"
311debfc3dSmrg #include "extended.h"
321debfc3dSmrg #include "quad.h"
331debfc3dSmrg 
341debfc3dSmrg TFtype
__extendxftf2(XFtype a)351debfc3dSmrg __extendxftf2 (XFtype a)
361debfc3dSmrg {
371debfc3dSmrg   FP_DECL_EX;
381debfc3dSmrg   FP_DECL_E (A);
391debfc3dSmrg   FP_DECL_Q (R);
401debfc3dSmrg   TFtype r;
411debfc3dSmrg 
421debfc3dSmrg   FP_INIT_TRAPPING_EXCEPTIONS;
431debfc3dSmrg   FP_UNPACK_RAW_E (A, a);
44*8feb0f0bSmrg #if _FP_W_TYPE_SIZE < 64
451debfc3dSmrg   FP_EXTEND (Q, E, 4, 4, R, A);
461debfc3dSmrg #else
471debfc3dSmrg   FP_EXTEND (Q, E, 2, 2, R, A);
481debfc3dSmrg #endif
491debfc3dSmrg   FP_PACK_RAW_Q (r, R);
501debfc3dSmrg   FP_HANDLE_EXCEPTIONS;
511debfc3dSmrg 
521debfc3dSmrg   return r;
531debfc3dSmrg }
54