]> git.proxmox.com Git - mirror_qemu.git/commit - fpu/softfloat.c
fpu: introduce hardfloat
authorEmilio G. Cota <cota@braap.org>
Sat, 17 Mar 2018 06:13:59 +0000 (02:13 -0400)
committerAlex Bennée <alex.bennee@linaro.org>
Mon, 17 Dec 2018 08:25:25 +0000 (08:25 +0000)
commita94b783952cc493cb241aabb1da8c7a830385baa
tree712aca18fdb299d08132639dcb7a4292c36879c4
parent25f539f359447cd0dbfd5954aaa3c22b3921af79
fpu: introduce hardfloat

The appended paves the way for leveraging the host FPU for a subset
of guest FP operations. For most guest workloads (e.g. FP flags
aren't ever cleared, inexact occurs often and rounding is set to the
default [to nearest]) this will yield sizable performance speedups.

The approach followed here avoids checking the FP exception flags register.
See the added comment for details.

This assumes that QEMU is running on an IEEE754-compliant FPU and
that the rounding is set to the default (to nearest). The
implementation-dependent specifics of the FPU should not matter; things
like tininess detection and snan representation are still dealt with in
soft-fp. However, this approach will break on most hosts if we compile
QEMU with flags that break IEEE compatibility. There is no way to detect
all of these flags at compilation time, but at least we check for
-ffast-math (which defines __FAST_MATH__) and disable hardfloat
(plus emit a #warning) when it is set.

This patch just adds common code. Some operations will be migrated
to hardfloat in subsequent patches to ease bisection.

Note: some architectures (at least PPC, there might be others) clear
the status flags passed to softfloat before most FP operations. This
precludes the use of hardfloat, so to avoid introducing a performance
regression for those targets, we add a flag to disable hardfloat.
In the long run though it would be good to fix the targets so that
at least the inexact flag passed to softfloat is indeed sticky.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
fpu/softfloat.c