Assembly register vs CPU register

Viewed 114

As a CS beginner, I know that the CPU has some hardware called register that used to store temporary variables. But I also see x86 assembly code has the "register" conception like %EAX, %ECX. Wondering what's the difference here, or are they the same thing or do they have any relationships?

1 Answers

They were once the same thing, and in a more primitive CPU architecture they are still the same thing.

x86 now does register renaming and the CPU actually has a lot more registers than it would appear. On the other hand, you may write code as though that were not true. If you can tell the difference by any means other than execution speed, the CPU is buggy.

Related