When using TCG emulation we need emulate the floating point unit of the guest. This is tricky because while most systems follow IEEE 754 this isn't quite comprehensive. Different guests have slightly different propagation rules for things like NaN propagation.

There has been work in recent years to speed up the floating point performance of the system. When we know it is safe to use the hardware we do so otherwise falling back to the software based emulation of the FPU known as SoftFloat.

The Code

The code is found in fpu/softfloat.c with guest specific tweaks in fpu/softfloat-specialize.h. The code was originally based on Berkeley Softfloat but has been extensively re-factored since. The re-factoring has a common path for 16/32/64 bit floating point calculations hopefully leading to less bugs.

There is a set of tests which can exercise the Softfloat which can be run by:

 make check-softfloat

It uses a lightly modified and wrapped Berkeley TestFloat.

Outstanding Tasks

  • Convert x80 and 128 bit floating point routines to new style

Maintainer Branches

User:Ajb has a public fpu/next branch:

System Summary Focus Branch:fpu/next status
GitLab CI pipelines Primary CI, tries to incorporate data from others https://gitlab.com/stsquad/qemu/badges/fpu/next/pipeline.svg [1]
Cirrus CI build history FreeBSD compiles https://api.cirrus-ci.com/github/stsquad/qemu.svg [2]
Travis build history Non-x86_64 hosts next&file=qemu.png