Run-Time-Support Arithmetic Routines

The run-time-support library contains a number of assembly language functions that provide arithmetic routines for C/C++ math operations that the C7000 instruction set does not provide, such as integer division, integer remainder, and floating-point operations.

These routines follow the standard C/C++ calling sequence. The compiler automatically adds these routines when appropriate; they are not intended to be called directly by your programs.

The source code for these functions is provided in the lib/src source directory. The source code has comments that describe the operation of the functions. You can extract, inspect, and modify any of the math functions. Be sure, however, that you follow the calling conventions and register-saving rules outlined in this chapter. Table 6-3 summarizes the run-time-support functions used for arithmetic.

Table 6-3 C7000 Run-Time-Support Arithmetic Functions

Return Type C Function Description
void __c7xabi_abort_msg (const char *) Report failed assertion. (See notes below.)
double __c7xabi_divd (double, double) Divide two double-precision floats.
float __c7xabi_divf (float, float) Divide two single-precision floats.
int __c7xabi_divi (int, int) 32-bit signed integer division.
long long __c7xabi_divlli (long long, long long) 64-bit signed integer division.
unsigned __c7xabi_divu (unsigned, unsigned) 32-bit unsigned integer division.
unsigned long long __c7xabi_divull (unsigned long long, unsigned long long) 64-bit unsigned integer division.
long long __c7xabi_fixdlli (double) Convert double-precision float to 64-bit integer.
unsigned __c7xabi_fixdu (double) Convert double-precision float to 32-bit unsigned integer.
unsigned long long __c7xabi_fixdull (double) Convert double-precision float to 64-bit unsigned integer.
long long __c7xabi_fixflli (float) Convert single-precision float to 64-bit integer.
unsigned __c7xabi_fixfu (float) Convert single-precision float to 32-bit unsigned integer.
unsigned long long __c7xabi_fixfull (float) Convert single-precision float to 64-bit unsigned integer.
double __c7xabi_fltllid (long long) Convert 64-bit integer to double-precision float.
float __c7xabi_fltllif (long long) Convert 64-bit integer to single-precision float.
double __c7xabi_fltud (unsigned) Convert 32-bit unsigned integer to double-precision float.
float __c7xabi_fltuf (unsigned) Convert 32-bit unsigned integer to single-precision float.
double __c7xabi_fltulld (unsigned long long) Convert 64-bit unsigned integer to double-precision float.
float __c7xabi_fltullf (unsigned long long) Convert 64-bit unsigned integer to single-precision float.
int __c7xabi_remi (int, int) 32-bit integer modulo.
long long __c7xabi_remlli (long long, long long) 64-bit integer modulo.
unsigned __c7xabi_remu (unsigned, unsigned) 32-bit unsigned integer modulo.
unsigned long long __c7xabi_remull (unsigned long long, unsigned long long) 64-bit unsigned integer modulo.
void __c7xabi_strasg (int*, const int*, unsigned) Block copy. (See notes below.)
__c7xabi_unwind_cpp_pr0 Short frame unwinding, 16-bit scope.
__c7xabi_unwind_cpp_pr1 Long frame unwinding, 16-bit scope.
__c7xabi_unwind_cpp_pr2 Long frame unwinding, 32-bit scope.
__c7xabi_unwind_cpp_pr3 Unwinding, 24-bit encoding, 16-bit scope.

__c7xabi_abort_msg() Function:

void __c7xabi_abort_msg(const char *msg)

The function __c7xabi_abort_msg() is generated to print a diagnostic message when a run-time assertion (for example, the C assert macro) fails. It must not return. That is, it must call abort or terminate the program by other means.

__c7xabi_strasg() Function:

void __c7xabi_strasg(int* dst, const int* src, unsigned cnt)

The function __c7xabi_strasg() is generated by the compiler for efficient out-of-line structure or array copy operations. The cnt argument is the size in bytes.