Hacker News new | ask | show | jobs
by davidkuhta 1878 days ago
> To not leave you hanging: Intel has an official x86 encoder/decoder library called XED. According to Intel’s XED, as of this writing, there are 1503 defined x86 instructions (“iclasses” in XED lingo), from AAA to XTEST (this includes AMD-specific extensions too, by the way). Straightforward, right?

Hopefully this will have either saved you a click or validated your time in reading the article.

2 comments

For me the article was well worth it; where else but in ISA discussions can you find gems like the following?

> Does a non-instruction that is non-defined and unofficially guaranteed to non-execute exactly as if it had never been in the instruction set to begin with count as an x86 instruction? For that matter, does UD2 itself, the defined undefined instruction, count as an instruction?

This was why I posted it -- I learned a lot more than the answer to the title.
Curious, does anyone actually care about the actual number primarily? I thought pretty much everyone who clicks on an article with that title would do so because they are interested in the insights gathered when getting to that number.
If you are writing a disassembler or binary program decoder, such a number will help you be sure that you enumerate all the instructions.
I doubt most people reading the article coming from HN are writing disassemblers, and all such people would have to read it anyway because the number itself isn't sufficient to validate that you've enumerated all of them (because as my sibling points out, it's more complicated than that). The specific number is the least interesting part.
i think if you were writing such a program, this article would show that using such a number is a much more complicated idea than it sounds
Enumerating all instructions would be usefull to check wether you can decode all legal instructions.
The issue is that the list of all legal instructions is hard to define.