summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2008-12-23 22:20:59 +0000
committermarcel <marcel@FreeBSD.org>2008-12-23 22:20:59 +0000
commitcabae62b0ba1d31f524c393e294d3a5e08d543fc (patch)
treee53e0cc50653c1177127b792f2618edc51c491fd /lib
parent09a2776e693b4dac1f7a62f8e264ecf07bb78485 (diff)
downloadFreeBSD-src-cabae62b0ba1d31f524c393e294d3a5e08d543fc.zip
FreeBSD-src-cabae62b0ba1d31f524c393e294d3a5e08d543fc.tar.gz
Add support for the FPA floating-point format on ARM. The
FPA floating-point format is identical to the VFP format, but is always stored in big-endian. Introduce _IEEE_WORD_ORDER to describe the byte-order of the FP representation. Obtained from: Juniper Networks, Inc
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/arm/_fpmath.h15
-rw-r--r--lib/libc/arm/arith.h2
-rw-r--r--lib/libc/include/fpmath.h9
-rw-r--r--lib/msun/src/math_private.h14
4 files changed, 35 insertions, 5 deletions
diff --git a/lib/libc/arm/_fpmath.h b/lib/libc/arm/_fpmath.h
index 98d7832..b0ce8f4 100644
--- a/lib/libc/arm/_fpmath.h
+++ b/lib/libc/arm/_fpmath.h
@@ -26,15 +26,26 @@
* $FreeBSD$
*/
+#if defined(__VFP_FP__)
+#define _IEEE_WORD_ORDER _BYTE_ORDER
+#else
+#define _IEEE_WORD_ORDER _BIG_ENDIAN
+#endif
+
union IEEEl2bits {
long double e;
struct {
-#ifndef __ARMEB__
+#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;
-#else
+#if _IEEE_WORD_ORDER == _BIG_ENDIAN
+ unsigned int manl :32;
+#endif
+#else /* _BYTE_ORDER == _LITTLE_ENDIAN */
unsigned int sign :1;
unsigned int exp :11;
unsigned int manh :20;
diff --git a/lib/libc/arm/arith.h b/lib/libc/arm/arith.h
index e6f1da0..be78d86 100644
--- a/lib/libc/arm/arith.h
+++ b/lib/libc/arm/arith.h
@@ -11,7 +11,7 @@
* architecture. See contrib/gdtoa/gdtoaimp.h for details.
*/
-#ifndef __ARMEB__
+#if !defined(__ARMEB__) && defined(__VFP_FP__)
#define IEEE_8087
#define Arith_Kind_ASL 1
#define Sudden_Underflow
diff --git a/lib/libc/include/fpmath.h b/lib/libc/include/fpmath.h
index d33cfdc..697d582 100644
--- a/lib/libc/include/fpmath.h
+++ b/lib/libc/include/fpmath.h
@@ -30,6 +30,10 @@
#include <sys/endian.h>
#include "_fpmath.h"
+#ifndef _IEEE_WORD_ORDER
+#define _IEEE_WORD_ORDER _BYTE_ORDER
+#endif
+
union IEEEf2bits {
float f;
struct {
@@ -52,10 +56,15 @@ union IEEEd2bits {
double d;
struct {
#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;
+#endif
#else /* _BIG_ENDIAN */
unsigned int sign :1;
unsigned int exp :11;
diff --git a/lib/msun/src/math_private.h b/lib/msun/src/math_private.h
index 1d3b7a1..46d65cc 100644
--- a/lib/msun/src/math_private.h
+++ b/lib/msun/src/math_private.h
@@ -38,7 +38,17 @@
* ints.
*/
-#if BYTE_ORDER == BIG_ENDIAN
+#ifdef __arm__
+#if defined(__VFP_FP__)
+#define IEEE_WORD_ORDER BYTE_ORDER
+#else
+#define IEEE_WORD_ORDER BIG_ENDIAN
+#endif
+#else /* __arm__ */
+#define IEEE_WORD_ORDER BYTE_ORDER
+#endif
+
+#if IEEE_WORD_ORDER == BIG_ENDIAN
typedef union
{
@@ -52,7 +62,7 @@ typedef union
#endif
-#if BYTE_ORDER == LITTLE_ENDIAN
+#if IEEE_WORD_ORDER == LITTLE_ENDIAN
typedef union
{
OpenPOWER on IntegriCloud