[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
This commit is contained in:
James Greenhalgh 2016-11-23 17:31:25 +00:00 committed by James Greenhalgh
parent 8630cadbc5
commit bea64ca303
2 changed files with 35 additions and 0 deletions

View File

@ -1,3 +1,11 @@
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> 2016-11-23 James Greenhalgh <james.greenhalgh@arm.com>
Matthew Wahab <matthew.wahab@arm.com> Matthew Wahab <matthew.wahab@arm.com>

View File

@ -43,6 +43,15 @@ binary32 =
23 /* significand. */ 23 /* significand. */
}; };
static const struct format
binary64 =
{
64, /* size. */
1023, /* bias. */
11, /* exponent. */
52 /* significand. */
};
static inline unsigned short static inline unsigned short
__gnu_float2h_internal (const struct format* fmt, __gnu_float2h_internal (const struct format* fmt,
unsigned long long a, int ieee) 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); 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 unsigned int
__gnu_h2f_internal(unsigned short a, int ieee) __gnu_h2f_internal(unsigned short a, int ieee)
{ {
@ -198,3 +213,15 @@ __gnu_h2f_alternative(unsigned short a)
{ {
return __gnu_h2f_internal(a, 0); 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);
}