Hacker News new | ask | show | jobs
by mathiasgredal 916 days ago
I get that there is a tradeoff with code density, although if you could have an encoding scheme or extended register mode to alleviate this. I was just thinking that if you have e.g a loop where you run out of registers, since you only have 16, then the compiler will swap the values to memory and reuse that register which creates an instruction dependency that doesnt really have to exist.

If the compiler could use the hidden registers, then the cpu would know that it could run this instruction ahead of time.

It is probably not worth it, since it adds a lot of complexity to an already complex system, which is why it isn’t done.

1 comments

All AMD64 CPUs support at least SSE2 which means they have 16 (not 15 or 14!) XMM registers they can spill to. This is just as fast as a move between two GPRs.