User`s guide

Inline Assembly Language and Intrinsics
Intrinsic Functions
141Targeting MC56F83xx/DSP5685x Controllers
Intrinsic Functions
This section explains CodeWarrior intrinsic functions. It consists of these sections:
Implementation
Fractional Arithmetic
Intrinsic Functions for Math Support
Modulo Addressing Intrinsic Functions
Implementation
The CodeWarrior IDE for DSP56800E has intrinsic functions to generate inline-
assembly-language instructions. These intrinsic functions are a CodeWarrior
extension to ANSI C.
Use intrinsic functions to target specific processor instructions. For example:
Intrinsic functions let you pass in data for specific optimized computations. For
example, ANSI C data-representation rules may make certain calculations
inefficient, forcing the program to jump to runtime math routines. Such
calculations would be coded more efficiently as assembly language instructions
and intrinsic functions.
Intrinsic functions can control small tasks, such as enabling saturation. One
method is using inline assembly language syntax, specifying the operation in an
asm block, every time that the operation is required. But intrinsic functions let
you merely set the appropriate bit of the operating mode register.
The IDE implements intrinsic functions as inline C functions in file
intrinsics_56800E.h, in the MSL directory tree. These inline functions contain
mostly inline assembly language code. An example is the
abs_s intrinsic, defined as:
Listing 7.10 Example Code - Definition of Intrinsic Function: abs_s
#define abs_s(a) __abs_s(a)
/* ABS_S */
inline Word16 __abs_s(register Word16 svar1)
{
/*
* Defn: Absolute value of a 16-bit integer or fractional value
* returning a 16-bit result.
* Returns $7fff for an input of $8000
*
* DSP56800E instruction syntax: abs FFF
* Allowed src regs: FFF