5.1 Introduction
Built-in functions give the C programmer access to assembler operators or machine instructions that are currently only accessible using in-line assembly but are sufficiently useful that they are applicable in a broad range of applications. Built-in functions are coded in C source files syntactically like function calls, but they are compiled to assembly code that directly implements the function and does not involve function calls or library routines.
The built-in functions are preferred by programmers more than in-line assembly, for the following reasons :
- Providing built-in functions for specific purposes simplifies coding.
- Certain optimizations are disabled when in-line assembly is used as compared to built-in functions.
- For machine instructions that use dedicated registers, coding with in-line assembly needs care to avoid register allocation errors . The built-in functions make this process simpler as user need not be concerned with the particular register requirements for each individual machine instruction.
The built-in functions are listed below followed by their individual detailed descriptions.
- __builtin_addab
- __builtin_add
- __builtin_btg
- __builtin_clr
- __builtin_divf
- __builtin_divmodsd
- __builtin_divmodud
- __builtin_divsd
- __builtin_divud
- __builtin_dmaoffset
- __builtin_ed
- __builtin_edac
- __builtin_fbcl
- __builtin_lac
- __builtin_mac
- __builtin_modsd
- __builtin_modud
- __builtin_mpy
- __builtin_mpyn
- __builtin_msc
- __builtin_mulss
- __builtin_mulsu
- __builtin_mulus
- __builtin_muluu
- __builtin_nop
- __builtin_readsfr
- __builtin_return_address
- __builtin_sac
- __builtin_sacr
- __builtin_sftac
- __builtin_subab
The compiler provides additional built-in functions for operations, such as writing to Flash program memory and changing the oscillator settings. Refer to the MPLAB® C Compiler for dsPIC® DSCs User’s Guide (DS51284) for a complete list of compiler built-in functions.