Pragmas, Keywords, and Intrinsics

CLA accepts the C28x pragmas except for FAST_FUNC_CALL.

The far and ioport keywords are not recognized.

Access to the 'MMOV32 MSTF,mem32' and 'MMOV32 mem32,MSTF' instructions is provided using the cregister keyword. To access these MSTF instructions include the following declaration:

extern cregister volatile unsigned int MSTF;

The intrinsics listed in Table 10-1 are supported. Additionally, the run-time library functions abs() and fabs() are implemented as intrinsics.

Table 10-1 C/C++ Compiler Intrinsics for CLA

Intrinsic Assembly Instruction(s) Description
__mdebugstop() MDEBUGSTOP Debug stop
__meallow() MEALLOW Enable write access to EALLOW registers
__medis() MEDIS Disable write access to EALLOW registers
float __meinvf32(float x); MEINVF32x Estimate 1/x to about 8 bits of precision.
float __meisqrtf32(float x); MEISQRTF32x Estimate the square root of 1/x to about 8 bits of precision. The Newton-Raphson method is used to approximate the square root.
short __mf32toi16r(float src); MF32TOI16Rdst,src Convert double to int and round.
unsigned short __mf32toui16r(float src); MF32TOUI16Rdst,src Convert double to unsigned int and round.
float __mfracf32(float src); MFRACF32dst,src Return the fractional portion of src.
short __mgeq( signed int x, signed int y); MCMP32dst,src Return 1 if x is greater than or equal to y. Otherwise, return 0.
short __mgequ( unsigned int x, unsigned int y); MCMP32dst,src Return 1 if x is greater than or equal to y. Otherwise, return 0.
short __mgt( signed int x, signed int y); MCMP32dst,src Return 1 if x is greater than y. Otherwise, return 0.
short __mgtu( unsigned int x, unsigned int y); MCMP32dst,src Return 1 if x is greater than y. Otherwise, return 0.
short __mleq( signed int x, signed int y); MCMP32dst,src Return 1 if x is less than or equal to y. Otherwise, return 0.
short __mlequ( unsigned int x, unsigned int y); MCMP32dst,src Return 1 if x is less than or equal to y. Otherwise, return 0.
short __mlt( signed int x, signed int y); MCMP32dst,src Return 1 if x is less than y. Otherwise, return 0.
short __mltu( unsigned int x, unsigned int y); MCMP32dst,src Return 1 if x is less than y. Otherwise, return 0.
float __mmaxf32( float x, float y); MMAXF32dst, src Return the maximum of two 32-bit floating point values. If src>dst, copy src to dst.
float __mminf32( float x, float y); MMINF32dst, src Return the minimum of two 32-bit floating point values. If src<dst, copy src to dst.
__mnop() MNOP CLA no operation
__msetflg(unsigned short flag, unsigned short value) MSETFLGflag,value Set/clear flag(s) in the MSTF register. The flag is a bit mask to indicate which bits to modify. The value provides the values to assign to these bits. See the CLA Reference Guide (SPRUGE6) for details about the MSETFLG instruction and the MSET register.

This example sets the RNDF32 flag (bit 7) to 0, the TF flag (bit 6) to 0, and the NF flag (bit 2) to 1. The 0b prefix is a GCC language extension indicating that these are binary numbers.


__msetflg(0b11000100, 0b00000100);
void __mswapf(float &a, float &b); MSWAPFa, b Swap the contents of a and b.
float __sqrt(float x); MEISQRTF32x Estimate the square root of 1/x to about 8 bits of precision. The Newton-Raphson method is used to approximate the square root. This is an alias for the __meisqrtf32 intrinsic.

Comparison intrinsics, such as __mlt and __mleq are provided for CLA to avoid possible overflows when performing signed integer comparisons.

The following intrinsics are available only within CLA2 background tasks. The background task has the lowest priority task and so will always be interrupted when another interrupt is available. These intrinsics can be used to temporarily prevent such interrupts from suspending the background task.