mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-13 06:40:09 +00:00
4886f34179
Commit 5c0508a318
broke the Alpha
port, as the extra parenthesis got in the way of some token pasting
that we were doing in a redefined raw unpack macro.
Avoid this situation in the future by not attempting to redefine a
basic macro, but rather work from the outermost public interface.
The compiler does in fact see through the added indirection.
* sysdeps/alpha/soft-fp/local-soft-fp.h (_FP_UNPACK_RAW_2): Remove.
(_FP_PACK_RAW_2): Remove.
(AXP_DECL_RETURN_Q): Rename from FP_DECL_RETURN, use _FP_UNION_Q.
(AXP_RETURN_Q): Rename from FP_RETURN, use _FP_UNION_Q.
(AXP_UNPACK_RAW_Q, AXP_UNPACK_SEMIRAW_Q, AXP_UNPACK_Q): New.
(AXP_PACK_RAW_Q, AXP_PACK_SEMIRAW_Q, AXP_PACK_Q): New.
* sysdeps/alpha/soft-fp/ots_add.c (_OtsAddX): Update to match.
* sysdeps/alpha/soft-fp/ots_cmp.c (internal_equality): Likewise.
* sysdeps/alpha/soft-fp/ots_cmpe.c (internal_compare): Likewise.
* sysdeps/alpha/soft-fp/ots_cvtqux.c (_OtsCvtQUX): Likewise.
* sysdeps/alpha/soft-fp/ots_cvtqx.c (_OtsCvtQX): Likewise.
* sysdeps/alpha/soft-fp/ots_cvttx.c (_OtsConvertFloatTX): Likewise.
* sysdeps/alpha/soft-fp/ots_cvtxq.c (_OtsCvtXQ): Likewise.
* sysdeps/alpha/soft-fp/ots_cvtxt.c (_OtsConvertFloatXT): Likewise.
* sysdeps/alpha/soft-fp/ots_div.c (_OtsDivX): Likewise.
* sysdeps/alpha/soft-fp/ots_mul.c (_OtsMulX): Likewise.
* sysdeps/alpha/soft-fp/ots_nintxq.c (_OtsNintXQ): Likewise.
* sysdeps/alpha/soft-fp/ots_sub.c (_OtsSubX): Likewise.
52 lines
1.6 KiB
C
52 lines
1.6 KiB
C
/* Software floating-point emulation: convert to fortran nearest.
|
|
Copyright (C) 1997-2014 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
Contributed by Richard Henderson (rth@cygnus.com) and
|
|
Jakub Jelinek (jj@ultra.linux.cz).
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library. If not, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include "local-soft-fp.h"
|
|
|
|
long
|
|
_OtsNintXQ (long al, long ah, long _round)
|
|
{
|
|
FP_DECL_EX;
|
|
FP_DECL_Q(A); FP_DECL_Q(B); FP_DECL_Q(C);
|
|
unsigned long r;
|
|
long s;
|
|
|
|
/* If bit 3 is set, then integer overflow detection is requested. */
|
|
s = _round & 8 ? 1 : -1;
|
|
_round = _round & 3;
|
|
|
|
FP_INIT_ROUNDMODE;
|
|
AXP_UNPACK_SEMIRAW_Q(A, a);
|
|
|
|
/* Build 0.5 * sign(A) */
|
|
B_e = _FP_EXPBIAS_Q;
|
|
__FP_FRAC_SET_2 (B, 0, 0);
|
|
B_s = A_s;
|
|
|
|
FP_ADD_Q(C, A, B);
|
|
_FP_FRAC_SRL_2(C, _FP_WORKBITS);
|
|
_FP_FRAC_HIGH_RAW_Q(C) &= ~(_FP_W_TYPE)_FP_IMPLBIT_Q;
|
|
FP_TO_INT_Q(r, C, 64, s);
|
|
if (s > 0 && (_fex &= FP_EX_INVALID))
|
|
FP_HANDLE_EXCEPTIONS;
|
|
|
|
return r;
|
|
}
|