We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I was reading The Definitive Guide to ARMCortexM0/M0+ by Joseph Yiu
In Chapter 21, under section 21.4.2 GNU Compiler Collection, there is a example function with inline assembly operation:
int my_mul_10(int DataIn) {
int DataOut; __asm(" movs r0, %0\n"
" movs r3, #10\n" " mul r0, r3\n" " movs %1, r0\n" :"=r" (DataOut) : "r" (DataIn) : "cc", "r0", "r3");
return DataOut; }
In the code example, %0 is the first input parameter and %1 is the first output parameter. Since the operand order is output _operands, input_operands, and clobbered_operands, “DataOut” is assigned to %0, and “DataIn” is assigned to %1. Since the code changes register R3, it needs to be added to the clobbered operand list.
Shouldn't "DataOut" is assigned to %1 and "DataIn" to %0?
Or am I missing something here?