- Optimizing software in C++: An optimization guide for Windows, Linux and Mac platforms
- Optimizing subroutines in assembly language: An optimization guide for x86 platforms
- The microarchitecture of Intel, AMD and VIA CPUs: An optimization guide for assembly programmers and compiler makers
- Instruction tables: Lists of instruction latencies, throughputs and micro-operation breakdowns for Intel, AMD and VIA CPUs
- Calling conventions for different C++ compilers and operating systems
Optimization manuals
Optimization manuals
I have written a series of five manuals describing everything you need to know about optimizing code for x86 and x86-64 family microprocessors, including optimization advice for C++ and assembly language, details about the microarchitecture and instruction timings of Intel, AMD and VIA processors, and details about different compilers and calling conventions.
Re: Optimization manuals
Could you provide EPUB, MOBI, or AZW3 versions of the manuals?
Re: Optimization manuals
Sorry, no. It is too much work to maintain multiple versions of the manuals. I think that almost all E-book readers support the pdf format.
Re: Optimization manuals
Hi Agner,
I was reading your book, Optimization C++, many years ago.
Today I wanted to find arithmetic hacks and I wasn't able to do that.
I checked random older versions on internet archive.
I remember hacks such as:
I was reading your book, Optimization C++, many years ago.
Today I wanted to find arithmetic hacks and I wasn't able to do that.
I checked random older versions on internet archive.
I remember hacks such as:
- An int value is treated as a vector of bytes (simulation SIMD in plain C)
- Add number if it is bigger than other number without if.
Re: Optimization manuals
Sorry,
I found what I was looking for
https://graphics.stanford.edu/~seander/bithacks.html
Over the years these papers got mixed in my head.
I found what I was looking for
https://graphics.stanford.edu/~seander/bithacks.html
Over the years these papers got mixed in my head.
Re: Optimization manuals
Doing vector operations in general purpose registers is explained in my assembly manual chapter 13.9.
The book: Hacker's Delight by Henry S. Warren (2003) also has a lot of useful tricks.
The book: Hacker's Delight by Henry S. Warren (2003) also has a lot of useful tricks.
Re: Optimization manuals
In the 5. Calling conventions volume, chapter 7, could you perhaps make it more clear how C++ empty objects are passed as a function argument? I know there's a "has now data" row in the table, but even with that it's not clear. I did some experiments. It seems that on x86_64 Linux, the empty object is just ignored, it doesn't take space on either the stack or registers. In x86_64 Windows, it seems one of the argument registers is reserved for the empty object (though I haven't checked whether the register is zeroed or what happens for arguments after the four registers are exhausted).
Re: Optimization manuals
Maybe you already know, maybe not ... in manual no. 3 "The microarchitecture of Intel, AMD and VIA CPUsAn optimization guide for assembly programmers and compiler makers" Last updated 2020-03-08 there are two times chapters 3.1 - 3.6
Re: Optimization manuals
Is there a correct place for suggestions/comments on the optimization manuals?
Found a small typo on optimizing_assembly.pdf page 113:
"AVX512IFMA. Fused multiply-and-add on 52-bit integers."
That was meant to be 32-bit integers, I suppose.
Found a small typo on optimizing_assembly.pdf page 113:
"AVX512IFMA. Fused multiply-and-add on 52-bit integers."
That was meant to be 32-bit integers, I suppose.
Re: Optimization manuals
AVX512IFMA is indeed multiplying 52 bit integers.