Merge "Fix arm64 floating point definitions."
This commit is contained in:
commit
a13c7fd3b3
@ -50,44 +50,6 @@
|
||||
* floating point.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define the number of bits in each fraction and exponent.
|
||||
*
|
||||
* k k+1
|
||||
* Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented
|
||||
*
|
||||
* (-exp_bias+1)
|
||||
* as fractions that look like 0.fffff x 2 . This means that
|
||||
*
|
||||
* -126
|
||||
* the number 0.10000 x 2 , for instance, is the same as the normalized
|
||||
*
|
||||
* -127 -128
|
||||
* float 1.0 x 2 . Thus, to represent 2 , we need one leading zero
|
||||
*
|
||||
* -129
|
||||
* in the fraction; to represent 2 , we need two, and so on. This
|
||||
*
|
||||
* (-exp_bias-fracbits+1)
|
||||
* implies that the smallest denormalized number is 2
|
||||
*
|
||||
* for whichever format we are talking about: for single precision, for
|
||||
*
|
||||
* -126 -149
|
||||
* instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and
|
||||
*
|
||||
* -149 == -127 - 23 + 1.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The ARM has two sets of FP data formats. The FPA supports 32-bit, 64-bit
|
||||
* and 96-bit IEEE formats, with the words in big-endian order. VFP supports
|
||||
* 32-bin and 64-bit IEEE formats with the words in the CPU's native byte
|
||||
* order.
|
||||
*
|
||||
* The FPA also has two packed decimal formats, but we ignore them here.
|
||||
*/
|
||||
|
||||
#define SNG_EXPBITS 8
|
||||
#define SNG_FRACBITS 23
|
||||
|
||||
@ -96,65 +58,18 @@
|
||||
#define DBL_FRACLBITS 32
|
||||
#define DBL_FRACBITS 52
|
||||
|
||||
#ifndef __VFP_FP__
|
||||
#define E80_EXPBITS 15
|
||||
#define E80_FRACHBITS 31
|
||||
#define E80_FRACLBITS 32
|
||||
#define E80_FRACBITS 64
|
||||
|
||||
#define EXT_EXPBITS 15
|
||||
#define EXT_FRACHBITS 16
|
||||
#define EXT_FRACHMBITS 32
|
||||
#define EXT_FRACLMBITS 32
|
||||
#define EXT_FRACLBITS 32
|
||||
#define EXT_FRACBITS 112
|
||||
#endif
|
||||
|
||||
struct ieee_single {
|
||||
u_int sng_frac:23;
|
||||
u_int sng_exp:8;
|
||||
u_int sng_sign:1;
|
||||
};
|
||||
|
||||
#ifdef __VFP_FP__
|
||||
struct ieee_double {
|
||||
u_int dbl_fracl;
|
||||
u_int dbl_frach:20;
|
||||
u_int dbl_exp:11;
|
||||
u_int dbl_sign:1;
|
||||
};
|
||||
#else /* !__VFP_FP__ */
|
||||
struct ieee_double {
|
||||
u_int dbl_frach:20;
|
||||
u_int dbl_exp:11;
|
||||
u_int dbl_sign:1;
|
||||
u_int dbl_fracl;
|
||||
};
|
||||
|
||||
union ieee_double_u {
|
||||
double dblu_d;
|
||||
struct ieee_double dblu_dbl;
|
||||
};
|
||||
|
||||
|
||||
struct ieee_e80 {
|
||||
u_int e80_exp:15;
|
||||
u_int e80_zero:16;
|
||||
u_int e80_sign:1;
|
||||
u_int e80_frach:31;
|
||||
u_int e80_j:1;
|
||||
u_int e80_fracl;
|
||||
};
|
||||
|
||||
struct ieee_ext {
|
||||
u_int ext_frach:16;
|
||||
u_int ext_exp:15;
|
||||
u_int ext_sign:1;
|
||||
u_int ext_frachm;
|
||||
u_int ext_fraclm;
|
||||
u_int ext_fracl;
|
||||
};
|
||||
#endif /* !__VFP_FP__ */
|
||||
|
||||
/*
|
||||
* Floats whose exponent is in [1..INFNAN) (of whatever type) are
|
||||
@ -167,26 +82,11 @@ struct ieee_ext {
|
||||
*/
|
||||
#define SNG_EXP_INFNAN 255
|
||||
#define DBL_EXP_INFNAN 2047
|
||||
#ifndef __VFP_FP__
|
||||
#define E80_EXP_INFNAN 32767
|
||||
#define EXT_EXP_INFNAN 32767
|
||||
#endif /* !__VFP_FP__ */
|
||||
|
||||
#if 0
|
||||
#define SNG_QUIETNAN (1 << 22)
|
||||
#define DBL_QUIETNAN (1 << 19)
|
||||
#ifndef __VFP_FP__
|
||||
#define E80_QUIETNAN (1 << 15)
|
||||
#define EXT_QUIETNAN (1 << 15)
|
||||
#endif /* !__VFP_FP__ */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Exponent biases.
|
||||
*/
|
||||
#define SNG_EXP_BIAS 127
|
||||
#define DBL_EXP_BIAS 1023
|
||||
#ifndef __VFP_FP__
|
||||
#define E80_EXP_BIAS 16383
|
||||
#define EXT_EXP_BIAS 16383
|
||||
#endif /* !__VFP_FP__ */
|
||||
|
@ -33,28 +33,15 @@
|
||||
union IEEEl2bits {
|
||||
long double e;
|
||||
struct {
|
||||
#ifndef __AARCH64EB__
|
||||
unsigned long manl :64;
|
||||
unsigned long manh :48;
|
||||
unsigned int exp :15;
|
||||
unsigned int sign :1;
|
||||
#else
|
||||
unsigned int sign :1;
|
||||
unsigned int exp :15;
|
||||
unsigned long manh :48;
|
||||
unsigned long manl :64;
|
||||
#endif
|
||||
} bits;
|
||||
struct {
|
||||
#ifndef __AARCH64EB__
|
||||
unsigned long manl :64;
|
||||
unsigned long manh :48;
|
||||
unsigned int expsign :16;
|
||||
#else
|
||||
unsigned int expsign :16;
|
||||
unsigned long manh :48;
|
||||
unsigned long manl :64;
|
||||
#endif
|
||||
} xbits;
|
||||
};
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/lib/libc/include/fpmath.h,v 1.3 2005/02/06 03:23:31 das Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _FPMATH_
|
||||
@ -33,10 +33,14 @@
|
||||
#include <endian.h>
|
||||
#include "_fpmath.h"
|
||||
|
||||
#ifndef _IEEE_WORD_ORDER
|
||||
#define _IEEE_WORD_ORDER _BYTE_ORDER
|
||||
#endif
|
||||
|
||||
union IEEEf2bits {
|
||||
float f;
|
||||
struct {
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
unsigned int man :23;
|
||||
unsigned int exp :8;
|
||||
unsigned int sign :1;
|
||||
@ -54,18 +58,17 @@ union IEEEf2bits {
|
||||
union IEEEd2bits {
|
||||
double d;
|
||||
struct {
|
||||
/* #ifdef __ARMEB__ */
|
||||
#if (__BYTE_ORDER == __BIG_ENDIAN) || (defined(__arm__) && !defined(__VFP_FP__))
|
||||
#if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
#if _IEEE_WORD_ORDER == _LITTLE_ENDIAN
|
||||
unsigned int manl :32;
|
||||
#endif
|
||||
unsigned int manh :20;
|
||||
unsigned int exp :11;
|
||||
unsigned int sign :1;
|
||||
#if _IEEE_WORD_ORDER == _BIG_ENDIAN
|
||||
unsigned int manl :32;
|
||||
#elif __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
unsigned int manl :32;
|
||||
unsigned int manh :20;
|
||||
unsigned int exp :11;
|
||||
unsigned int sign :1;
|
||||
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
#endif
|
||||
#else /* _BIG_ENDIAN */
|
||||
unsigned int sign :1;
|
||||
unsigned int exp :11;
|
||||
unsigned int manh :20;
|
||||
|
Loading…
x
Reference in New Issue
Block a user