If you consider "PC == Windows", then adding assembler to a C program doesn’t do much harm. If you enter the Unix world, you will have many different processors: PPC on PS3 or XBox, old Macs and many powerful servers. For many small devices you will have an ARM. Embedded devices (which account for the vast majority of installed processors today) usually use their own custom processor with a special set of instructions.
Thus, although many PCs today will be able to run Intel code, which accounts for only a small fraction of all processors.
However, x86 code is not always the same. There are two main reasons for assembly code: you need to access special functions (for example, interrupt registers) or you want to optimize the code. In the first case, the code is quite portable. In the latter case, each processor is slightly different. Some of them have SSE . But SSEs soon replaced SSE2, which was replaced by SSE3 and SSE4. AMD has its own brand. Coming Soon AVX. At the level of the operation code, each of them has slightly different time frames for different versions of the processors.
To aggravate the situation, some operation codes have errors that are fixed in certain processor steppings. In addition, some opcodes work much faster on some processor versions than on others.
Then you will need to associate this assembly code with part C. This usually means that you either need to deal with ABI problems.
So you can see that it can become arbitrarily complex.
Aaron digulla
source share