Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Do all CPUs of the same architecture run the same Assembly istructions?

Recently, I saw a video of someone writing ASM, they only mentioned that the code is for the x86_64 architecture, with no mention of the specific CPU. At university I was taught to look at the CPU’s Instruction Set, OP Code, memory map, etc… (Intel 8051 Specifically) So I found it odd.

I’m interested in writing Assembly for my M-series MacBook, does ARM64 Assembly run on all ARM CPUs too?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Yes, correct. The instruction set architecture (ISA) specifies what the machine code looks like and what instructions it has. Some ISAs support multiple instruction sets with applications being able to switch between them. For example, x86 has three instruction sets: a 16 bit, a 32 bit, and a 64 bit instruction set. While very similar, code written for one of the three cannot run on the others without reassembly and slight changes.

Your Apple M1 processor has the ARMv8.4-A instruction set architecture. Of the three instruction sets (A32, T32, A64) specified in this architecture, it only supports A64. Code written for the Apple M1 will in principle run on any other processor with the same instruction set, but may fail due to different operating systems and libraries.

Note also that instruction set architectures frequently have extensions. Code that makes use of instruction set extensions only runs on processors that support this extension. For example, x86 has the popular SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX-512, … extensions. ARMv8.4 too has extensions, but they are not really relevant for beginners.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading