Aussie AI
Assembler
-
Last Updated 17 November, 2025
-
by David Spuler, Ph.D.
Assembly language, or "assembler", is the low-level language for CPU machine instructions. Like C++, it is still a symbolic human-readable language, but unlike C++, it translates mostly one-to-one to machine code instructions. The syntax for assembler is much simpler than C++, and more obscure, but it's also very, very fast.
Most C++ compilers support features allowing you to specify assembly language sequences in the middle of a C++ program. You don't need to put assembler into a separate code file, because you can use assembly language directives inside C++ sequences. The directive to use to introduce an assembly language statement into C++ is somewhat compiler-dependent, (such as whether to use ASM or MASM or __ASM), but the whole concept of assembly language is platform-dependent anyway.
The first question to ask yourself before writing assembler in C++ is whether you need to. The use of assembler should only be considered for the most bottlenecking parts of the code, like deep inside the inner loops of a GEMM kernel. Otherwise, you're probably micro-optimizing something that's not that critical.
Another question is whether to use "intrinsics" instead of assembler. Each compiler has literally hundreds of builtin low-level functions called "intrinsics" that are very fast, probably because the compiler-writers have written them in assembler. There are also lots of intrinsics to use for GPU operations and CPU SIMD extensions such as AVX-512. Look through the long list of C++ intrinsics for your platform to see if there's one that does what you need.
Research on Assembler
Research on optimization using assembly language includes:
- Daniel Kusswurm, 2022, Modern Parallel Programming with C++ and Assembly Language: X86 SIMD Development Using AVX, AVX2, and AVX-512, 1st Edition, Apress, https://www.amazon.com/Modern-Parallel-Programming-Assembly-Language/dp/1484279174/, Code: https://github.com/Apress/modern-parallel-programming-cpp-assembly
- Microsoft, August 3rd, 2021, Inline Assembler, Visual Studio 2022 Documentation, https://learn.microsoft.com/en-us/cpp/assembler/inline/inline-assembler
- CPP Reference, Aug 2023, asm declaration, https://en.cppreference.com/w/cpp/language/asm
- Sandeep S, 01 March 2003, GCC-Inline-Assembly-HOWTO, https://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
- Félix Cloutier, 2023, x86 and amd64 instruction reference, https://www.felixcloutier.com/x86/
- David Spuler, March 2024, Chapter 16. Hardware Acceleration, Generative AI in C++: Coding Transformers and LLMs, https://www.amazon.com/dp/B0CXJKCWX9
- J. Armengol-Estapé, J. Woodruff, C. Cummins and M. F. P. O'Boyle, 2024, SLaDe: A Portable Small Language Model Decompiler for Optimized Assembly, 2024 IEEE/ACM International Symposium on Code Generation and Optimization (CGO), Edinburgh, United Kingdom, 2024, pp. 67-80, doi: 10.1109/CGO57630.2024.10444788, https://ieeexplore.ieee.org/abstract/document/10444788
- Z Zhong, January 22nd, 2024, Enhancing SIMD Assembly Language Development with Visualization Techniques, Masters Thesis, Department of Computer Science and Communications Engineering,, Master of Engineering, Waseda University, Japan, https://waseda.repo.nii.ac.jp/record/2001309/files/t5121F099.pdf
- Zeyu Gao, Hao Wang, Yuanda Wang, Chao Zhang, 10 Aug 2024, ViC: Virtual Compiler Is All You Need For Assembly Code Search, https://arxiv.org/abs/2408.06385
- David Spuler, March 2024, Assembly Language versus Intrinsics, in Generative AI in C++, https://www.aussieai.com/book/ch16-assembly-vs-intrinsics
- shikaan, 8 September, 2024, A friendly introduction to assembly for high-level programmers — Hello, https://shikaan.github.io/assembly/x86/guide/2024/09/08/x86-64-introduction-hello.html
- Anjiang Wei, Tarun Suresh, Huanmi Tan, Yinglun Xu, Gagandeep Singh, Ke Wang, Alex Aiken, 16 May 2025, Improving Assembly Code Performance with Large Language Models via Reinforcement Learning, https://arxiv.org/abs/2505.11480
- Seyedreza Mohseni, Seyedali Mohammadi, Deepa Tilwani, Yash Saxena, Gerald Ketu Ndawula, Sriram Vema, Edward Raff, Manas Gaur, 29 Jan 2025 (v3), Can LLMs Obfuscate Code? A Systematic Analysis of Large Language Models into Assembly Code Obfuscation, https://arxiv.org/abs/2412.16135
- Haochen Huang, Jiahuan Pei, Mohammad Aliannejadi, Xin Sun, Moonisa Ahsan, Chuang Yu, Zhaochun Ren, Pablo Cesar, Junxiao Wang, 23 Jul 2025, LEGO Co-builder: Exploring Fine-Grained Vision-Language Modeling for Multimodal LEGO Assembly Assistants, https://arxiv.org/abs/2507.05515
- Ali Mohamed Ali, Luca Tirel and Hashim A. Hashim, 22 Jul 2025, Novel Multi-Agent Action Masked Deep Reinforcement Learning for General Industrial Assembly Lines Balancing Problems, https://arxiv.org/abs/2507.16635
- Ziming Wang, Nan Xue, Rebecka J\"ornsten, 30 Jul 2025, Equivariant Flow Matching for Point Cloud Assembly, https://arxiv.org/abs/2505.21539
- Ryan Diaz, Adam Imdieke, Vivek Veeriah, Karthik Desingh, 1 Aug 2025, AugInsert: Learning Robust Visual-Force Policies via Data Augmentation for Object Assembly Tasks, https://arxiv.org/abs/2410.14968
- Nahyuk Lee, Juhong Min, Junhong Lee, Chunghyun Park, Minsu Cho, 13 Aug 2025, Combinative Matching for Geometric Shape Assembly, https://arxiv.org/abs/2508.09780
- Kyle Brown, Dylan M. Asmar, Mac Schwager, and Mykel J. Kochenderfer, 15 Aug 2025, Large-Scale Multi-Robot Assembly Planning for Autonomous Manufacturing, https://arxiv.org/abs/2311.00192
- Chen Yi Lu, Md Mehrab Tanjim, Ishita Dasgupta, Somdeb Sarkhel, Gang Wu, Saayan Mitra, Somali Chaterji, 15 Aug 2025, SKALD: Learning-Based Shot Assembly for Coherent Multi-Shot Video Creation, https://arxiv.org/abs/2503.08010
- Ruixuan Liu, Philip Huang, Ava Pun, Kangle Deng, Shobhit Aggarwal, Kevin Tang, Michelle Liu, Deva Ramanan, Jun-Yan Zhu, Jiaoyang Li, Changliu Liu, 28 Aug 2025, Prompt-to-Product: Generative Assembly via Bimanual Manipulation, https://arxiv.org/abs/2508.21063
- Kevin Ferguson, Yu-hsuan Chen, Levent Burak Kara, 9 Sep 2025, MDDM: A Molecular Dynamics Diffusion Model to Predict Particle Self-Assembly, https://arxiv.org/abs/2501.17319
- Cong Yu, Valter Uotila, Shilong Deng, Qingyuan Wu, Tuo Shi, Songlin Jiang, Lei You, Bo Zhao, 1 Oct 2025, QUASAR: Quantum Assembly Code Generation Using Tool-Augmented LLMs via Agentic RL, https://arxiv.org/abs/2510.00967
- Chenrui Tie, Shengxiang Sun, Yudi Lin, Yanbo Wang, Zhongrui Li, Zhouhan Zhong, Jinxuan Zhu, Yiman Pang, Haonan Chen, Junting Chen, Ruihai Wu, Lin Shao, 18 Oct 2025, Manual2Skill++: Connector-Aware General Robotic Assembly from Instruction Manuals via Vision-Language Models, https://arxiv.org/abs/2510.16344
- Chenrui Tie, Shengxiang Sun, Jinxuan Zhu, Yiwei Liu, Jingxiang Guo, Yue Hu, Haonan Chen, Junting Chen, Ruihai Wu, Lin Shao, 18 Oct 2025, Manual2Skill: Learning to Read Manuals and Acquire Robotic Skills for Furniture Assembly Using Vision-Language Models, https://arxiv.org/abs/2502.10090
- Binghao Huang, Jie Xu, Iretiayo Akinola, Wei Yang, Balakumar Sundaralingam, Rowland O'Flaherty, Dieter Fox, Xiaolong Wang, Arsalan Mousavian, Yu-Wei Chao, Yunzhu Li, 18 Oct 2025, VT-Refine: Learning Bimanual Assembly with Visuo-Tactile Feedback via Simulation Fine-Tuning, https://arxiv.org/abs/2510.14930
- Ali Nazeri, Shashank Mishra, Achim Wagner, Martin Ruskowski, Didier Stricker, Jason Rambach, 28 Sep 2025, A Multi-Camera Vision-Based Approach for Fine-Grained Assembly Quality Control, https://arxiv.org/abs/2509.23815
- Darrin Lea, James Ghawaly, Golden Richard III, Aisha Ali-Gombe, Andrew Case, 23 Oct 2025, REx86: A Local Large Language Model for Assisting in x86 Assembly Reverse Engineering, https://arxiv.org/abs/2510.20975
- Ziyi Xu, Haohong Lin, Shiqi Liu, and Ding Zhao, 23 Sep 2025, Query-Centric Diffusion Policy for Generalizable Robotic Assembly, https://arxiv.org/abs/2509.18686
AI Books from Aussie AI
|
The Sweetest Lesson: Your Brain Versus AI: new book on AI intelligence theory:
Get your copy from Amazon: The Sweetest Lesson |
|
RAG Optimization: Accurate and Efficient LLM Applications:
new book on RAG architectures:
Get your copy from Amazon: RAG Optimization |
|
Generative AI Applications book:
Get your copy from Amazon: Generative AI Applications |
|
Generative AI programming book:
Get your copy from Amazon: Generative AI in C++ |
|
CUDA C++ Optimization book:
Get your copy from Amazon: CUDA C++ Optimization |
|
CUDA C++ Debugging book:
Get your copy from Amazon: CUDA C++ Debugging |
More AI Research
Read more about: