Low-Level Programming University – A roadmap to becoming a low-level programmer
Don&#x27;t go there. There&#x27;s really not a lot of work. But if you must, low level is more a calling than a learned skill.<p>You probably shouldn&#x27;t be learning assembler. First, compilers are really quite good. Yes, it&#x27;s possible to beat them (I do) but generally not by much. And not by much ain&#x27;t gonna put bacon on the table. You can probably get what you need from gcc inline asm() calls. Take a look at the linux sources and figure out why and when assembly is used there:<p><a href="http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;22122887&#x2F;linux-kernel-assembly-and-logic" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;22122887&#x2F;linux-kernel-ass...</a><p>Secondly, writing in assembler is <i>not</i> low level. You just think it is. You should really be understanding caches and you can improve your cache performance in C.<p>Anyways, unless you deeply know what&#x27;s going on inside of the microarchitecture of a modern superscalar, out of order, speculative, renaming, μop-cached, hyper-threaded, multicore beast then you shouldn&#x27;t be fooling yourself by writing in assembler.<p><a href="http:&#x2F;&#x2F;blog.erratasec.com&#x2F;2015&#x2F;03&#x2F;x86-is-high-level-language.html" rel="nofollow">http:&#x2F;&#x2F;blog.erratasec.com&#x2F;2015&#x2F;03&#x2F;x86-is-high-level-language...</a><p>Unless you&#x27;ve really read Intel&#x27;s <i>Intel 64 and IA-32 Architectures Optimization Reference Manual</i> (and ARM&#x27;s <i>Cortex®-A72 Software Optimization Guide</i>) and meditated on the suras of Agner Fog&#x27;s <i>Microarchitecture</i> you won&#x27;t even know what&#x27;s going on with something as simple as <i>mov RAX, RBX</i>.<p>Look, most compiler writers don&#x27;t even know this stuff (Intel C Compiler yes, llvm occasionally) and frankly, it isn&#x27;t very useful because Intel spends a billion dollars a year to make your bad x86 code run reasonably fast. Consider a switch statement which compiles into an indirect branch, <i>jmp reg</i>. That branch has to be predicted by the BTB <i>before the jmp reg instruction is even fetched</i> and that&#x27;s really hard to do. Every year they get better and better to the point that you&#x27;re not even aware of it. But if you want to the help the CPU out, you could put a UD2 right after the <i>jmp reg</i>. This is insanely hard to understand and will help very little.<p>Don&#x27;t go there.