Hi,
Here is a loop in Go:
https://play.golang.org/p/G4wdLi26LZ4With looking at the assembly, I can see that the loop counter uses
AX register while the total (t) use
the CX register:
0x004c 00076 (main.go:7) INCQ AX
0x004f 00079 (main.go:8) ADDQ DX, CX
I have a basic knowledge of assembly, but out of curiosity, why does the loop counter not use the counter register
CX? Isn't it the purpose of it?
And should not "t" use AX that looks more designed for that?
I guess since they are historical registers and have a general-purpose, it does not matter the way the language uses them?