Built-in Functions

The Green Hills C and C++ compilers implement certain built-in functions. A C or C++ built-in function name begins with two underscores: _ _. A built-in function is recognized by the compiler as a special function. It usually generates optimized inline code, often using special instructions which do not correspond to standard C and C++ operations.

_ _MULUH, _ _MULSH

C and C++ function prototype:

extern unsigned int _ _MULUH(unsigned int a, unsigned int b);

extern signed int _ _MULSH( signed int a, signed int b);

The _ _MULUH(a,b) built-in function takes as arguments two 32-bit unsigned integers and returns the high 32-bit half of their 64-bit unsigned product. This built-in function generates inline code for most targets.

The _ _MULSH(a,b) built-in function takes as arguments two 32-bit signed

integers and returns the high 32-bit half of their 64-bit signed product.

The _ _MULUH and _ _MULSH built-in functions generate inline code for the

following targets:
MIPS
PowerPC
960
TriCore
V800
486
Sparc

_ _CLZ32

C and C++ function prototype:

extern unsigned int _ _CLZ32(unsigned int a);

The _ _CLZ32(a) built-in function takes a 32-bit integer argument and returns the count of leading zeros, which is a number from 0 to 32.

The _ _CLZ32 built-in function generates inline code for the following targets:
PowerPC
960
TriCore
MCore

_ _DI, _ _EI

C and C++ function prototype:

extern void _ _DI(void); /* disable interrupts */

extern void _ _EI(void); /* enable interrupts */

The _ _DI() built-in function disables interrupts.

The _ _EI() built-in function enables interrupts.

These two built-in functions can be used together as a pair to bracket a critical section of code which must not be interrupted.

The _ _DI and _ _EI built-in functions generate inline code for the following targets.
MIPS
PowerPC
SH
V800
TriCore
FR
MCore

For targets other than those listed, the _ _DI() and _ _EI() are undefined in the library.


Previous

Next



Copyright © 1999, Green Hills Software. All rights reserved.