Back to index

glibc  2.9
qp_fle.c
Go to the documentation of this file.
00001 /* Software floating-point emulation.
00002    Return 1 if (*a) <= (*b)
00003    Copyright (C) 1997,1999 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 "quad.h"
00025 
00026 int _Qp_fle(const long double *a, const long double *b)
00027 {
00028   FP_DECL_EX;
00029   FP_DECL_Q(A); FP_DECL_Q(B);
00030   int r;
00031 
00032   FP_INIT_ROUNDMODE;
00033   FP_UNPACK_RAW_QP(A, a);
00034   FP_UNPACK_RAW_QP(B, b);
00035   FP_CMP_Q(r, B, A, -2);
00036   if (r == -2)
00037     FP_SET_EXCEPTION(FP_EX_INVALID);
00038 
00039   QP_HANDLE_EXCEPTIONS(
00040        __asm (
00041 "      ldd [%0], %%f52\n"
00042 "      ldd [%0+8], %%f54\n"
00043 "      ldd [%1], %%f56\n"
00044 "      ldd [%1+8], %%f58\n"
00045 "      fcmpeq %%fcc3, %%f52, %%f56\n"
00046 "      " : : "r" (a), "r" (b) : QP_CLOBBER_CC);
00047        _FPU_GETCW(_fcw);
00048        r = ((_fcw >> 36) & 2) ? -1 : 0);
00049 
00050   return (r >= 0);
00051 }