1Copyright 2000 Free Software Foundation, Inc. 2 3This file is part of the GNU MP Library. 4 5The GNU MP Library is free software; you can redistribute it and/or modify 6it under the terms of either: 7 8 * the GNU Lesser General Public License as published by the Free 9 Software Foundation; either version 3 of the License, or (at your 10 option) any later version. 11 12or 13 14 * the GNU General Public License as published by the Free Software 15 Foundation; either version 2 of the License, or (at your option) any 16 later version. 17 18or both in parallel, as here. 19 20The GNU MP Library is distributed in the hope that it will be useful, but 21WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23for more details. 24 25You should have received copies of the GNU General Public License and the 26GNU Lesser General Public License along with the GNU MP Library. If not, 27see https://www.gnu.org/licenses/. 28 29 30 31 32Terms Used In This Document: 33 ISA = Instruction Set Architecture. The instructions the current 34 processor provides. 35 ABI = Application Binary Interface. Specifies calling convention, 36 type sizes, etc. 37 AR64 = Arithmetic operations are 64-bit using 64-bit instructions 38 (E.g., addition, subtraction, load, store, of 64-bit integer types 39 are done with single instructions, not 32 bits at a time.) 40 Environment = The operating system and compiler. 41 42GMP is a very complex package to build since its speed is very 43sensitive to the ISA and ABI. For example, if the ISA provides 64-bit 44instructions, it is crucial that GMP is configured to use them. 45 46Most environments that run on a 64-bit ISA provide more than one ABI. 47Typically one of the supported ABI's is a backward compatible 32-bit 48ABI, and one ABI provides 64-bit addressing and `long' (sometimes 49known as LP64). But a few environments (IRIX, HP-UX) provide 50intermediate ABI's using 32-bit addressing but allow efficient 64-bit 51operations through a `long long' type. For the latter to be useful to 52GMP, the ABI must allow operations using the native 64-bit 53instructions provided by the ISA, and allow passing of 64-bit 54quantities atomically. 55 56The ABI is typically chosen by means of command line options to the 57compiler tools (gcc, cc, c89, nm, ar, ld, as). Different environments 58use different defaults, but as of this writing (May 2000) the 59dominating default is to the plain 32-bit ABI in its most arcane form. 60 61The GMP 3.0.x approach was to compile using the ABI that gives the 62best performance. That places the burden on users to pass special 63options to the compiler when they compile their GMP applications. 64That approach has its advantages and disadvantages. The main 65advantage is that users don't unknowingly get bad GMP performance. 66The main disadvantage is that users' compiles (actually links) will 67fail unless they pass special compiler options. 68 69** SPARC 70 71System vendors often confuse ABI, ISA, and implementation. The worst 72case is Solaris, were the unbundled compiler confuses ISA and ABI, and 73the options have very confusing names. 74 75 option interpretation 76 ====== ============== 77cc -xarch=v8plus ISA=sparcv9, ABI=V8plus (PTR=32, see below) 78gcc -mv8plus ISA=sparcv9, ABI=V8plus (see below) 79cc -xarch=v9 ISA=sparcv9, ABI=V9 (implying AR=64, PTR=64) 80 81It's hard to believe, but the option v8plus really means ISA=V9! 82 83Solaris releases prior to version 7 running on a V9 CPU fails to 84save/restore the upper 32 bits of the `i' and `l' registers. The 85`v8plus' option generates code that use as many V9 features as 86possible under such circumstances. 87 88** MIPS 89 90The IRIX 6 compilers gets things right. They have a clear 91understanding of the differences between ABI and ISA. The option 92names are descriptive. 93 94 option interpretation 95 ====== ============== 96cc -n32 ABI=n32 (implying AR=64, PTR=32) 97gcc -mabi=n32 ABI=n32 (implying AR=64, PTR=32) 98cc -64 ABI=64 (implying AR=64, PTR=64) 99gcc -mabi=64 ABI=64 (implying AR=64, PTR=64) 100cc -mips3 ISA=mips3 101gcc -mips3 ISA=mips3 102cc -mips4 ISA=mips4 103gcc -mips4 ISA=mips4 104 105** HP-PA 106 107HP-UX is somewhat weird, but not as broken as Solaris. 108 109 option interpretation 110 ====== ============== 111cc +DA2.0 ABI=32bit (implying AR=64, PTR=32) 112cc +DD64 ABI=64bit (implying AR=64, PTR=64) 113 114Code performing 64-bit arithmetic in the HP-UX 32-bit is not 115compatible with the 64-bit ABI; the former has a calling convention 116that passes/returns 64-bit integer quantities as two 32-bit chunks. 117 118** PowerPC 119 120While the PowerPC ABI's are capable of supporting 64-bit 121registers/operations, the compilers under AIX are similar to Solaris' 122cc in that they don't currently provide any 32-bit addressing with 12364-bit arithmetic. 124 125 option interpretation 126 ====== ============== 127cc -q64 ABI=64bit (implying AR=64, PTR=64) 128gcc -maix64 -mpowerpc64 ABI=64bit (implying AR=64, PTR=64) 129