Jan 09

Assembly developer’s library

Every now and then, when coding in C++, I find myself needing to know some assembly to understand what’s going on. Sometimes, it’s because I am actually writing assembly code, such as when I was writing the new atomic classes for Qt. More often, it’s because I need to read the assembly generated by the compiler to figure out if it’s optimal or if it’s doing something weird.

So I often found myself downloading the same manuals over and over. I decided to put together a small library of manuals I use often and those I seldom use, but might want to some day. This is the list.

ArchitectureInstruction set manualABI description (calling convention)
i386 (IA-32)Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 2traditional / many / varied (Wikipedia article)
x86-64 64-bit a.k.a. x64Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 2System V ABI for x86-64 (LP64) and Windows x64 calling convention (LLP64)
x86-64 32-bit (ILP32) a.k.a. x32Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 2x32 ABI
Itanium (IA-64)Intel® Itanium® Architecture Developer’s Manual, Vol. 3

Itanium® Software Conventions and Runtime Architecture Guide (both ILP32 and LP64)
ARM 32-bit (AArch32)ARM assembler referenceARM Architecture Procedure Call Standard (AAPCS)
ARM 64-bit (AArch64)ARMv8 Instruction Set (registration required)ARM 64-bit Architecture Procedure Call Standard (AAPCS64)
MIPS32The MIPS32® Instruction Set and The microMIPS32™ Instruction Set (registration required)o32 ABI, n32 and n64
MIPS64The MIPS64® Instruction Set (registration required)o64 ABI, n32 and n64
POWER Architecture (includes PowerPC)Power Instruction Set Architecture Version 2.06Power Architecture 32-bit ABI Supplement 1.0 Unified (applies to 64-bit too I think)
SPARCSPARC archictecture V9SPARC psABI 3.0

Of course there are more architectures. Those are just the ones that are (somewhat) relevant to me a Qt developer. Also, please note that I have not looked with detail into the POWER and SPARC manual, other than a cursory glance to ensure that they contained the relevant information. For example, one site I found says that Linux 32-bit on PowerPC uses an ABI different than that defined by power.org.

I have not listed quick reference guides, many of which exist. I don’t use them because I often need details of the instructions.

What do you usually use when you code in assembly?

Additional IA-32 and x86-64 resources

The IA-32 ans x86-64 architectures contain a very big number of extensions that are added in different generations of the processors, both by Intel and AMD. The manuals above include the main extensions: MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX, plus the AES, FMA, F16C, RDRAND ones. It does not include extensions specific to AMD processors, like 3dNow! (effectively deprecated), SSE4a, FMA4 or XOP.

Other useful manuals:

Additionally, most of the non-general purpose instructions have intrinsic functions associated with them, so you can write really low-level code in C or C++ without actually having to write assembly. Unfortunately, I haven’t found a good, downloadable, and up-to-date intrinsics reference manual. The Intel(R) C++ Intrinsics Reference is the closest I’ve found, but it stops at SSE4 intrinsics, not including the AVX or AES ones.

If you know of one, please leave me a comment.


Application Binary Interface
int, long, pointer are 32-bit, virtually all 32-bit platforms (all of the ABIs listed here)
long and pointer are 64-bit, the 64-bit environment of all Unix platforms here
long long and pointer are 64-bit, but long is 32-bit; the 64-bit environment of Windows


2 pings

  1. avatar

    I’ve never found better intrinsics documentation either. I often use the AMD Instruction Reference (Programmers Manual Volume 4) because I find it to be the most clearest and try out in my IDE if intrinsics exist. ;)
    For learning I always find the AMD Software Optimization Guide for AMD Family $family very valuable. It contains a lot of different hints and examples for writing optimized code, including cache / memory / branch optimizations etc. pp.


  2. avatar
    Kevin Kofler

    For x86, NASM used to have a nice instruction reference in its manual. Unfortunately, they dropped it (replaced it with a complete, but uncommented list) in recent versions. :-( However, it’s still downloadable from SourceForge mirrors: the last version was nasm-0.99.02-xdoc.tar.bz2 from 2007 (which doesn’t mean new instructions as of 2007 are included though).

  3. avatar

    Good move.

  1. avatar
    Architectures and ABIs detailed » Thiago Macieira's blog

    [...] Assembly developer’s libraryJan10 Architectures and ABIs detailed Categories: Assembly by Thiago MacieiraYesterday I wrote about [...]

  2. avatar
    Machine Code History | Digital Fanatics

    [...] a more modern context, here and here is a list of instruction set manuals and ABI (Application Binary Interface, i.e. calling [...]

Comments have been disabled.

Page optimized by WP Minify WordPress Plugin