[Patch soft-fp] Add support for various half-precision conversion routines

James Greenhalgh james.greenhalgh@arm.com
Mon Sep 19 13:35:00 GMT 2016


On Wed, Sep 07, 2016 at 04:20:43PM +0000, Joseph Myers wrote:
> On Wed, 7 Sep 2016, James Greenhalgh wrote:
>
> > What I'm not clear about is whether this patch is sufficient on the glibc
> > side, or if I also need to wire something up in a Makefile over here?
>
> No, it's not expected to be wired up in a Makefile, and testing in GCC is
> appropriate in this case.
>
> > In the patch below, soft-fp/half.h is derived from soft-fp/single.h .
>
> You are, correctly, not including the various macros for arithmetic
> operations not using this code, but I think that means a comment to that
> effect as in <https://gcc.gnu.org/ml/gcc-patches/2009-04/msg01132.html> is
> appropriate.

Thanks. The pointer to this patch was very helpful for resolving your
other comments. I've applied the suggested changes, and re-run the GCC
testing, which showed no issues in a native bootstrap and test with the
_Float16 type enabled, and using these library functions.

> But is DF to HF is handled *correctly* by GCC proper (avoiding double
> rounding), or is such a libgcc call actually needed to get correct
> conversions rather than going via SFmode (or is that double rounding issue
> only an issue for AArch32 or for older instruction set variants you're not
> dealing with in this patch)?

Yes, the instruction emitted is:

  fcvt    d0, h0

Which is a one-step conversion from DFmode to HFmode.

As you correctly identify, the older AArch32 instruction sets do not
provide this one-step conversion. I expect I'll need to add truncdfhf2 when
I start work on the ARM support for _Float16.

> It's reasonable to include just the functions you need, as long as the
> write-up, the ChangeLog and the patch itself are consistent.

Hopefully I've squashed such bugs for this submission.

---

This patch adds conversion routines required for _Float16 support in
AArch64.

These are one-step conversions to and from TImode and TFmode. We need
these on AArch64 regardless of presence of the ARMv8.2-A 16-bit floating-point
extensions.

In the patch below, soft-fp/half.h is derived from soft-fp/single.h .
The conversion routines are derivatives of their respective SFmode
variants.

OK? If so, I'll need help applying the patch to glibc, as I have no commit
rights over here.

Thanks,
James

---
2016-09-19  James Greenhalgh  <james.greenhalgh@arm.com>

	* soft-fp/extendhftf2.c: New.
	* soft-fp/fixhfti.c: Likewise.
	* soft-fp/fixunshfti.c: Likewise.
	* soft-fp/floattihf.c: Likewise.
	* soft-fp/floatuntihf.c: Likewise.
	* soft-fp/half.h: Likewise.
	* soft-fp/trunctfhf2.c: Likewise.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Re-Patch-soft-fp-Add-support-for-various-half-precis.patch
Type: text/x-patch
Size: 16922 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160919/6b83dbc5/attachment.bin>


More information about the Libc-alpha mailing list