xref: /netbsd-src/external/gpl3/gcc/dist/libgcc/soft-fp/extendsftf2.c (revision fb8a8121f28072308659629b86cfb7c449bd93e1)
148fb7bfaSmrg /* Software floating-point emulation.
248fb7bfaSmrg    Return a converted to IEEE quad
3*fb8a8121Smrg    Copyright (C) 1997-2019 Free Software Foundation, Inc.
448fb7bfaSmrg    This file is part of the GNU C Library.
548fb7bfaSmrg    Contributed by Richard Henderson (rth@cygnus.com) and
648fb7bfaSmrg 		  Jakub Jelinek (jj@ultra.linux.cz).
748fb7bfaSmrg 
848fb7bfaSmrg    The GNU C Library is free software; you can redistribute it and/or
948fb7bfaSmrg    modify it under the terms of the GNU Lesser General Public
1048fb7bfaSmrg    License as published by the Free Software Foundation; either
1148fb7bfaSmrg    version 2.1 of the License, or (at your option) any later version.
1248fb7bfaSmrg 
1348fb7bfaSmrg    In addition to the permissions in the GNU Lesser General Public
1448fb7bfaSmrg    License, the Free Software Foundation gives you unlimited
1548fb7bfaSmrg    permission to link the compiled version of this file into
1648fb7bfaSmrg    combinations with other programs, and to distribute those
1748fb7bfaSmrg    combinations without any restriction coming from the use of this
1848fb7bfaSmrg    file.  (The Lesser General Public License restrictions do apply in
1948fb7bfaSmrg    other respects; for example, they cover modification of the file,
2048fb7bfaSmrg    and distribution when not linked into a combine executable.)
2148fb7bfaSmrg 
2248fb7bfaSmrg    The GNU C Library is distributed in the hope that it will be useful,
2348fb7bfaSmrg    but WITHOUT ANY WARRANTY; without even the implied warranty of
2448fb7bfaSmrg    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2548fb7bfaSmrg    Lesser General Public License for more details.
2648fb7bfaSmrg 
2748fb7bfaSmrg    You should have received a copy of the GNU Lesser General Public
2848fb7bfaSmrg    License along with the GNU C Library; if not, see
2948fb7bfaSmrg    <http://www.gnu.org/licenses/>.  */
3048fb7bfaSmrg 
314d5abbe8Smrg #define FP_NO_EXACT_UNDERFLOW
3248fb7bfaSmrg #include "soft-fp.h"
3348fb7bfaSmrg #include "single.h"
3448fb7bfaSmrg #include "quad.h"
3548fb7bfaSmrg 
364d5abbe8Smrg TFtype
__extendsftf2(SFtype a)374d5abbe8Smrg __extendsftf2 (SFtype a)
3848fb7bfaSmrg {
3948fb7bfaSmrg   FP_DECL_EX;
4048fb7bfaSmrg   FP_DECL_S (A);
4148fb7bfaSmrg   FP_DECL_Q (R);
4248fb7bfaSmrg   TFtype r;
4348fb7bfaSmrg 
444d5abbe8Smrg   FP_INIT_EXCEPTIONS;
4548fb7bfaSmrg   FP_UNPACK_RAW_S (A, a);
46*fb8a8121Smrg #if _FP_W_TYPE_SIZE < 64
4748fb7bfaSmrg   FP_EXTEND (Q, S, 4, 1, R, A);
4848fb7bfaSmrg #else
4948fb7bfaSmrg   FP_EXTEND (Q, S, 2, 1, R, A);
5048fb7bfaSmrg #endif
5148fb7bfaSmrg   FP_PACK_RAW_Q (r, R);
5248fb7bfaSmrg   FP_HANDLE_EXCEPTIONS;
5348fb7bfaSmrg 
5448fb7bfaSmrg   return r;
5548fb7bfaSmrg }
56