4 ms·
FreeBSD x86 Assembly Language Programming: Using the FPU
- feld 11y agoThe developers handbook is just rife with gems.
- deleted 11y ago[deleted]
- userbinator 11y agoI 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 11y agoWilliam Kahan consulted on the design of both.
- raverbashing 11y agoStack machines predate the HP calculators https://en.wikipedia.org/wiki/Stack_machine#Commercial_stack_machines https://en.wikipedia.org/wiki/Stack_machine#Commercial_stack...
- 101914 11y agoOriginal 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.
- throwaway_yy2Di 11y agoJust 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).
- jlarocco 11y agoFWIW, 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 11y agoA 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.
- acqq 11y agoActually the FPU instruction set, even if stack-based, is quite complete and the implementations are effective, not often not slower than the more "modern" ones, except when there is a possibility for parallel processing. And SSE doesn't have 80-bits precision at all. MMX is something that is probably not much useful today. But FPU and SSEx are both usable, especially when using assembly.