xref: /netbsd-src/external/lgpl3/gmp/dist/mpn/x86/fat/gmp-mparam.h (revision 782713e6c126f1866c6d9cfdee4ceb49483b5828)
1 /* Fat binary x86 gmp-mparam.h -- Compiler/machine parameter header file.
2 
3 Copyright 1991, 1993, 1994, 2000-2003, 2011 Free Software Foundation, Inc.
4 
5 This file is part of the GNU MP Library.
6 
7 The GNU MP Library is free software; you can redistribute it and/or modify
8 it under the terms of either:
9 
10   * the GNU Lesser General Public License as published by the Free
11     Software Foundation; either version 3 of the License, or (at your
12     option) any later version.
13 
14 or
15 
16   * the GNU General Public License as published by the Free Software
17     Foundation; either version 2 of the License, or (at your option) any
18     later version.
19 
20 or both in parallel, as here.
21 
22 The GNU MP Library is distributed in the hope that it will be useful, but
23 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
24 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25 for more details.
26 
27 You should have received copies of the GNU General Public License and the
28 GNU Lesser General Public License along with the GNU MP Library.  If not,
29 see https://www.gnu.org/licenses/.  */
30 
31 #define GMP_LIMB_BITS 32
32 #define GMP_LIMB_BYTES 4
33 
34 
35 /* mpn_divexact_1 is faster than mpn_divrem_1 at all sizes.  The only time
36    this might not be true currently is for actual 80386 and 80486 chips,
37    where mpn/x86/dive_1.asm might be slower than mpn/x86/divrem_1.asm, but
38    that's not worth worrying about.  */
39 #define DIVEXACT_1_THRESHOLD  0
40 
41 /* Only some of the x86s have an mpn_preinv_divrem_1, but we set
42    USE_PREINV_DIVREM_1 so that all callers use it, and then let the
43    __gmpn_cpuvec pointer go to plain mpn_divrem_1 if there's not an actual
44    preinv.  */
45 #define USE_PREINV_DIVREM_1   1
46 
47 #define BMOD_1_TO_MOD_1_THRESHOLD           20
48 
49 /* mpn_sqr_basecase is faster than mpn_mul_basecase at all sizes, no need
50    for mpn_sqr to call the latter.  */
51 #define SQR_BASECASE_THRESHOLD 0
52 
53 /* Sensible fallbacks for these, when not taken from a cpu-specific
54    gmp-mparam.h.  */
55 #define MUL_TOOM22_THRESHOLD      20
56 #define MUL_TOOM33_THRESHOLD     130
57 #define SQR_TOOM2_THRESHOLD       30
58 #define SQR_TOOM3_THRESHOLD      200
59 
60 /* These are values more or less in the middle of what the typical x86 chips
61    come out as.  For a fat binary it's necessary to have values for these,
62    since the defaults for MUL_FFT_TABLE and SQR_FFT_TABLE otherwise come out
63    as non-constant array initializers.  FIXME: Perhaps these should be done
64    in the cpuvec structure like other thresholds.  */
65 #define MUL_FFT_TABLE  { 464, 928, 1920, 3584, 10240, 40960, 0 }
66 #define MUL_FFT_MODF_THRESHOLD          400
67 #define MUL_FFT_THRESHOLD              2000
68 
69 #define SQR_FFT_TABLE  { 528, 1184, 1920, 4608, 14336, 40960, 0 }
70 #define SQR_FFT_MODF_THRESHOLD          500
71 #define SQR_FFT_THRESHOLD              3000
72