From time to time, I need to generate an assembly code from a C code to see how the compiler is generating stuff.
One of the problems I have is related to the assembly instructions that do not show register name, but just the number, which makes you confused related to literal and register names , as for example, when I generate an assembly for the following instructions, I see:
- Move value 0 to the register 9
- Move value of register 9 to register 3
The problem becomes worse when you mix GPR (General Purpose Register) with VSX registers, as:
If you do not know the Power Assembly instructions forms quite well, it is hard to map what is a immediate value, what is a GPR and what is a VSR.
If you are facing the same problem, the problem is that GCC has the option -mno-regnames as default.
In this case, I would recommend you using the GCC parameter -mregnames, which will dump registers differently than just the number, as %r for GPR and %vs for VSR registers. The code becomes much more human readable, as