Microchip Technology SW006022-1N Data Sheet

Page of 338
Built-in Functions
 2012 Microchip Technology Inc.
DS52071B-page 279
F.2
BUILT-IN FUNCTION DESCRIPTIONS
This section describes the programmer interface to the compiler built-in functions. Since the functions are 
“built in”, there are no header files associated with them. Similarly, there are no command-line switches 
associated with the built-in functions – they are always available. The built-in function names are chosen 
such that they belong to the compiler’s namespace (they all have the prefix __
builtin_
), so they will not 
conflict with function or variable names in the programmer’s namespace.
__builtin_addab
Description:
Add accumulators A and B with the result written back to the specified accumulator. For 
example: 
  volatile register int result asm("A");
  volatile register int B asm("A");
  result = 
__builtin_addab(result,B);
will generate: 
  add A
Prototype:
int 
__builtin_addab(int Accum_a, int Accum_b);
Argument:
Accum_a
First accumulator to add.
Accum_b
Second accumulator to add.
Return Value:
Returns the addition result to an accumulator.
Assembler Operator/ 
Machine Instruction:
add
Error Messages
An error message will be displayed if the result is not an accumulator register.
__builtin_add
Description:
Add value to the accumulator specified by result with a shift specified by literal shift. For 
example: 
  volatile register int result asm("A");
  int value;
  result = 
__builtin_add(result,value,0);
If value is held in w0, the following will be generated: 
  add w0, #0, A
Prototype:
int 
__builtin_add(int Accum,int value
  const int shift);
Argument:
Accum
Accumulator to add.
value
Integer number to add to accumulator value.
shift
Amount to shift resultant accumulator value.
Return Value:
Returns the shifted addition result to an accumulator.
Assembler Operator/ 
Machine Instruction:
add
Error Messages
An error message will be displayed if:
• the result is not an accumulator register
• argument 0 is not an accumulator
• the shift value is not a literal within range