This book describes the N32 High Performance, 32-bit Application Binary Interface (ABI) for the MIPS architecture. In addition to the overview in this chapter, other topics in this book include:
This document uses the following terminology:
o32: The 32-bit ABI generated by the ucode compiler (32-bit compilers prior to IRIX 6.1 operating system).
n32: The 32-bit ABI generated by the MIPSpro 64-bit compiler.
n64: The 64-bit ABI generated by the MIPSpro 64-bit compiler.
N32 is a minor variation on the high performance 64-bit ABI. All the performance of the hardware is available to the program and existing 32-bit ABI programs are easily ported. Table 1-1 compares the various ABIs.
Number of FP registers
Number of argument registers
64 (UX=1) *
* UX=1 implies 64-bit registers and also indicates that MIPS3 and MIPS4 instructions are legal. N32 uses 64-bit registers but restricts addresses to 32 bits.
The Application Binary Interface, or ABI, is the set of rules that all binaries must follow in order to run on an SGI system. This includes, for example, object file format, instruction set, data layout, subroutine calling convention, and system call numbers. The ABI is one part of the mechanism that maintains binary compatibility across all SGI platforms.
Until IRIX operating system version 6.1, SGI supported two ABIs: a 32-bit ABI and a 64-bit ABI. IRIX 6.1 and later versions support a new ABI, n32.
Many ISVs and customers find it difficult to port to the 64-bit ABI. An ABI was needed with all of the performance advantages of the 64-bit ABI, but with the same data type sizes as the 32-bit ABI to allow ease of porting.
The following sections outline limitations of the old 32-bit ABI and the 64-bit ABI. These issues form the motivation for the new N32 ABI. Specifically, the topics covered include the following:
16 of the 32 floating point registers cannot be used.
64-bit arithmetic instructions cannot be used.
64-bit data movement instructions cannot be used.
MIPS4/R8000 instructions cannot be used.
Because of this, the performance available from the chip is lost. Floating point intensive programs are especially hurt by these limitations; indeed some are 50% to 100% slower.
Porting code from the 32-bit ABI to the 64-bit ABI typically requires some recoding.
When ported from the 32-bit ABI to the 64-bit ABI, some C programs become significantly larger.
A compiler that supports n32. (The 6.1 and later versions of MIPSpro compilers support n32).
A kernel that supports n32. (IRIX 6.1 and later versions supports n32).
n32 versions of each library.
Install an n32 OS, compiler, and all n32 libraries.
Rewrite Assembly code to conform to n32 guidelines.
Prototype C functions that use varargs and floating point.
Recompile all the code with the compiler that supports n32 (use the n32 option on the command line). Makefile changes are needed only if explicit library paths are used.