TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How many x86 instructions are there? (2016)

132 pointsby sandinmyjointsabout 4 years ago

14 comments

gbrown_about 4 years ago
How about undocumented instructions? Sandsifter[1] is an interesting project and the video from BlackHat[2] is a good watch. There&#x27;s also a previous discussion of it on HN[3].<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;Battelle&#x2F;sandsifter" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Battelle&#x2F;sandsifter</a><p>[2] <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=KrksBdWcZgQ" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=KrksBdWcZgQ</a><p>[3] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=18179212" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=18179212</a>
评论 #26896543 未加载
评论 #26893134 未加载
评论 #26891370 未加载
davidkuhtaabout 4 years ago
&gt; To not leave you hanging: Intel has an official x86 encoder&#x2F;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?<p>Hopefully this will have either saved you a click or validated your time in reading the article.
评论 #26891481 未加载
评论 #26891585 未加载
评论 #26891303 未加载
johnklosabout 4 years ago
More than 1,500! Holy cow!<p>While having instructions for everything that are slow in early models but can be significantly improved in silicon over time is one way to look at CISC, I genuinely wonder how much silicon is spent on instructions that are so rarely used they&#x27;d be better in software.<p>Or to ask another way: how many instructions are in billions of x86 cores that rarely if ever get used? Hmmm...
评论 #26892518 未加载
评论 #26891885 未加载
评论 #26891586 未加载
userbinatorabout 4 years ago
<i>And by the way, I used x86 as an example here, but don’t believe for a second the same thing doesn’t apply to, say, the ARM chip in your phone. Modern ARM chips support multiple encodings and also rank over 1000 instructions if you count them at the same level of granularity as XEDs “iforms”.</i><p>Indeed, those who think x86 is complex should also take a detailed look at the ARM64 instruction set, particularly its instruction encoding. If you thought making sense of x86 instruction encoding was hard, and that a RISC might seem simpler, AArch64 will puzzle you even more.<p>To use the MOV example, the closest ARM equivalent might be the 40 variants of LD, which the reference manual (5000+ pages) enumerates as: LDAR, LDARB, LDARH, LDAXP, LDAXR, LDAXRB, LDAXRH, LDNP, LDP, LDPSW, LDR (immediate), LDR (literal), LDR (register), LDRB (immediate), LDRB (register), LDRH (immediate), LDRH (register), LDRSB (immediate), LDRSB (register), LDRSH (immediate), LDRSH (register), LDRSW (immediate), LDRSW (literal), LDRSW (register), LDTR, LDTRB, LDTRH, LDTRSB, LDTRSH, LDTRSW, LDUR, LDURB, LDURH, LDURSB, LDURSH, LDURSW, LDXP, LDXR, LDXRB, LDXRH. Some, like LDP, are then further split into different encodings depending on the addressing mode.<p>My suspicion is that to achieve acceptable code density with a fixed-length instruction encoding, they just made the individual instructions more complex. For example, the add instruction can also do a shift on one of its operands, which would require a second instruction on x86.
FpUserabout 4 years ago
I feel sudden urge to write some assembly for fun. Have not done it for at least a couple of years I think.
评论 #26894921 未加载
评论 #26890471 未加载
评论 #26892050 未加载
评论 #26894999 未加载
TwoBitabout 4 years ago
ARM has all these variations which make it seem as complicated as x86, but they are distict variations and future CPUs can for example drop 16 bit Thumb fairly clearly.
评论 #26891648 未加载
评论 #26891274 未加载
snvzzabout 4 years ago
The only real answer is: Too Many.<p>This complexity is pushed down to operating systems, compilers, assemblers, debuggers. It ends up causing brutal human time overhead throughout the chain, and its cost effectively prevents security and high assurance.<p>This more than justifies moving away from x86 into RISC architectures, such as the rising open and royalty-free RISC-V.
评论 #26895169 未加载
评论 #26896216 未加载
评论 #26896161 未加载
hnmullanyabout 4 years ago
Now ask how many unique x86 instructions do standard compilers emit...
dangabout 4 years ago
Past related threads:<p><i>How Many X86-64 Instructions Are There Anyway?</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14233296" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14233296</a> - April 2017 (133 comments)<p><i>How many x86 instructions are there?</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12358050" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12358050</a> - Aug 2016 (39 comments)<p><i>Does a compiler use all x86 instructions? (2010)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12352959" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12352959</a> - Aug 2016 (189 comments)<p><i>How Many X86-64 Instructions Are There Anyway?</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11535178" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11535178</a> - April 2016 (1 comment)
optimalsolverabout 4 years ago
Alternate instructions here :-)<p><a href="https:&#x2F;&#x2F;paws.kettering.edu&#x2F;~jhuggins&#x2F;humor&#x2F;opcodes.html" rel="nofollow">https:&#x2F;&#x2F;paws.kettering.edu&#x2F;~jhuggins&#x2F;humor&#x2F;opcodes.html</a>
loadzeroabout 4 years ago
An interesting (if horrifying) exercise:<p>$ ndisasm -b 64 &#x2F;dev&#x2F;urandom
floxyabout 4 years ago
I still love the 33 instructions in the Microchip PIC instruction set.<p><a href="https:&#x2F;&#x2F;www.microchipdeveloper.com&#x2F;8bit:bl-instruction-set" rel="nofollow">https:&#x2F;&#x2F;www.microchipdeveloper.com&#x2F;8bit:bl-instruction-set</a>
mobilioabout 4 years ago
In short - endless battle between RISC or CISC.
评论 #26891842 未加载
评论 #26891741 未加载
评论 #26898213 未加载
fruity123about 4 years ago
The legacy of variable length x86 is why Intel will always struggle now to keep up with ARM chips and Apple’s M1.