3 ms·
You don't need special cores. One thing a lot of people do not seem to realize is compilers do not use the full instruction set. They use a subset and this su
by StressedDev 3y ago
You don't need special cores. One thing a lot of people do not seem to realize is compilers do not use the full instruction set. They use a subset and this subset is what has to be fast. Here are the common x86 instructions I remember when I debugged disassembled source code (1).
- mov (an instruction to load, store data)
- Basic arithmetic instructions (add, sub, div, mul, etc.)
- Bitwise operators (or, and, xor, shift, etc.)
- Compare (cmp)
- Branch (jz, jnz, j, ret, etc.)
- There was one weird instruction I would occasionally see. It was used to zero memory (I forget its name). My guess is the compiler used it because it was faster than running creating a loop which zeroed memory.
The point is, people seem to assume ALL instructions have to be fast. The only instructions which have to be fast are the ones the compilers are using. The rest just have to work.
Making the rarely used instructions work probably takes up a negligible amount of space on a typical core. Moving these instructions to a special core would not get you much but would make old software run slower (becuase of the context switch to the other core and/or a limited number of cores it could run on).
Note that I know AMD and Intel both have a lot of guidance for compiler writers.
(1) I debugged disabled code because I was debugging optimized code and it was the only way to reliable determine why a function crashed or malfunctioned.
- Someone 3y ago> One thing a lot of people do not seem to realize is compilers do not use the full instruction set. They use a subset and this subset is what has to be fast. That’s a self-fulfilling prophecy. Compiler writers won’t use the instructions that are (relatively) slow. If, tomorrow, Intel makes ‘add’ slow, compilers will eventually start compiling addition as negation + subtraction (and AMD will become more popular) That’s what makes hardware designers unhappy sometimes. If they ship a shiny faster CPU that requires a large overhaul of compilers, it can take time for compiler writers to catch up. Hardware designers shouldn’t (only) aim for getting closer to the local optimum of where compiler writers are, but also for the higher peaks of where they could be.
- saagarjha 3y agoHardware designers typically work with compiler authors to get them to use instructions they'd like.