extendsfdf2.c revision 169689
11590Srgrimes/* Software floating-point emulation.
21590Srgrimes   Return a converted to IEEE double
31590Srgrimes   Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
41590Srgrimes   This file is part of the GNU C Library.
51590Srgrimes   Contributed by Richard Henderson (rth@cygnus.com) and
61590Srgrimes		  Jakub Jelinek (jj@ultra.linux.cz).
71590Srgrimes
81590Srgrimes   The GNU C Library is free software; you can redistribute it and/or
91590Srgrimes   modify it under the terms of the GNU Lesser General Public
101590Srgrimes   License as published by the Free Software Foundation; either
111590Srgrimes   version 2.1 of the License, or (at your option) any later version.
121590Srgrimes
131590Srgrimes   In addition to the permissions in the GNU Lesser General Public
141590Srgrimes   License, the Free Software Foundation gives you unlimited
151590Srgrimes   permission to link the compiled version of this file into
161590Srgrimes   combinations with other programs, and to distribute those
171590Srgrimes   combinations without any restriction coming from the use of this
181590Srgrimes   file.  (The Lesser General Public License restrictions do apply in
191590Srgrimes   other respects; for example, they cover modification of the file,
201590Srgrimes   and distribution when not linked into a combine executable.)
211590Srgrimes
221590Srgrimes   The GNU C Library is distributed in the hope that it will be useful,
231590Srgrimes   but WITHOUT ANY WARRANTY; without even the implied warranty of
241590Srgrimes   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
251590Srgrimes   Lesser General Public License for more details.
261590Srgrimes
271590Srgrimes   You should have received a copy of the GNU Lesser General Public
281590Srgrimes   License along with the GNU C Library; if not, write to the Free
291590Srgrimes   Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
301590Srgrimes   MA 02110-1301, USA.  */
311590Srgrimes
3250477Speter#include "soft-fp.h"
331590Srgrimes#include "single.h"
34264743Spfg#include "double.h"
351590Srgrimes
361590SrgrimesDFtype __extendsfdf2(SFtype a)
371590Srgrimes{
381590Srgrimes  FP_DECL_EX;
391590Srgrimes  FP_DECL_S(A);
401590Srgrimes  FP_DECL_D(R);
4127887Scharnier  DFtype r;
42131507Sru
431590Srgrimes  FP_INIT_ROUNDMODE;
4495124Scharnier  FP_UNPACK_RAW_S(A, a);
4595124Scharnier#if _FP_W_TYPE_SIZE < _FP_FRACBITS_D
4695124Scharnier  FP_EXTEND(D,S,2,1,R,A);
471590Srgrimes#else
48131507Sru  FP_EXTEND(D,S,1,1,R,A);
491590Srgrimes#endif
501590Srgrimes  FP_PACK_RAW_D(r, R);
511590Srgrimes  FP_HANDLE_EXCEPTIONS;
521590Srgrimes
531590Srgrimes  return r;
541590Srgrimes}
55131507Sru