aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorJames Greenhalgh <james.greenhalgh@arm.com>2016-11-23 17:31:25 +0000
committerJames Greenhalgh <jgreenhalgh@gcc.gnu.org>2016-11-23 17:31:25 +0000
commitbea64ca303c145dbe9763d63921d405833edeb0c (patch)
tree6648eca397948d9d3b8042d1e5a8baf01b6e00e3 /libgcc
parent8630cadbc5c4b226cca16e2790fbe84850b634b0 (diff)
downloadgcc-bea64ca303c145dbe9763d63921d405833edeb0c.zip
gcc-bea64ca303c145dbe9763d63921d405833edeb0c.tar.gz
gcc-bea64ca303c145dbe9763d63921d405833edeb0c.tar.bz2
[Patch 15/17 libgcc ARM] Add double to half conversions.
libgcc/ * config/arm/fp16.c (binary64): New. (__gnu_d2h_internal): New. (__gnu_d2h_ieee): New. (__gnu_d2h_alternative): New. Co-Authored-By: Matthew Wahab <matthew.wahab@arm.com> From-SVN: r242782
Diffstat (limited to 'libgcc')
-rw-r--r--libgcc/ChangeLog8
-rw-r--r--libgcc/config/arm/fp16.c27
2 files changed, 35 insertions, 0 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 0f62834..44a7491 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,6 +1,14 @@
2016-11-23 James Greenhalgh <james.greenhalgh@arm.com>
Matthew Wahab <matthew.wahab@arm.com>
+ * config/arm/fp16.c (binary64): New.
+ (__gnu_d2h_internal): New.
+ (__gnu_d2h_ieee): New.
+ (__gnu_d2h_alternative): New.
+
+2016-11-23 James Greenhalgh <james.greenhalgh@arm.com>
+ Matthew Wahab <matthew.wahab@arm.com>
+
* config/arm/fp16.c (struct format): New.
(binary32): New.
(__gnu_float2h_internal): New. Body moved from
diff --git a/libgcc/config/arm/fp16.c b/libgcc/config/arm/fp16.c
index 76f7327..5828ec3 100644
--- a/libgcc/config/arm/fp16.c
+++ b/libgcc/config/arm/fp16.c
@@ -43,6 +43,15 @@ binary32 =
23 /* significand. */
};
+static const struct format
+binary64 =
+{
+ 64, /* size. */
+ 1023, /* bias. */
+ 11, /* exponent. */
+ 52 /* significand. */
+};
+
static inline unsigned short
__gnu_float2h_internal (const struct format* fmt,
unsigned long long a, int ieee)
@@ -150,6 +159,12 @@ __gnu_f2h_internal (unsigned int a, int ieee)
return __gnu_float2h_internal (&binary32, (unsigned long long) a, ieee);
}
+static inline unsigned short
+__gnu_d2h_internal (unsigned long long a, int ieee)
+{
+ return __gnu_float2h_internal (&binary64, a, ieee);
+}
+
unsigned int
__gnu_h2f_internal(unsigned short a, int ieee)
{
@@ -198,3 +213,15 @@ __gnu_h2f_alternative(unsigned short a)
{
return __gnu_h2f_internal(a, 0);
}
+
+unsigned short
+__gnu_d2h_ieee (unsigned long long a)
+{
+ return __gnu_d2h_internal (a, 1);
+}
+
+unsigned short
+__gnu_d2h_alternative (unsigned long long x)
+{
+ return __gnu_d2h_internal (x, 0);
+}