upvote
Duke Nukem 3D is compiled with FPU emulation. Game engine is 99.9% fixed point math, only requires FPU for rarely used slopes (setupslopevlin_ and slopevlin_).

It just so happens first room when starting the game - rooftop - has sloped roof vents and later walls with sloped edge. Even on fast FPUless 90MHz NexGen Nx586 (AMD K6 father) FPS drops down to 10-14fps on that roof https://www.youtube.com/watch?v=41O2bNG2qKA&t=234s while staying above 30 when facing away from slopes.

reply
Could a table help there?
reply
I think GCC didn't have the emulating library, but the operating system had. (Such as Debian.) So you could compile and link your programs against a soft-float library. ( Something like this https://github.com/ant6n/ieeelib )

What this NetBSD project does is not exactly like that though, it lets programs use regular 487 float instructions, which are trapped by the kernel, which steps in and emulates what the hardware float instruction would have done.

It worked very well for regular program, because most programs would not use float instructions to any significant degree.

If you however were going to use floats a lot for long calculations, a soft-float library would be much faster.

reply
Funny enough, I've been compiling a lot of stuff for 386 Linux lately. You can build a kernel with built in software floating point, at which point it doesn't matter what your library/compiler do. If your kernel isn't built to handle that, you can build glibc with floating point emulation.

At least this is my impression, working with 2.2.x/2.4.x kernels, gcc 2.7~3.3, and glibc ~2.2

reply
Yap. But as hinted by the comments before you, if you have CPUs without FPUs, you probably want to enable userspace (e.g. glibc) soft math support anyway, since it doesn’t have the overhead of trapping the instructions and context switching into the kernel and back.

The benefit of OP’s solution in the kernel is that it works for everything out of the box, including pre-compiled binaries, and those that you can’t rebuild for whatever reason to begin with.

reply