mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
soft-fp: Fix comment formatting.
This patch fixes formatting of comments in soft-fp (in particular, the normal style in glibc does not have a leading '*' on each line, and comments should start with capital letters and end with ". */"). Tested for powerpc-nofpu that the disassembly of installed shared libraries is unchanged by this patch. * soft-fp/extended.h: Fix comment formatting. * soft-fp/op-1.h: Likewise. * soft-fp/op-2.h: Likewise. * soft-fp/op-4.h: Likewise. * soft-fp/op-8.h: Likewise. * soft-fp/op-common.h: Likewise. * soft-fp/soft-fp.h: Likewise.
This commit is contained in:
@ -1,5 +1,13 @@
|
|||||||
2014-09-17 Joseph Myers <joseph@codesourcery.com>
|
2014-09-17 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* soft-fp/extended.h: Fix comment formatting.
|
||||||
|
* soft-fp/op-1.h: Likewise.
|
||||||
|
* soft-fp/op-2.h: Likewise.
|
||||||
|
* soft-fp/op-4.h: Likewise.
|
||||||
|
* soft-fp/op-8.h: Likewise.
|
||||||
|
* soft-fp/op-common.h: Likewise.
|
||||||
|
* soft-fp/soft-fp.h: Likewise.
|
||||||
|
|
||||||
* soft-fp/op-common.h (_FP_TO_INT): Correct formatting.
|
* soft-fp/op-common.h (_FP_TO_INT): Correct formatting.
|
||||||
|
|
||||||
2014-09-16 Joseph Myers <joseph@codesourcery.com>
|
2014-09-16 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
@ -232,16 +232,14 @@ union _FP_UNION_E
|
|||||||
# define FP_SQRT_E(R, X) _FP_SQRT (E, 4, R, X)
|
# define FP_SQRT_E(R, X) _FP_SQRT (E, 4, R, X)
|
||||||
# define FP_FMA_E(R, X, Y, Z) _FP_FMA (E, 4, 8, R, X, Y, Z)
|
# define FP_FMA_E(R, X, Y, Z) _FP_FMA (E, 4, 8, R, X, Y, Z)
|
||||||
|
|
||||||
/*
|
/* Square root algorithms:
|
||||||
* Square root algorithms:
|
We have just one right now, maybe Newton approximation
|
||||||
* We have just one right now, maybe Newton approximation
|
should be added for those machines where division is fast.
|
||||||
* should be added for those machines where division is fast.
|
This has special _E version because standard _4 square
|
||||||
* This has special _E version because standard _4 square
|
root would not work (it has to start normally with the
|
||||||
* root would not work (it has to start normally with the
|
second word and not the first), but as we have to do it
|
||||||
* second word and not the first), but as we have to do it
|
anyway, we optimize it by doing most of the calculations
|
||||||
* anyway, we optimize it by doing most of the calculations
|
in two UWtype registers instead of four. */
|
||||||
* in two UWtype registers instead of four.
|
|
||||||
*/
|
|
||||||
|
|
||||||
# define _FP_SQRT_MEAT_E(R, S, T, X, q) \
|
# define _FP_SQRT_MEAT_E(R, S, T, X, q) \
|
||||||
do \
|
do \
|
||||||
@ -458,14 +456,12 @@ union _FP_UNION_E
|
|||||||
# define FP_SQRT_E(R, X) _FP_SQRT (E, 2, R, X)
|
# define FP_SQRT_E(R, X) _FP_SQRT (E, 2, R, X)
|
||||||
# define FP_FMA_E(R, X, Y, Z) _FP_FMA (E, 2, 4, R, X, Y, Z)
|
# define FP_FMA_E(R, X, Y, Z) _FP_FMA (E, 2, 4, R, X, Y, Z)
|
||||||
|
|
||||||
/*
|
/* Square root algorithms:
|
||||||
* Square root algorithms:
|
We have just one right now, maybe Newton approximation
|
||||||
* We have just one right now, maybe Newton approximation
|
should be added for those machines where division is fast.
|
||||||
* should be added for those machines where division is fast.
|
We optimize it by doing most of the calculations
|
||||||
* We optimize it by doing most of the calculations
|
in one UWtype registers instead of two, although we don't
|
||||||
* in one UWtype registers instead of two, although we don't
|
have to. */
|
||||||
* have to.
|
|
||||||
*/
|
|
||||||
# define _FP_SQRT_MEAT_E(R, S, T, X, q) \
|
# define _FP_SQRT_MEAT_E(R, S, T, X, q) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
#define _FP_FRAC_DEC_1(X, Y) (X##_f -= Y##_f)
|
#define _FP_FRAC_DEC_1(X, Y) (X##_f -= Y##_f)
|
||||||
#define _FP_FRAC_CLZ_1(z, X) __FP_CLZ (z, X##_f)
|
#define _FP_FRAC_CLZ_1(z, X) __FP_CLZ (z, X##_f)
|
||||||
|
|
||||||
/* Predicates */
|
/* Predicates. */
|
||||||
#define _FP_FRAC_NEGP_1(X) ((_FP_WS_TYPE) X##_f < 0)
|
#define _FP_FRAC_NEGP_1(X) ((_FP_WS_TYPE) X##_f < 0)
|
||||||
#define _FP_FRAC_ZEROP_1(X) (X##_f == 0)
|
#define _FP_FRAC_ZEROP_1(X) (X##_f == 0)
|
||||||
#define _FP_FRAC_OVERP_1(fs, X) (X##_f & _FP_OVERFLOW_##fs)
|
#define _FP_FRAC_OVERP_1(fs, X) (X##_f & _FP_OVERFLOW_##fs)
|
||||||
@ -87,10 +87,8 @@
|
|||||||
#define _FP_MINFRAC_1 1
|
#define _FP_MINFRAC_1 1
|
||||||
#define _FP_MAXFRAC_1 (~(_FP_WS_TYPE) 0)
|
#define _FP_MAXFRAC_1 (~(_FP_WS_TYPE) 0)
|
||||||
|
|
||||||
/*
|
/* Unpack the raw bits of a native fp value. Do not classify or
|
||||||
* Unpack the raw bits of a native fp value. Do not classify or
|
normalize the data. */
|
||||||
* normalize the data.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_UNPACK_RAW_1(fs, X, val) \
|
#define _FP_UNPACK_RAW_1(fs, X, val) \
|
||||||
do \
|
do \
|
||||||
@ -116,9 +114,7 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/*
|
/* Repack the raw bits of a native fp value. */
|
||||||
* Repack the raw bits of a native fp value.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_PACK_RAW_1(fs, val, X) \
|
#define _FP_PACK_RAW_1(fs, val, X) \
|
||||||
do \
|
do \
|
||||||
@ -146,9 +142,7 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Multiplication algorithms: */
|
||||||
* Multiplication algorithms:
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the
|
/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the
|
||||||
multiplication immediately. */
|
multiplication immediately. */
|
||||||
@ -203,7 +197,7 @@
|
|||||||
_FP_W_TYPE _FP_MUL_MEAT_DW_1_hard_yh, _FP_MUL_MEAT_DW_1_hard_yl; \
|
_FP_W_TYPE _FP_MUL_MEAT_DW_1_hard_yh, _FP_MUL_MEAT_DW_1_hard_yl; \
|
||||||
_FP_FRAC_DECL_2 (_FP_MUL_MEAT_DW_1_hard_a); \
|
_FP_FRAC_DECL_2 (_FP_MUL_MEAT_DW_1_hard_a); \
|
||||||
\
|
\
|
||||||
/* split the words in half */ \
|
/* Split the words in half. */ \
|
||||||
_FP_MUL_MEAT_DW_1_hard_xh = X##_f >> (_FP_W_TYPE_SIZE/2); \
|
_FP_MUL_MEAT_DW_1_hard_xh = X##_f >> (_FP_W_TYPE_SIZE/2); \
|
||||||
_FP_MUL_MEAT_DW_1_hard_xl \
|
_FP_MUL_MEAT_DW_1_hard_xl \
|
||||||
= X##_f & (((_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE/2)) - 1); \
|
= X##_f & (((_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE/2)) - 1); \
|
||||||
@ -211,7 +205,7 @@
|
|||||||
_FP_MUL_MEAT_DW_1_hard_yl \
|
_FP_MUL_MEAT_DW_1_hard_yl \
|
||||||
= Y##_f & (((_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE/2)) - 1); \
|
= Y##_f & (((_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE/2)) - 1); \
|
||||||
\
|
\
|
||||||
/* multiply the pieces */ \
|
/* Multiply the pieces. */ \
|
||||||
R##_f0 = _FP_MUL_MEAT_DW_1_hard_xl * _FP_MUL_MEAT_DW_1_hard_yl; \
|
R##_f0 = _FP_MUL_MEAT_DW_1_hard_xl * _FP_MUL_MEAT_DW_1_hard_yl; \
|
||||||
_FP_MUL_MEAT_DW_1_hard_a_f0 \
|
_FP_MUL_MEAT_DW_1_hard_a_f0 \
|
||||||
= _FP_MUL_MEAT_DW_1_hard_xh * _FP_MUL_MEAT_DW_1_hard_yl; \
|
= _FP_MUL_MEAT_DW_1_hard_xh * _FP_MUL_MEAT_DW_1_hard_yl; \
|
||||||
@ -219,7 +213,7 @@
|
|||||||
= _FP_MUL_MEAT_DW_1_hard_xl * _FP_MUL_MEAT_DW_1_hard_yh; \
|
= _FP_MUL_MEAT_DW_1_hard_xl * _FP_MUL_MEAT_DW_1_hard_yh; \
|
||||||
R##_f1 = _FP_MUL_MEAT_DW_1_hard_xh * _FP_MUL_MEAT_DW_1_hard_yh; \
|
R##_f1 = _FP_MUL_MEAT_DW_1_hard_xh * _FP_MUL_MEAT_DW_1_hard_yh; \
|
||||||
\
|
\
|
||||||
/* reassemble into two full words */ \
|
/* Reassemble into two full words. */ \
|
||||||
if ((_FP_MUL_MEAT_DW_1_hard_a_f0 += _FP_MUL_MEAT_DW_1_hard_a_f1) \
|
if ((_FP_MUL_MEAT_DW_1_hard_a_f0 += _FP_MUL_MEAT_DW_1_hard_a_f1) \
|
||||||
< _FP_MUL_MEAT_DW_1_hard_a_f1) \
|
< _FP_MUL_MEAT_DW_1_hard_a_f1) \
|
||||||
R##_f1 += (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE/2); \
|
R##_f1 += (_FP_W_TYPE) 1 << (_FP_W_TYPE_SIZE/2); \
|
||||||
@ -237,7 +231,7 @@
|
|||||||
_FP_FRAC_DECL_2 (_FP_MUL_MEAT_1_hard_z); \
|
_FP_FRAC_DECL_2 (_FP_MUL_MEAT_1_hard_z); \
|
||||||
_FP_MUL_MEAT_DW_1_hard (wfracbits, _FP_MUL_MEAT_1_hard_z, X, Y); \
|
_FP_MUL_MEAT_DW_1_hard (wfracbits, _FP_MUL_MEAT_1_hard_z, X, Y); \
|
||||||
\
|
\
|
||||||
/* normalize */ \
|
/* Normalize. */ \
|
||||||
_FP_FRAC_SRS_2 (_FP_MUL_MEAT_1_hard_z, \
|
_FP_FRAC_SRS_2 (_FP_MUL_MEAT_1_hard_z, \
|
||||||
wfracbits - 1, 2*wfracbits); \
|
wfracbits - 1, 2*wfracbits); \
|
||||||
R##_f = _FP_MUL_MEAT_1_hard_z_f0; \
|
R##_f = _FP_MUL_MEAT_1_hard_z_f0; \
|
||||||
@ -245,9 +239,7 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Division algorithms: */
|
||||||
* Division algorithms:
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the
|
/* Basic. Assuming the host word size is >= 2*FRACBITS, we can do the
|
||||||
division immediately. Give this macro either _FP_DIV_HELP_imm for
|
division immediately. Give this macro either _FP_DIV_HELP_imm for
|
||||||
@ -330,11 +322,9 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Square root algorithms:
|
||||||
* Square root algorithms:
|
We have just one right now, maybe Newton approximation
|
||||||
* We have just one right now, maybe Newton approximation
|
should be added for those machines where division is fast. */
|
||||||
* should be added for those machines where division is fast.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_SQRT_MEAT_1(R, S, T, X, q) \
|
#define _FP_SQRT_MEAT_1(R, S, T, X, q) \
|
||||||
do \
|
do \
|
||||||
@ -360,17 +350,13 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/*
|
/* Assembly/disassembly for converting to/from integral types.
|
||||||
* Assembly/disassembly for converting to/from integral types.
|
No shifting or overflow handled here. */
|
||||||
* No shifting or overflow handled here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_FRAC_ASSEMBLE_1(r, X, rsize) (r = X##_f)
|
#define _FP_FRAC_ASSEMBLE_1(r, X, rsize) (r = X##_f)
|
||||||
#define _FP_FRAC_DISASSEMBLE_1(X, r, rsize) (X##_f = r)
|
#define _FP_FRAC_DISASSEMBLE_1(X, r, rsize) (X##_f = r)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Convert FP values between word sizes. */
|
||||||
* Convert FP values between word sizes
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_FRAC_COPY_1_1(D, S) (D##_f = S##_f)
|
#define _FP_FRAC_COPY_1_1(D, S) (D##_f = S##_f)
|
||||||
|
@ -131,7 +131,7 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/* Predicates */
|
/* Predicates. */
|
||||||
#define _FP_FRAC_NEGP_2(X) ((_FP_WS_TYPE) X##_f1 < 0)
|
#define _FP_FRAC_NEGP_2(X) ((_FP_WS_TYPE) X##_f1 < 0)
|
||||||
#define _FP_FRAC_ZEROP_2(X) ((X##_f1 | X##_f0) == 0)
|
#define _FP_FRAC_ZEROP_2(X) ((X##_f1 | X##_f0) == 0)
|
||||||
#define _FP_FRAC_OVERP_2(fs, X) (_FP_FRAC_HIGH_##fs (X) & _FP_OVERFLOW_##fs)
|
#define _FP_FRAC_OVERP_2(fs, X) (_FP_FRAC_HIGH_##fs (X) & _FP_OVERFLOW_##fs)
|
||||||
@ -148,9 +148,7 @@
|
|||||||
#define _FP_MINFRAC_2 0, 1
|
#define _FP_MINFRAC_2 0, 1
|
||||||
#define _FP_MAXFRAC_2 (~(_FP_WS_TYPE) 0), (~(_FP_WS_TYPE) 0)
|
#define _FP_MAXFRAC_2 (~(_FP_WS_TYPE) 0), (~(_FP_WS_TYPE) 0)
|
||||||
|
|
||||||
/*
|
/* Internals. */
|
||||||
* Internals
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define __FP_FRAC_SET_2(X, I1, I0) (X##_f0 = I0, X##_f1 = I1)
|
#define __FP_FRAC_SET_2(X, I1, I0) (X##_f0 = I0, X##_f1 = I1)
|
||||||
|
|
||||||
@ -205,10 +203,8 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* Unpack the raw bits of a native fp value. Do not classify or
|
||||||
* Unpack the raw bits of a native fp value. Do not classify or
|
normalize the data. */
|
||||||
* normalize the data.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_UNPACK_RAW_2(fs, X, val) \
|
#define _FP_UNPACK_RAW_2(fs, X, val) \
|
||||||
do \
|
do \
|
||||||
@ -237,9 +233,7 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Repack the raw bits of a native fp value. */
|
||||||
* Repack the raw bits of a native fp value.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_PACK_RAW_2(fs, val, X) \
|
#define _FP_PACK_RAW_2(fs, val, X) \
|
||||||
do \
|
do \
|
||||||
@ -269,9 +263,7 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Multiplication algorithms: */
|
||||||
* Multiplication algorithms:
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
|
/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
|
||||||
|
|
||||||
@ -532,9 +524,7 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/*
|
/* Division algorithms: */
|
||||||
* Division algorithms:
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_DIV_MEAT_2_udiv(fs, R, X, Y) \
|
#define _FP_DIV_MEAT_2_udiv(fs, R, X, Y) \
|
||||||
do \
|
do \
|
||||||
@ -563,7 +553,7 @@
|
|||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
/* Normalize, i.e. make the most significant bit of the \
|
/* Normalize, i.e. make the most significant bit of the \
|
||||||
denominator set. */ \
|
denominator set. */ \
|
||||||
_FP_FRAC_SLL_2 (Y, _FP_WFRACXBITS_##fs); \
|
_FP_FRAC_SLL_2 (Y, _FP_WFRACXBITS_##fs); \
|
||||||
\
|
\
|
||||||
udiv_qrnnd (R##_f1, _FP_DIV_MEAT_2_udiv_r_f1, \
|
udiv_qrnnd (R##_f1, _FP_DIV_MEAT_2_udiv_r_f1, \
|
||||||
@ -630,11 +620,9 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Square root algorithms:
|
||||||
* Square root algorithms:
|
We have just one right now, maybe Newton approximation
|
||||||
* We have just one right now, maybe Newton approximation
|
should be added for those machines where division is fast. */
|
||||||
* should be added for those machines where division is fast.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_SQRT_MEAT_2(R, S, T, X, q) \
|
#define _FP_SQRT_MEAT_2(R, S, T, X, q) \
|
||||||
do \
|
do \
|
||||||
@ -678,10 +666,8 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Assembly/disassembly for converting to/from integral types.
|
||||||
* Assembly/disassembly for converting to/from integral types.
|
No shifting or overflow handled here. */
|
||||||
* No shifting or overflow handled here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_FRAC_ASSEMBLE_2(r, X, rsize) \
|
#define _FP_FRAC_ASSEMBLE_2(r, X, rsize) \
|
||||||
(void) ((rsize <= _FP_W_TYPE_SIZE) \
|
(void) ((rsize <= _FP_W_TYPE_SIZE) \
|
||||||
@ -700,9 +686,7 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/*
|
/* Convert FP values between word sizes. */
|
||||||
* Convert FP values between word sizes
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_FRAC_COPY_1_2(D, S) (D##_f = S##_f0)
|
#define _FP_FRAC_COPY_1_2(D, S) (D##_f = S##_f0)
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/* This one was broken too */
|
/* This one was broken too. */
|
||||||
#define _FP_FRAC_SRL_4(X, N) \
|
#define _FP_FRAC_SRL_4(X, N) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
@ -104,10 +104,9 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Right shift with sticky-lsb.
|
/* Right shift with sticky-lsb.
|
||||||
* What this actually means is that we do a standard right-shift,
|
What this actually means is that we do a standard right-shift,
|
||||||
* but that if any of the bits that fall off the right hand side
|
but that if any of the bits that fall off the right hand side
|
||||||
* were one then we always set the LSbit.
|
were one then we always set the LSbit. */
|
||||||
*/
|
|
||||||
#define _FP_FRAC_SRST_4(X, S, N, size) \
|
#define _FP_FRAC_SRST_4(X, S, N, size) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
@ -290,9 +289,7 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/*
|
/* Multiplication algorithms: */
|
||||||
* Multiplication algorithms:
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
|
/* Given a 1W * 1W => 2W primitive, do the extended multiplication. */
|
||||||
|
|
||||||
@ -467,10 +464,8 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/*
|
/* Helper utility for _FP_DIV_MEAT_4_udiv:
|
||||||
* Helper utility for _FP_DIV_MEAT_4_udiv:
|
* pppp = m * nnn. */
|
||||||
* pppp = m * nnn
|
|
||||||
*/
|
|
||||||
#define umul_ppppmnnn(p3, p2, p1, p0, m, n2, n1, n0) \
|
#define umul_ppppmnnn(p3, p2, p1, p0, m, n2, n1, n0) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
@ -483,9 +478,7 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/*
|
/* Division algorithms: */
|
||||||
* Division algorithms:
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_DIV_MEAT_4_udiv(fs, R, X, Y) \
|
#define _FP_DIV_MEAT_4_udiv(fs, R, X, Y) \
|
||||||
do \
|
do \
|
||||||
@ -504,7 +497,7 @@
|
|||||||
R##_e--; \
|
R##_e--; \
|
||||||
\
|
\
|
||||||
/* Normalize, i.e. make the most significant bit of the \
|
/* Normalize, i.e. make the most significant bit of the \
|
||||||
denominator set. */ \
|
denominator set. */ \
|
||||||
_FP_FRAC_SLL_4 (Y, _FP_WFRACXBITS_##fs); \
|
_FP_FRAC_SLL_4 (Y, _FP_WFRACXBITS_##fs); \
|
||||||
\
|
\
|
||||||
for (_FP_DIV_MEAT_4_udiv_i = 3; ; _FP_DIV_MEAT_4_udiv_i--) \
|
for (_FP_DIV_MEAT_4_udiv_i = 3; ; _FP_DIV_MEAT_4_udiv_i--) \
|
||||||
@ -568,11 +561,9 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Square root algorithms:
|
||||||
* Square root algorithms:
|
We have just one right now, maybe Newton approximation
|
||||||
* We have just one right now, maybe Newton approximation
|
should be added for those machines where division is fast. */
|
||||||
* should be added for those machines where division is fast.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_SQRT_MEAT_4(R, S, T, X, q) \
|
#define _FP_SQRT_MEAT_4(R, S, T, X, q) \
|
||||||
do \
|
do \
|
||||||
@ -657,9 +648,7 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Internals. */
|
||||||
* Internals
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define __FP_FRAC_SET_4(X, I3, I2, I1, I0) \
|
#define __FP_FRAC_SET_4(X, I3, I2, I1, I0) \
|
||||||
(X##_f[3] = I3, X##_f[2] = I2, X##_f[1] = I1, X##_f[0] = I0)
|
(X##_f[3] = I3, X##_f[2] = I2, X##_f[1] = I1, X##_f[0] = I0)
|
||||||
@ -787,12 +776,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convert FP values between word sizes. This appears to be more
|
/* Convert FP values between word sizes. This appears to be more
|
||||||
* complicated than I'd have expected it to be, so these might be
|
complicated than I'd have expected it to be, so these might be
|
||||||
* wrong... These macros are in any case somewhat bogus because they
|
wrong... These macros are in any case somewhat bogus because they
|
||||||
* use information about what various FRAC_n variables look like
|
use information about what various FRAC_n variables look like
|
||||||
* internally [eg, that 2 word vars are X_f0 and x_f1]. But so do
|
internally [eg, that 2 word vars are X_f0 and x_f1]. But so do
|
||||||
* the ones in op-2.h and op-1.h.
|
the ones in op-2.h and op-1.h. */
|
||||||
*/
|
|
||||||
#define _FP_FRAC_COPY_1_4(D, S) (D##_f = S##_f[0])
|
#define _FP_FRAC_COPY_1_4(D, S) (D##_f = S##_f[0])
|
||||||
|
|
||||||
#define _FP_FRAC_COPY_2_4(D, S) \
|
#define _FP_FRAC_COPY_2_4(D, S) \
|
||||||
@ -804,9 +792,8 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/* Assembly/disassembly for converting to/from integral types.
|
/* Assembly/disassembly for converting to/from integral types.
|
||||||
* No shifting or overflow handled here.
|
No shifting or overflow handled here. */
|
||||||
*/
|
/* Put the FP value X into r, which is an integer of size rsize. */
|
||||||
/* Put the FP value X into r, which is an integer of size rsize. */
|
|
||||||
#define _FP_FRAC_ASSEMBLE_4(r, X, rsize) \
|
#define _FP_FRAC_ASSEMBLE_4(r, X, rsize) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
@ -820,8 +807,8 @@
|
|||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
/* I'm feeling lazy so we deal with int == 3words (implausible)*/ \
|
/* I'm feeling lazy so we deal with int == 3words \
|
||||||
/* and int == 4words as a single case. */ \
|
(implausible) and int == 4words as a single case. */ \
|
||||||
r = X##_f[3]; \
|
r = X##_f[3]; \
|
||||||
r = (rsize <= _FP_W_TYPE_SIZE ? 0 : r << _FP_W_TYPE_SIZE); \
|
r = (rsize <= _FP_W_TYPE_SIZE ? 0 : r << _FP_W_TYPE_SIZE); \
|
||||||
r += X##_f[2]; \
|
r += X##_f[2]; \
|
||||||
@ -834,10 +821,9 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/* "No disassemble Number Five!" */
|
/* "No disassemble Number Five!" */
|
||||||
/* move an integer of size rsize into X's fractional part. We rely on
|
/* Move an integer of size rsize into X's fractional part. We rely on
|
||||||
* the _f[] array consisting of words of size _FP_W_TYPE_SIZE to avoid
|
the _f[] array consisting of words of size _FP_W_TYPE_SIZE to avoid
|
||||||
* having to mask the values we store into it.
|
having to mask the values we store into it. */
|
||||||
*/
|
|
||||||
#define _FP_FRAC_DISASSEMBLE_4(X, r, rsize) \
|
#define _FP_FRAC_DISASSEMBLE_4(X, r, rsize) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
/* We need just a few things from here for op-4, if we ever need some
|
/* We need just a few things from here for op-4, if we ever need some
|
||||||
other macros, they can be added. */
|
other macros, they can be added. */
|
||||||
#define _FP_FRAC_DECL_8(X) _FP_W_TYPE X##_f[8]
|
#define _FP_FRAC_DECL_8(X) _FP_W_TYPE X##_f[8]
|
||||||
#define _FP_FRAC_HIGH_8(X) (X##_f[7])
|
#define _FP_FRAC_HIGH_8(X) (X##_f[7])
|
||||||
#define _FP_FRAC_LOW_8(X) (X##_f[0])
|
#define _FP_FRAC_LOW_8(X) (X##_f[0])
|
||||||
@ -100,10 +100,9 @@
|
|||||||
|
|
||||||
|
|
||||||
/* Right shift with sticky-lsb.
|
/* Right shift with sticky-lsb.
|
||||||
* What this actually means is that we do a standard right-shift,
|
What this actually means is that we do a standard right-shift,
|
||||||
* but that if any of the bits that fall off the right hand side
|
but that if any of the bits that fall off the right hand side
|
||||||
* were one then we always set the LSbit.
|
were one then we always set the LSbit. */
|
||||||
*/
|
|
||||||
#define _FP_FRAC_SRS_8(X, N, size) \
|
#define _FP_FRAC_SRS_8(X, N, size) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
@ -139,8 +138,8 @@
|
|||||||
} \
|
} \
|
||||||
for (; _FP_FRAC_SRS_8_i < 8; ++_FP_FRAC_SRS_8_i) \
|
for (; _FP_FRAC_SRS_8_i < 8; ++_FP_FRAC_SRS_8_i) \
|
||||||
X##_f[_FP_FRAC_SRS_8_i] = 0; \
|
X##_f[_FP_FRAC_SRS_8_i] = 0; \
|
||||||
/* don't fix the LSB until the very end when we're sure f[0] is \
|
/* Don't fix the LSB until the very end when we're sure f[0] is \
|
||||||
stable */ \
|
stable. */ \
|
||||||
X##_f[0] |= (_FP_FRAC_SRS_8_s != 0); \
|
X##_f[0] |= (_FP_FRAC_SRS_8_s != 0); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
@ -45,10 +45,8 @@
|
|||||||
? (_FP_FRAC_HIGH_##fs (X) & _FP_QNANBIT_SH_##fs) \
|
? (_FP_FRAC_HIGH_##fs (X) & _FP_QNANBIT_SH_##fs) \
|
||||||
: !(_FP_FRAC_HIGH_##fs (X) & _FP_QNANBIT_SH_##fs))
|
: !(_FP_FRAC_HIGH_##fs (X) & _FP_QNANBIT_SH_##fs))
|
||||||
|
|
||||||
/*
|
/* Finish truly unpacking a native fp value by classifying the kind
|
||||||
* Finish truly unpacking a native fp value by classifying the kind
|
of fp value and normalizing both the exponent and the fraction. */
|
||||||
* of fp value and normalizing both the exponent and the fraction.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_UNPACK_CANONICAL(fs, wc, X) \
|
#define _FP_UNPACK_CANONICAL(fs, wc, X) \
|
||||||
do \
|
do \
|
||||||
@ -67,7 +65,7 @@
|
|||||||
X##_c = FP_CLS_ZERO; \
|
X##_c = FP_CLS_ZERO; \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
/* a denormalized number */ \
|
/* A denormalized number. */ \
|
||||||
_FP_I_TYPE _FP_UNPACK_CANONICAL_shift; \
|
_FP_I_TYPE _FP_UNPACK_CANONICAL_shift; \
|
||||||
_FP_FRAC_CLZ_##wc (_FP_UNPACK_CANONICAL_shift, \
|
_FP_FRAC_CLZ_##wc (_FP_UNPACK_CANONICAL_shift, \
|
||||||
X); \
|
X); \
|
||||||
@ -87,7 +85,7 @@
|
|||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
X##_c = FP_CLS_NAN; \
|
X##_c = FP_CLS_NAN; \
|
||||||
/* Check for signaling NaN */ \
|
/* Check for signaling NaN. */ \
|
||||||
if (_FP_FRAC_SNANP (fs, X)) \
|
if (_FP_FRAC_SNANP (fs, X)) \
|
||||||
FP_SET_EXCEPTION (FP_EX_INVALID); \
|
FP_SET_EXCEPTION (FP_EX_INVALID); \
|
||||||
} \
|
} \
|
||||||
@ -237,12 +235,10 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/*
|
/* Before packing the bits back into the native fp result, take care
|
||||||
* Before packing the bits back into the native fp result, take care
|
of such mundane things as rounding and overflow. Also, for some
|
||||||
* of such mundane things as rounding and overflow. Also, for some
|
kinds of fp values, the original parts may not have been fully
|
||||||
* kinds of fp values, the original parts may not have been fully
|
extracted -- but that is ok, we can regenerate them now. */
|
||||||
* extracted -- but that is ok, we can regenerate them now.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_PACK_CANONICAL(fs, wc, X) \
|
#define _FP_PACK_CANONICAL(fs, wc, X) \
|
||||||
do \
|
do \
|
||||||
@ -262,7 +258,7 @@
|
|||||||
_FP_FRAC_SRL_##wc (X, _FP_WORKBITS); \
|
_FP_FRAC_SRL_##wc (X, _FP_WORKBITS); \
|
||||||
if (X##_e >= _FP_EXPMAX_##fs) \
|
if (X##_e >= _FP_EXPMAX_##fs) \
|
||||||
{ \
|
{ \
|
||||||
/* overflow */ \
|
/* Overflow. */ \
|
||||||
switch (FP_ROUNDMODE) \
|
switch (FP_ROUNDMODE) \
|
||||||
{ \
|
{ \
|
||||||
case FP_RND_NEAREST: \
|
case FP_RND_NEAREST: \
|
||||||
@ -279,13 +275,13 @@
|
|||||||
} \
|
} \
|
||||||
if (X##_c == FP_CLS_INF) \
|
if (X##_c == FP_CLS_INF) \
|
||||||
{ \
|
{ \
|
||||||
/* Overflow to infinity */ \
|
/* Overflow to infinity. */ \
|
||||||
X##_e = _FP_EXPMAX_##fs; \
|
X##_e = _FP_EXPMAX_##fs; \
|
||||||
_FP_FRAC_SET_##wc (X, _FP_ZEROFRAC_##wc); \
|
_FP_FRAC_SET_##wc (X, _FP_ZEROFRAC_##wc); \
|
||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
/* Overflow to maximum normal */ \
|
/* Overflow to maximum normal. */ \
|
||||||
X##_e = _FP_EXPMAX_##fs - 1; \
|
X##_e = _FP_EXPMAX_##fs - 1; \
|
||||||
_FP_FRAC_SET_##wc (X, _FP_MAXFRAC_##wc); \
|
_FP_FRAC_SET_##wc (X, _FP_MAXFRAC_##wc); \
|
||||||
} \
|
} \
|
||||||
@ -295,7 +291,7 @@
|
|||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
/* we've got a denormalized number */ \
|
/* We've got a denormalized number. */ \
|
||||||
int _FP_PACK_CANONICAL_is_tiny = 1; \
|
int _FP_PACK_CANONICAL_is_tiny = 1; \
|
||||||
if (_FP_TININESS_AFTER_ROUNDING && X##_e == 0) \
|
if (_FP_TININESS_AFTER_ROUNDING && X##_e == 0) \
|
||||||
{ \
|
{ \
|
||||||
@ -332,7 +328,7 @@
|
|||||||
} \
|
} \
|
||||||
else \
|
else \
|
||||||
{ \
|
{ \
|
||||||
/* underflow to zero */ \
|
/* Underflow to zero. */ \
|
||||||
X##_e = 0; \
|
X##_e = 0; \
|
||||||
if (!_FP_FRAC_ZEROP_##wc (X)) \
|
if (!_FP_FRAC_ZEROP_##wc (X)) \
|
||||||
{ \
|
{ \
|
||||||
@ -370,8 +366,7 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/* This one accepts raw argument and not cooked, returns
|
/* This one accepts raw argument and not cooked, returns
|
||||||
* 1 if X is a signaling NaN.
|
1 if X is a signaling NaN. */
|
||||||
*/
|
|
||||||
#define _FP_ISSIGNAN(fs, wc, X) \
|
#define _FP_ISSIGNAN(fs, wc, X) \
|
||||||
({ \
|
({ \
|
||||||
int _FP_ISSIGNAN_ret = 0; \
|
int _FP_ISSIGNAN_ret = 0; \
|
||||||
@ -833,9 +828,7 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Main negation routine. The input value is raw. */
|
||||||
* Main negation routine. The input value is raw.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_NEG(fs, wc, R, X) \
|
#define _FP_NEG(fs, wc, R, X) \
|
||||||
do \
|
do \
|
||||||
@ -847,9 +840,7 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Main multiplication routine. The input values should be cooked. */
|
||||||
* Main multiplication routine. The input values should be cooked.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_MUL(fs, wc, R, X, Y) \
|
#define _FP_MUL(fs, wc, R, X, Y) \
|
||||||
do \
|
do \
|
||||||
@ -1132,9 +1123,7 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Main division routine. The input values should be cooked. */
|
||||||
* Main division routine. The input values should be cooked.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_DIV(fs, wc, R, X, Y) \
|
#define _FP_DIV(fs, wc, R, X, Y) \
|
||||||
do \
|
do \
|
||||||
@ -1197,15 +1186,13 @@
|
|||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Main differential comparison routine. The inputs should be raw not
|
||||||
* Main differential comparison routine. The inputs should be raw not
|
cooked. The return is -1,0,1 for normal values, 2 otherwise. */
|
||||||
* cooked. The return is -1,0,1 for normal values, 2 otherwise.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_CMP(fs, wc, ret, X, Y, un) \
|
#define _FP_CMP(fs, wc, ret, X, Y, un) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
/* NANs are unordered */ \
|
/* NANs are unordered. */ \
|
||||||
if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (X)) \
|
if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (X)) \
|
||||||
|| (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (Y))) \
|
|| (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (Y))) \
|
||||||
{ \
|
{ \
|
||||||
@ -1249,7 +1236,7 @@
|
|||||||
#define _FP_CMP_EQ(fs, wc, ret, X, Y) \
|
#define _FP_CMP_EQ(fs, wc, ret, X, Y) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
/* NANs are unordered */ \
|
/* NANs are unordered. */ \
|
||||||
if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (X)) \
|
if ((X##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (X)) \
|
||||||
|| (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (Y))) \
|
|| (Y##_e == _FP_EXPMAX_##fs && !_FP_FRAC_ZEROP_##wc (Y))) \
|
||||||
{ \
|
{ \
|
||||||
@ -1274,9 +1261,7 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/*
|
/* Main square root routine. The input value should be cooked. */
|
||||||
* Main square root routine. The input value should be cooked.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _FP_SQRT(fs, wc, R, X) \
|
#define _FP_SQRT(fs, wc, R, X) \
|
||||||
do \
|
do \
|
||||||
@ -1332,21 +1317,18 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/*
|
/* Convert from FP to integer. Input is raw. */
|
||||||
* Convert from FP to integer. Input is raw.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* RSIGNED can have following values:
|
/* RSIGNED can have following values:
|
||||||
* 0: the number is required to be 0..(2^rsize)-1, if not, NV is set plus
|
0: the number is required to be 0..(2^rsize)-1, if not, NV is set plus
|
||||||
* the result is either 0 or (2^rsize)-1 depending on the sign in such
|
the result is either 0 or (2^rsize)-1 depending on the sign in such
|
||||||
* case.
|
case.
|
||||||
* 1: the number is required to be -(2^(rsize-1))..(2^(rsize-1))-1, if not,
|
1: the number is required to be -(2^(rsize-1))..(2^(rsize-1))-1, if not,
|
||||||
* NV is set plus the result is either -(2^(rsize-1)) or (2^(rsize-1))-1
|
NV is set plus the result is either -(2^(rsize-1)) or (2^(rsize-1))-1
|
||||||
* depending on the sign in such case.
|
depending on the sign in such case.
|
||||||
* -1: the number is required to be -(2^(rsize-1))..(2^rsize)-1, if not, NV is
|
-1: the number is required to be -(2^(rsize-1))..(2^rsize)-1, if not, NV is
|
||||||
* set plus the result is either -(2^(rsize-1)) or (2^(rsize-1))-1
|
set plus the result is either -(2^(rsize-1)) or (2^(rsize-1))-1
|
||||||
* depending on the sign in such case.
|
depending on the sign in such case. */
|
||||||
*/
|
|
||||||
#define _FP_TO_INT(fs, wc, r, X, rsize, rsigned) \
|
#define _FP_TO_INT(fs, wc, r, X, rsize, rsigned) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
@ -1656,9 +1638,7 @@
|
|||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
/*
|
/* Helper primitives. */
|
||||||
* Helper primitives.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Count leading zeros in a word. */
|
/* Count leading zeros in a word. */
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
# include "sfp-machine.h"
|
# include "sfp-machine.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Allow sfp-machine to have its own byte order definitions. */
|
/* Allow sfp-machine to have its own byte order definitions. */
|
||||||
#ifndef __BYTE_ORDER
|
#ifndef __BYTE_ORDER
|
||||||
# ifdef _LIBC
|
# ifdef _LIBC
|
||||||
# include <endian.h>
|
# include <endian.h>
|
||||||
@ -63,7 +63,7 @@
|
|||||||
# define FP_ROUNDMODE FP_RND_NEAREST
|
# define FP_ROUNDMODE FP_RND_NEAREST
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* By default don't care about exceptions. */
|
/* By default don't care about exceptions. */
|
||||||
#ifndef FP_EX_INVALID
|
#ifndef FP_EX_INVALID
|
||||||
# define FP_EX_INVALID 0
|
# define FP_EX_INVALID 0
|
||||||
#endif
|
#endif
|
||||||
@ -119,10 +119,9 @@
|
|||||||
|
|
||||||
#ifndef FP_INHIBIT_RESULTS
|
#ifndef FP_INHIBIT_RESULTS
|
||||||
/* By default we write the results always.
|
/* By default we write the results always.
|
||||||
* sfp-machine may override this and e.g.
|
sfp-machine may override this and e.g.
|
||||||
* check if some exceptions are unmasked
|
check if some exceptions are unmasked
|
||||||
* and inhibit it in such a case.
|
and inhibit it in such a case. */
|
||||||
*/
|
|
||||||
# define FP_INHIBIT_RESULTS 0
|
# define FP_INHIBIT_RESULTS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user