28.2.2 __builtin_add

Description

Add value to the accumulator specified by result with a shift specified by literal shift. For example:

 volatile register int16_t result asm("A");
 int16_t value;

 result = builtin_add(result,value,0);

If value is held in w0, the following will be generated:

 add w0, #0, A

Prototype

int16_t __builtin_add(int16_t Accum, int16_t value, const int16_t shift);

Arguments

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.

Example Instruction Sequence

add w0, #0, A

See example in Description.

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