[gccsdk] VFP in GCC 4.1.2
nick at sqrt.co.uk
Mon Nov 29 03:17:36 PST 2010
On 28 November 2010 19:36, Jeffrey Lee <me at phlamethrower.co.uk> wrote:
> Yesterday I had a "quick" go at getting VFP working in GCC 4.1.2. Luckily,
> it looks like only a couple of simple changes are required in order to allow
> GCC to use VFP (details at end of message). However, for the
> resulting binaries to be usable (or to even link correctly), several things
> still need to happen:
> * We need to sort out the ABI. "Luckily" GCC 4.1 doesn't support using the
> hard-float ABI with VFP, so the only sensible option is to go with the
> softfp ABI. Since the softfp & softfloat ABIs use the same calling
> conventions, that means that we shouldn't have any extra work to do beyond
> removing the two lines of code that are curently preventing softfp from
> being selected.
> * Now that we've sorted out the ABI, we need to sort out the libraries.
> Unfortunately, although the docs suggest that it should be possible to link
> softfp code with softfloat code, this doesn't seem to be the case, as the
> linker complains when I try linking a VFP'd object file to unixlib. I have a
> feeling that this could be down to the difference in how doubles are stored
> (FPA uses big endian word order, VFP uses little endian), but
> I haven't fully looked into it yet. So before I dive too deep into GCC's
> source, does anyone here know what word order our current softfloat
> library uses?
> * But irrespective of the answer to the above question, we'd probably want
> to compile a VFP version of unixlib anyway. Apart from the obvious speed
> gains from using VFP for any float operations, we may also get speed gains
> elsewhere since we'd be able to change the minimum CPU architecture from
> ARMv3 to something more recent like v6. So with that in mind, can anyone
> give me some pointers on how to set up an extra unixlib configuration?
You will have to re-build Unixlib for targetting VFP because the math
library requires a configuration change to support the different
endianness. FPA using big-endian word ordering but little-endian
within the words. Plus you'll likely need to write VFP specific code
where we've written FPA assembler in the past e.g. initialisation,
pthread context switching, dtoa(), some math glue code.
There's a bit of work to get all this working properly. I remember
doing it some years ago and had a proof-of-concept working under the
QEMU-RISCOS emulator on Linux and benchmarking some VFP code. I'd
have thought you'd want to jump ahead to GCC 4.6 whilst the work is
being done (if that's not too difficult).
More information about the gcc