This tip has been extracted from the full Control of In-line Assembly With MPLAB® XC16/32 article.
If you are using MPLAB XC16 or XC32, you should always use the extended form of the asm statement to ensure your code is robust and more readable.
This more descriptive form of assembly coding allows you to specify parameters that describe the input and output operands of the instruction as well as the device registers the instruction might change. This additional information allows the compiler to make adjustments to the surrounding output so that it can avoid or preserve resources used by the in-line assembly.
Extended syntax qualifiers can also indicate that instructions should not be optimized by the compiler, which is a common requirement for in-lined code.
The extended asm syntax allows you to reference C variables and labels in the instruction operands, making it easier for your in-line assembly to interact with C objects, labels, and making your assembly code more readable.
For details of the syntax and a full list and description of the parameter constraint letters, consult your XC compiler User’s Guide.