gccint: Integer library routines
1
1 4.1 Routines for integer arithmetic
1 ===================================
1
1 The integer arithmetic routines are used on platforms that don't provide
1 hardware support for arithmetic operations on some modes.
1
1 4.1.1 Arithmetic functions
1 --------------------------
1
1 -- Runtime Function: int __ashlsi3 (int A, int B)
1 -- Runtime Function: long __ashldi3 (long A, int B)
1 -- Runtime Function: long long __ashlti3 (long long A, int B)
1 These functions return the result of shifting A left by B bits.
1
1 -- Runtime Function: int __ashrsi3 (int A, int B)
1 -- Runtime Function: long __ashrdi3 (long A, int B)
1 -- Runtime Function: long long __ashrti3 (long long A, int B)
1 These functions return the result of arithmetically shifting A
1 right by B bits.
1
1 -- Runtime Function: int __divsi3 (int A, int B)
1 -- Runtime Function: long __divdi3 (long A, long B)
1 -- Runtime Function: long long __divti3 (long long A, long long B)
1 These functions return the quotient of the signed division of A and
1 B.
1
1 -- Runtime Function: int __lshrsi3 (int A, int B)
1 -- Runtime Function: long __lshrdi3 (long A, int B)
1 -- Runtime Function: long long __lshrti3 (long long A, int B)
1 These functions return the result of logically shifting A right by
1 B bits.
1
1 -- Runtime Function: int __modsi3 (int A, int B)
1 -- Runtime Function: long __moddi3 (long A, long B)
1 -- Runtime Function: long long __modti3 (long long A, long long B)
1 These functions return the remainder of the signed division of A
1 and B.
1
1 -- Runtime Function: int __mulsi3 (int A, int B)
1 -- Runtime Function: long __muldi3 (long A, long B)
1 -- Runtime Function: long long __multi3 (long long A, long long B)
1 These functions return the product of A and B.
1
1 -- Runtime Function: long __negdi2 (long A)
1 -- Runtime Function: long long __negti2 (long long A)
1 These functions return the negation of A.
1
1 -- Runtime Function: unsigned int __udivsi3 (unsigned int A, unsigned
1 int B)
1 -- Runtime Function: unsigned long __udivdi3 (unsigned long A, unsigned
1 long B)
1 -- Runtime Function: unsigned long long __udivti3 (unsigned long long
1 A, unsigned long long B)
1 These functions return the quotient of the unsigned division of A
1 and B.
1
1 -- Runtime Function: unsigned long __udivmoddi4 (unsigned long A,
1 unsigned long B, unsigned long *C)
1 -- Runtime Function: unsigned long long __udivmodti4 (unsigned long
1 long A, unsigned long long B, unsigned long long *C)
1 These functions calculate both the quotient and remainder of the
1 unsigned division of A and B. The return value is the quotient,
1 and the remainder is placed in variable pointed to by C.
1
1 -- Runtime Function: unsigned int __umodsi3 (unsigned int A, unsigned
1 int B)
1 -- Runtime Function: unsigned long __umoddi3 (unsigned long A, unsigned
1 long B)
1 -- Runtime Function: unsigned long long __umodti3 (unsigned long long
1 A, unsigned long long B)
1 These functions return the remainder of the unsigned division of A
1 and B.
1
1 4.1.2 Comparison functions
1 --------------------------
1
1 The following functions implement integral comparisons. These functions
1 implement a low-level compare, upon which the higher level comparison
1 operators (such as less than and greater than or equal to) can be
1 constructed. The returned values lie in the range zero to two, to allow
1 the high-level operators to be implemented by testing the returned
1 result using either signed or unsigned comparison.
1
1 -- Runtime Function: int __cmpdi2 (long A, long B)
1 -- Runtime Function: int __cmpti2 (long long A, long long B)
1 These functions perform a signed comparison of A and B. If A is
1 less than B, they return 0; if A is greater than B, they return 2;
1 and if A and B are equal they return 1.
1
1 -- Runtime Function: int __ucmpdi2 (unsigned long A, unsigned long B)
1 -- Runtime Function: int __ucmpti2 (unsigned long long A, unsigned long
1 long B)
1 These functions perform an unsigned comparison of A and B. If A is
1 less than B, they return 0; if A is greater than B, they return 2;
1 and if A and B are equal they return 1.
1
1 4.1.3 Trapping arithmetic functions
1 -----------------------------------
1
1 The following functions implement trapping arithmetic. These functions
1 call the libc function 'abort' upon signed arithmetic overflow.
1
1 -- Runtime Function: int __absvsi2 (int A)
1 -- Runtime Function: long __absvdi2 (long A)
1 These functions return the absolute value of A.
1
1 -- Runtime Function: int __addvsi3 (int A, int B)
1 -- Runtime Function: long __addvdi3 (long A, long B)
1 These functions return the sum of A and B; that is 'A + B'.
1
1 -- Runtime Function: int __mulvsi3 (int A, int B)
1 -- Runtime Function: long __mulvdi3 (long A, long B)
1 The functions return the product of A and B; that is 'A * B'.
1
1 -- Runtime Function: int __negvsi2 (int A)
1 -- Runtime Function: long __negvdi2 (long A)
1 These functions return the negation of A; that is '-A'.
1
1 -- Runtime Function: int __subvsi3 (int A, int B)
1 -- Runtime Function: long __subvdi3 (long A, long B)
1 These functions return the difference between B and A; that is 'A -
1 B'.
1
1 4.1.4 Bit operations
1 --------------------
1
1 -- Runtime Function: int __clzsi2 (unsigned int A)
1 -- Runtime Function: int __clzdi2 (unsigned long A)
1 -- Runtime Function: int __clzti2 (unsigned long long A)
1 These functions return the number of leading 0-bits in A, starting
1 at the most significant bit position. If A is zero, the result is
1 undefined.
1
1 -- Runtime Function: int __ctzsi2 (unsigned int A)
1 -- Runtime Function: int __ctzdi2 (unsigned long A)
1 -- Runtime Function: int __ctzti2 (unsigned long long A)
1 These functions return the number of trailing 0-bits in A, starting
1 at the least significant bit position. If A is zero, the result is
1 undefined.
1
1 -- Runtime Function: int __ffsdi2 (unsigned long A)
1 -- Runtime Function: int __ffsti2 (unsigned long long A)
1 These functions return the index of the least significant 1-bit in
1 A, or the value zero if A is zero. The least significant bit is
1 index one.
1
1 -- Runtime Function: int __paritysi2 (unsigned int A)
1 -- Runtime Function: int __paritydi2 (unsigned long A)
1 -- Runtime Function: int __parityti2 (unsigned long long A)
1 These functions return the value zero if the number of bits set in
1 A is even, and the value one otherwise.
1
1 -- Runtime Function: int __popcountsi2 (unsigned int A)
1 -- Runtime Function: int __popcountdi2 (unsigned long A)
1 -- Runtime Function: int __popcountti2 (unsigned long long A)
1 These functions return the number of bits set in A.
1
1 -- Runtime Function: int32_t __bswapsi2 (int32_t A)
1 -- Runtime Function: int64_t __bswapdi2 (int64_t A)
1 These functions return the A byteswapped.
1