xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/sparc32/README (revision d909946ca08dceb44d7d0f22ec9488679695d976)
1Copyright 1996, 2001 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 the GNU Lesser General Public License as published by
7the Free Software Foundation; either version 3 of the License, or (at your
8option) any later version.
9
10The GNU MP Library is distributed in the hope that it will be useful, but
11WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
13License for more details.
14
15You should have received a copy of the GNU Lesser General Public License
16along with the GNU MP Library.  If not, see http://www.gnu.org/licenses/.
17
18
19
20
21
22This directory contains mpn functions for various SPARC chips.  Code that
23runs only on version 8 SPARC implementations, is in the v8 subdirectory.
24
25RELEVANT OPTIMIZATION ISSUES
26
27  Load and Store timing
28
29On most early SPARC implementations, the ST instructions takes multiple
30cycles, while a STD takes just a single cycle more than an ST.  For the CPUs
31in SPARCstation I and II, the times are 3 and 4 cycles, respectively.
32Therefore, combining two ST instructions into a STD when possible is a
33significant optimization.
34
35Later SPARC implementations have single cycle ST.
36
37For SuperSPARC, we can perform just one memory instruction per cycle, even
38if up to two integer instructions can be executed in its pipeline.  For
39programs that perform so many memory operations that there are not enough
40non-memory operations to issue in parallel with all memory operations, using
41LDD and STD when possible helps.
42
43UltraSPARC-1/2 has very slow integer multiplication.  In the v9 subdirectory,
44we therefore use floating-point multiplication.
45
46STATUS
47
481. On a SuperSPARC, mpn_lshift and mpn_rshift run at 3 cycles/limb, or 2.5
49   cycles/limb asymptotically.  We could optimize speed for special counts
50   by using ADDXCC.
51
522. On a SuperSPARC, mpn_add_n and mpn_sub_n runs at 2.5 cycles/limb, or 2
53   cycles/limb asymptotically.
54
553. mpn_mul_1 runs at what is believed to be optimal speed.
56
574. On SuperSPARC, mpn_addmul_1 and mpn_submul_1 could both be improved by a
58   cycle by avoiding one of the add instructions.  See a29k/addmul_1.
59
60The speed of the code for other SPARC implementations is uncertain.
61