Fixed-point built-ins

Prototype Description
int __assert1(int, int, int); Generates trap instructions for kernel debugging.
void __assert2(int); Generates trap instructions for kernel debugging.
unsigned int __cntlz4(unsigned int); Count Leading Zeros, 4-Byte Integer
unsigned int __cntlz8(unsigned long long); Count Leading Zeros, 8-Byte Integer
unsigned int __cnttz4(unsigned int); Count Trailing Zeros, 4-Byte Integer
unsigned int __cnttz8(unsigned long long); Count Trailing Zeros, 8-Byte Integer
struct __div_t __div (signed int, signed int); Divide the value passed to the first argument by the value contained in the second argument and return a div_t structure containing both the quotient, and the remainder of the division as two separate values.
struct __ldiv_t __ldiv (signed long, signed long); Compute quotient and remainder for long integer division
signed long long __llabs (signed long long); Return long long absolute value of the argument
unsigned short __load2r(unsigned short*); Load halfword byte reversed
unsigned int __load4r(unsigned int*); Load word byte reversed
long long int __mulhd(long long int ra, long long int rb); Multiply High Doubleword Signed.

Returns the highorder 64 bits of the 128bit product of the operands ra and rb.

unsigned long long int __mulhdu(unsigned long long int ra, unsigned long long int rb); Multiply High Doubleword Unsigned.

Returns the highorder 64 bits of the 128bit product of the operands ra and rb.

int __mulhw(int ra, int rb); Multiply High Word Signed.

Returns the highorder 32 bits of the 64bit product of the operands ra and rb.

unsigned int __mulhwu(unsigned int ra, unsigned int rb); Multiply High Word Unsigned.

Returns the highorder 32 bits of the 64bit product of the operands ra and rb.

int __popcnt4(unsigned int); Returns the number of bits set for a 32-bit integer.
int __popcnt8(unsigned long long); Returns the number of bits set for a 64-bit integer.
unsigned long __popcntb(unsigned long); Counts the 1 bits in each byte of the source operand and places that count into the corresponding byte of the result.

(POWER5 processors only)

int __poppar4(unsigned int); Returns 1 if there is an odd number of bits set in a 32-bit integer. Returns 0 otherwise.
int __poppar8(unsigned long long); Returns 1 if there is an odd number of bits set in a 64-bit integer. Returns 0 otherwise.
unsigned long long __rdlam(unsigned long long rs, unsigned int shift, unsigned long long mask); Rotate Double Left and AND with Mask.

The contents of rs are rotated left shift bits. The rotated data is ANDed with the mask and returned as a result. mask must be a constant and represent a contiguous bit field.

unsigned long long __rldimi(unsigned long long rs, unsigned long long is, unsigned int shift, unsigned long long mask); Rotate Left Doubleword Immediate then Mask Insert.

Rotates rs left shift bits then inserts rs into is under bit mask mask. Shift must be a constant and 0<=shift<=63. mask must be a constant and represent a contiguous bit field.

unsigned int __rlwimi(unsigned int rs, unsigned int is, unsigned int shift, unsigned int mask); Rotate Left Word Immidiate then Mask Insert.

Rotates rs left shift bits then inserts rs into is under bit mask mask. Shift must be a constant and 0<=shift<=31. mask must be a constant and represent a contiguous bit field.

unsigned int __rlwnm(unsigned int rs, unsigned int shift, unsigned int mask); Rotate Left Word then AND with Mask.

Rotates rs left shift bits, then ANDs rs with bit mask mask. mask must be a constant and represent a contiguous bit field.

unsigned int __rotatel4(unsigned int rs, unsigned int shift); Rotate Left Word.

Rotates rs left shift bits.

unsigned long long __rotatel8(unsigned long long rs, unsigned long long shift); Rotate Left Doubleword.

Rotates rs left shift bits.

void __store2r(unsigned short, unsigned short *); Store 2-byte register
void __store4r(unsigned int, unsigned int *); Store 4-byte register
void __tdw(long long a, long long b, unsigned int TO); Trap Doubleword.

Operand a is compared with operand b. This comparison results in five conditions which are ANDed with a 5-bit constant TO containing a value of 0 to 31 inclusive.

If the result is not 0 the system trap handler is invoked. Each bit positon, if set, indicates one or more of the following possible conditions:

0 (high-order bit)
a Less Than b, using signed comparison.
1
a Greater Than b, using signed comparison.
2
a Equal b
3
a Less Than b, using unsigned comparison.
4 (low order bit)
a Greater Than b, using unsigned comparison.
void __trap(int); Trap
void __trapd (longlong); Trap if the parameter is not zero.
void __tw(int a, int b, unsigned int TO); Trap Word.

Operand a is compared with operand b. This comparison results in five conditions which are ANDed with a 5-bit constant TO containing a value of 0 to 31 inclusive.

If the result is not 0 the system trap handler is invoked. Each bit positon, if set, indicates one or more of the following possible conditions:

0 (high-order bit)
a Less Than b, using signed comparison.
1
a Greater Than b, using signed comparison.
2
a Equal b
3
a Less Than b, using unsigned comparison.
4 (low order bit)
a Greater Than b, using unsigned comparison.