
FreeBSD x86 Assembly Language Programming: Using the FPU - majke
https://www.freebsd.org/doc/en/books/developers-handbook/x86-fpu.html
======
throwaway_yy2Di
Just to be clear, this is a historic document (2001), not a current
introduction to x86 assembly. There's entirely new floating-point
architectures introduced since this was written (SSE and AVX).

------
101914
Original source: [http://int80h.org/bsdasm/](http://int80h.org/bsdasm/)

My recollection is this was published on the author's site years before being
added to the "handbook" on the FreeBSD website. I could be wrong. Perhaps
check archive.org.

------
userbinator
I wonder if the engineers at Intel were inspired by the HP RPN calculators,
since the stack-based x87 is quite unlike the register-based x86.

The fact that it's stack-based also makes for some _very_ high code-density; a
lot of the tiny demoscene demos (<=256b) make heavy use of the FPU, like
these:

[http://www.pouet.net/prod.php?which=3397](http://www.pouet.net/prod.php?which=3397)

[http://www.pouet.net/prod.php?which=53816](http://www.pouet.net/prod.php?which=53816)

~~~
stephencanon
William Kahan consulted on the design of both.

------
jlarocco
FWIW, the assembly in the link is ancient. Treating FPU registers as a stack
was considered a mistake 20 years ago. In this day and age it's been replaced
with MMX and then SSE. It will technically still work because of backwards
compatibility, but modern compilers will output newer, faster SSE
instructions.

~~~
tbirdz
A bit of a nitpick here about MMX. Although the MMX registers were aliases of
the floating point stack registers, the MMX instruction set consisted of
strictly integer operations, not floating point.

------
feld
The developers handbook is just rife with gems.

