Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They were always required. IIRC early AMD64 CPUs did not support x87 instructions in long mode at all (causing #UD), and that support was Intel's extension in first EM64T CPUs.


Please refrain from making things up -- Long Mode has always supported x87.

You may be mis-remembering LAHF/SAHF.


LAHF and SAHF are an interesting rabbit hole themselves.

If you ever dug into x86 assembler programming... at first they make no sense at all. They only save/restore a tiny part of the available flag registers. The mnemonics themselves make little sense - load/store are not really used in any other base x86 mnemonics (unlike e.g. 6502 mnemonics, which use LD?/ST? instead of MOV like x86).

It only clicked when I read an Intel document about porting assembler code from the 8080 to the 8086.

LAHF/SAHF are basically convenience instructions to make porting easier. Many 8080 instructions did not alter the flags, unlike their 8086 counterparts. Substituting an `INX` instruction with `LAHF; INC; SAHF` made it possible to mechanically translate assembler source code.

And yeah, 8080 mnemonics had LDA and STA like the 6502...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: