Chapter 1. N32 ABI Overview

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:

What is N32?

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.

Table 1-1. ABI Comparison Summary





Compiler used




Integer model




Calling convention




Number of FP registers

16 (FR=0)

32 (FR=1)

32 (FR=1)

Number of argument registers




Debug format




ISAs supported




32/64 mode

32 (UX=0)

64 (UX=1) *

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.

Purpose of the n32 ABI

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:

Limitations of the 32-bit ABI

The 32-bit ABI was designed essentially for the R3000. It cannot be extended to use new performance-related features and instructions of the R4400 and beyond. For example:

  • 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.

Limitations of the 64-bit ABI

Although the 64-bit ABI exploits many performance-related features of the MIPS architecture, it also has problems. These include the following:

  • 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.

N32 Migration Requirements

In order to implement n32, SGI provides the following to our customers:

  • 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.

To take advantage of the N32 ABI, our customers must:

  • 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.