Comment 8 for bug 303232

Revision history for this message
Catalin Marinas (catalin-marinas) wrote : Re: [Bug 303232] Re: armel gcc default optimisations

If -mfpu=vfp is enabled, the compiler will generate VFP instructions in
the asm code directly rather than calls to the libgcc soft-float code.
Even if the libgcc soft-float function could be replaced with the VFP
instructions, you still get an additional branch to those operations and
probably lower performance than complete VFP optimisation. Please note
that I haven't tried this approach comment more on the performance.

The libm is a candidate for this optimisation but there are applications
that would themselves benefit from being compiled with VFP. As I
understand, there are difficulties in maintaining two separate variants
for some packages (like OpenOffice).

There are no patches to enable full VFP emulation. AFAIK, the Linux
kernel community weren't keen to get such patches merged into mainline
because of emulation performance reasons.

Just for clarification, the kernel currently needs to trap the VFP
exceptions for 3 reasons:

1. The VFP is disabled at a context switch and the first encounter of a
VFP instruction triggers an undefined exception. At this point, the
kernel saves the VFP registers for the old application and loads those
for the new one.

2. On VFPv2 (found on ARMv5 and ARMv6 processors), the hardware does not
implement full IEEE754 compliance. There are corner cases (like
denormalised numbers) which aren't supported by hardware but the kernel
traps and emulates them. Note that the VFPv3 (on ARMv7 processors) has
full support for the IEEE754 compliance and there is no need for
additional kernel emulation (though the code is still there since it's
harmless).

3. Floating point operations exception (e.g. divide by zero) if the user
application enabled them and the hardware supports them.

Because of point 2 above, we have almost all the emulation code needed.
The only missing part is the emulation of the VFP registers (the kernel
currently reads the hardware ones) and maybe some optimisation to read
ahead and emulate more than one instruction in the exception handler
before returning to user.
--
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.