Annotation of OpenXM_contrib/gmp/doc/isa_abi_headache, Revision 1.1
1.1 ! maekawa 1: Terms Used In This Document:
! 2: ISA = Instruction Set Architecture. The instructions the current
! 3: processor provides.
! 4: ABI = Application Binary Interface. Specifies calling convention,
! 5: type sizes, etc.
! 6: AR64 = Arithmetic operations are 64-bit using 64-bit instructions
! 7: (E.g., addition, subtraction, load, store, of 64-bit integer types
! 8: are done with single instructions, not 32 bits at a time.)
! 9: Environment = The operating system and compiler.
! 10:
! 11: GMP is a very complex package to build since its speed is very
! 12: sensitive to the ISA and ABI. For example, if the ISA provides 64-bit
! 13: instructions, it is crucial that GMP is configured to use them.
! 14:
! 15: Most environments that run on a 64-bit ISA provide more than one ABI.
! 16: Typically one of the supported ABI's is a backward compatible 32-bit
! 17: ABI, and one ABI provides 64-bit addressing and `long' (sometimes
! 18: known as LP64). But a few environments (IRIX, HP-UX) provide
! 19: intermediate ABI's using 32-bit addressing but allow efficient 64-bit
! 20: operations through a `long long' type. For the latter to be useful to
! 21: GMP, the ABI must allow operations using the native 64-bit
! 22: instructions provided by the ISA, and allow passing of 64-bit
! 23: quantities atomically.
! 24:
! 25: The ABI is typically chosen by means of command line options to the
! 26: compiler tools (gcc, cc, c89, nm, ar, ld, as). Different environments
! 27: use different defaults, but as of this writing (May 2000) the
! 28: dominating default is to the plain 32-bit ABI in its most arcane form.
! 29:
! 30: The GMP 3.0.x approach was to compile using the ABI that gives the
! 31: best performance. That places the burden on users to pass special
! 32: options to the compiler when they compile their GMP applications.
! 33: That approach has its advantages and disadvantages. The main
! 34: advantage is that users don't unknowingly get bad GMP performance.
! 35: The main disadvantage is that users' compiles (actually links) will
! 36: fail unless they pass special compiler options.
! 37:
! 38: ** SPARC
! 39:
! 40: System vendors often confuse ABI, ISA, and implementation. The worst
! 41: case is Solaris, were the unbundled compiler confuses ISA and ABI, and
! 42: the options have very confusing names.
! 43:
! 44: option interpretation
! 45: ====== ==============
! 46: cc -xarch=v8plus ISA=sparcv9, ABI=V8plus (PTR=32, see below)
! 47: gcc -mv8plus ISA=sparcv9, ABI=V8plus (see below)
! 48: cc -xarch=v9 ISA=sparcv9, ABI=V9 (implying AR=64, PTR=64)
! 49:
! 50: It's hard to believe, but the option v8plus really means ISA=V9!
! 51:
! 52: Solaris releases prior to version 7 running on a V9 CPU fails to
! 53: save/restore the upper 32 bits of the `i' and `l' registers. The
! 54: `v8plus' option generates code that use as many V9 features as
! 55: possible under such circumstances.
! 56:
! 57: ** MIPS
! 58:
! 59: The IRIX 6 compilers gets things right. They have a clear
! 60: understanding of the differences between ABI and ISA. The option
! 61: names are descriptive.
! 62:
! 63: option interpretation
! 64: ====== ==============
! 65: cc -n32 ABI=n32 (implying AR=64, PTR=32)
! 66: gcc -mabi=n32 ABI=n32 (implying AR=64, PTR=32)
! 67: cc -64 ABI=64 (implying AR=64, PTR=64)
! 68: gcc -mabi=64 ABI=64 (implying AR=64, PTR=64)
! 69: cc -mips3 ISA=mips3
! 70: gcc -mips3 ISA=mips3
! 71: cc -mips4 ISA=mips4
! 72: gcc -mips4 ISA=mips4
! 73:
! 74: ** HP-PA
! 75:
! 76: HP-UX is somewhat weird, but not as broken as Solaris.
! 77:
! 78: option interpretation
! 79: ====== ==============
! 80: cc +DA2.0 ABI=32bit (implying AR=64, PTR=32)
! 81: cc +DD64 ABI=64bit (implying AR=64, PTR=64)
! 82:
! 83: Code performing 64-bit arithmetic in the HP-UX 32-bit is not
! 84: compatible with the 64-bit ABI; the former has a calling convention
! 85: that passes/returns 64-bit integer quantities as two 32-bit chunks.
! 86:
! 87: ** PowerPC
! 88:
! 89: While the PowerPC ABI's are capable of supporting 64-bit
! 90: registers/operations, the compilers under AIX are similar to Solaris'
! 91: cc in that they don't currently provide any 32-bit addressing with
! 92: 64-bit arithmetic.
! 93:
! 94: option interpretation
! 95: ====== ==============
! 96: cc -q64 ABI=64bit (implying AR=64, PTR=64)
! 97: gcc -maix64 -mpowerpc64 ABI=64bit (implying AR=64, PTR=64)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>