1 Copyright 2002, 2005 Free Software Foundation, Inc.
3 This file is part of the GNU MP Library.
5 The GNU MP Library is free software; you can redistribute it and/or modify
6 it under the terms of either:
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.
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
18 or both in parallel, as here.
20 The GNU MP Library is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
25 You should have received copies of the GNU General Public License and the
26 GNU Lesser General Public License along with the GNU MP Library. If not,
27 see https://www.gnu.org/licenses/.
33 POWERPC 32-BIT MPN SUBROUTINES
36 This directory contains mpn functions for various 32-bit PowerPC chips.
42 ================================================
43 powerpc generic, 604, 604e, 744x, 745x
44 powerpc/750 740, 750, 7400, 7410
47 The top-level powerpc directory is currently mostly aimed at 604/604e but
48 should be reasonable on all powerpcs.
54 The code is quite well optimized for the 604e, other chips have had less
57 Altivec SIMD available in 74xx might hold some promise, but unfortunately
58 GMP only guarantees 32-bit data alignment, so there's lots of fiddling
59 around with partial operations at the start and end of limb vectors. A
60 128-bit limb would be a novel idea, but is unlikely to be practical, since
61 it would have to work with ordinary +, -, * etc in the C code.
63 Also, Altivec isn't very well suited for the GMP multiplication needs.
64 Using floating-point based multiplication has much better better performance
65 potential for all current powerpcs, both the ones with slow integer multiply
66 units (603, 740, 750, 7400, 7410) and those with fast (604, 604e, 744x,
67 745x). This is because all powerpcs do some level of pipelining in the FPU:
69 603 and 750 can sustain one fmadd every 2nd cycle.
70 604 and 604e can sustain one fmadd per cycle.
71 7400 and 7410 can sustain 3 fmadd in 4 cycles.
72 744x and 745x can sustain 4 fmadd in 5 cycles.
78 The normal powerpc convention is to give registers as plain numbers, like
79 "mtctr 6", but on Apple MacOS X (powerpc*-*-rhapsody* and
80 powerpc*-*-darwin*) the assembler demands an "r" like "mtctr r6". Note
81 however when register 0 in an instruction means a literal zero the "r" is
82 omitted, for instance "lwzx r6,0,r7".
84 The GMP code uses the "r" forms, powerpc-defs.m4 transforms them to plain
85 numbers according to what GMP_ASM_POWERPC_R_REGISTERS finds is needed.
86 (Note that this style isn't fully general, as the identifier r4 and the
87 register r4 will not be distinguishable on some systems. However, this is
88 not a problem for the limited GMP assembly usage.)
95 lis 9, __gmp_binvert_limb_table@ha
96 rlwinm 11, 5, 31, 25, 31
97 la 9, __gmp_binvert_limb_table@l(9)
106 lwz 7, .LCL0-.LCF0(30)
108 lwz 11, .LC0-.LCTOC1(30)
109 rlwinm 3, 5, 31, 25, 31
114 .tc __gmp_binvert_limb_table[TC],__gmp_binvert_limb_table[RW]
116 rlwinm 0, 5, 31, 25, 31
120 lis r2, ha16(___gmp_binvert_limb_table)
121 rlwinm r9, r5, 31, 25, 31
122 la r2, lo16(___gmp_binvert_limb_table)(r2)
130 addis r2, r7, ha16(L___gmp_binvert_limb_table$non_lazy_ptr-L0001$pb)
131 rlwinm r9, r5, 31, 25, 31
132 lwz r2, lo16(L___gmp_binvert_limb_table$non_lazy_ptr-L0001$pb)(r2)
135 .non_lazy_symbol_pointer
136 L___gmp_binvert_limb_table$non_lazy_ptr:
137 .indirect_symbol ___gmp_binvert_limb_table
139 .subsections_via_symbols
142 For GNU/Linux and Darwin, we might want to duplicate __gmp_binvert_limb_table
143 into the text section in this file. We should thus be able to reach it like
148 rlwinm r9, r5, 31, 25, 31
149 addi r9, r9, lo16(local_binvert_table-L0)
156 PowerPC Microprocessor Family: The Programming Environments for 32-bit
157 Microprocessors, IBM document G522-0290-01, 2000.
159 PowerPC 604e RISC Microprocessor User's Manual with Supplement for PowerPC
160 604 Microprocessor, IBM document G552-0330-00, Freescale document
161 MPC604EUM/AD, 3/1998.
163 MPC7410/MPC7400 RISC Microprocessor User's Manual, Freescale document
164 MPC7400UM/D, rev 1, 11/2002.
166 MPC7450 RISC Microprocessor Family Reference Manual, Freescale document
167 MPC7450UM, rev 5, 1/2005.
169 The above are available online from
171 http://www.ibm.com/chips/techlib/techlib.nsf/productfamilies/PowerPC
172 http://www.freescale.com/PowerPC