Back to index

glibc  2.9
qp_stoq.c
Go to the documentation of this file.
00001 /* Software floating-point emulation.
00002    (*c) = (long double)(a)
00003    Copyright (C) 1997,1999,2006 Free Software Foundation, Inc.
00004    This file is part of the GNU C Library.
00005    Contributed by Richard Henderson (rth@cygnus.com) and
00006                 Jakub Jelinek (jj@ultra.linux.cz).
00007 
00008    The GNU C Library is free software; you can redistribute it and/or
00009    modify it under the terms of the GNU Lesser General Public
00010    License as published by the Free Software Foundation; either
00011    version 2.1 of the License, or (at your option) any later version.
00012 
00013    The GNU C Library is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016    Lesser General Public License for more details.
00017 
00018    You should have received a copy of the GNU Lesser General Public
00019    License along with the GNU C Library; if not, write to the Free
00020    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00021    02111-1307 USA.  */
00022 
00023 #include "soft-fp.h"
00024 #include "single.h"
00025 #include "quad.h"
00026 
00027 void _Qp_stoq(long double *c, const float a)
00028 {
00029   FP_DECL_EX;
00030   FP_DECL_S(A);
00031   FP_DECL_Q(C);
00032 
00033   FP_INIT_ROUNDMODE;
00034   FP_UNPACK_RAW_S(A, a);
00035 #if (2 * _FP_W_TYPE_SIZE) < _FP_FRACBITS_Q
00036   FP_EXTEND(Q,S,4,1,C,A);
00037 #else
00038   FP_EXTEND(Q,S,2,1,C,A);
00039 #endif
00040   FP_PACK_RAW_QP(c, C);
00041   QP_HANDLE_EXCEPTIONS(__asm (
00042 "      fstoq %1, %%f60\n"
00043 "      std %%f60, [%0]\n"
00044 "      std %%f62, [%0+8]\n"
00045 "      " : : "r" (c), "f" (a) : QP_CLOBBER));
00046 }