I'm trying to understand the syntax of writing in assembly to first write the code correctly and second efficiently.
in this example it shows the example using "=r"
asm volatile ("MRS %0, PMUSERENR_EL0\n": "=r"(value));
this reads the value of the register and stores it in the value variable. The other example uses ::"r"
asm volatile ("MSR PMUSERENR_EL0, %0\n":: "r"(value));
This writes the value variable to the PMUSERENR_ELO register. Here is another example of it:How to measure program execution time in ARM Cortex-A8 processor?.
When I attempt to compile a simple test code with the two above commands i get the error: :9:2: error: output operand constraint lacks '='
If I add the "=" and remove one ":" it will compile but when I test it, it simply says Illegal instruction
If someone could please explain the difference that would be helpful numerous assembly tutorials show the same format but no explanation. Its on a 64 bit arm platform if that offers any insight. Thanks.