Skip to main content
6 events
when toggle format what by license comment
Oct 7, 2019 at 18:58 history edited Peter Cordes CC BY-SA 4.0
added 684 characters in body
Oct 7, 2019 at 16:50 comment added Peter Cordes But yes, ISAs with variable-length instructions optimize for the most common cases. Original 8086's main bottleneck was code-fetch from memory so they put some care into that design. It's evolved over time into an ugly Frankenstein's monster though, with much lack of long-term thinking about ISA extensions. :( See Agner Fog's 2009 blog post, Stop the instruction set war
Oct 7, 2019 at 16:44 comment added Peter Cordes @JoeyAdams: There are special-case short forms for the accumulator (EAX / AX / AL), and instructions with implicit operands like stosb. In "normal" 32-bit code most instructions are 2 to 4 bytes long, or longer with larger addressing modes or SIMD opcodes... And 64-bit code needs a REX prefix on many instructions, making the avg instruction length more like 4 in compiler output. See Tips for golfing in x86/x64 machine code I just updated the source version with comments for the benefit of people who don't know x86 asm, since you mentioned it :P
Oct 7, 2019 at 16:43 history edited Peter Cordes CC BY-SA 4.0
comment the asm
Oct 7, 2019 at 16:39 comment added Joey Adams I like this answer, it's a great intro to x86 assembly. I can't believe how few bytes each instruction takes.
Oct 6, 2019 at 15:58 history answered Peter Cordes CC BY-SA 4.0