Re: Software FPU emulation in linux kernel

Finn Thain
2025-03-04T04:44:09Z

On Tue, 4 Mar 2025, Michael Schmitz wrote:

> > However, almost all trigonometric functions are not implemented...
> > What sense does it then make to use an emulation, when only basic
> > instructions like fadd/fmul etc. are implemented?

A good way to answer that question is to disable it and see what breaks
(assuming you have suitable hardware available).

> > Programs are not even aborted when using one of those functions,
> > uprint just prints an error message, and the functions just return
> > with their input arguments as result instead of calculating the
> > expected value.
>
> As I recall it, the main purpose was to keep kernel and a few important
> system utilities from blowing up on 030 machines with no FPU. User space
> programs that need to use trig functions or other FPU implemented
> functions can be compiled with -m soft_float (or something along those
> lines) on those systems.
>

Back in 2019, when I needed to get 'fio' to work on a 680x0 system with no
FPU, I had to make a few small changes to the program to avoid floating
point logarithms. That was sufficient to get it to work. The FPU emulator
took care of the rest.

From the notes I made at the time: "I tried to build fio with -msoft-float
but the build failed with a compiler error in the libc header
mathinline.h. I hacked around that and got it to build but the executable
didn't work correctly. I don't know why. I gave up on that approach."