1 /*
2  * Copyright (c) 2003 Bob Deblier
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  */
19 
20 /*!\file mpopt.h
21  * \brief Multi-precision integer optimization definitions.
22  * \author Bob Deblier <bob.deblier@telenet.be>
23  * \ingroup MP_m
24  */
25 
26 #ifndef _MPOPT_H
27 #define _MPOPT_H
28 
29 #if WIN32
30 # if __MWERKS__ && __INTEL__
31 # elif defined(_MSC_VER) && defined(_M_IX86)
32 #  define ASM_MPZERO
33 #  define ASM_MPFILL
34 #  define ASM_MPEVEN
35 #  define ASM_MPODD
36 #  define ASM_MPADDW
37 #  define ASM_MPSUBW
38 #  define ASM_MPADD
39 #  define ASM_MPSUB
40 #  define ASM_MPMULTWO
41 #  define ASM_MPDIVTWO
42 #  define ASM_MPSETMUL
43 #  define ASM_MPADDMUL
44 #  define ASM_MPADDSQRTRC
45 # endif
46 #endif
47 
48 #if defined(__DECC)
49 # if defined(OPTIMIZE_ALPHA)
50 #  define ASM_MPADD
51 #  define ASM_MPSUB
52 #  define ASM_MPSETMUL
53 #  define ASM_MPADDMUL
54 #  define ASM_MPADDSQRTRC
55 # endif
56 #endif
57 
58 #if defined(__GNUC__)
59 # if defined(OPTIMIZE_ALPHA)
60 #  define ASM_MPADD
61 #  define ASM_MPSUB
62 #  define ASM_MPSETMUL
63 #  define ASM_MPADDMUL
64 #  define ASM_MPADDSQRTRC
65 # elif defined(OPTIMIZE_ARM)
66 #  define ASM_MPSETMUL
67 #  define ASM_MPADDMUL
68 #  define ASM_MPADDSQRTRC
69 # elif defined(OPTIMIZE_I386) || defined(OPTIMIZE_I486) || defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)
70 #  define ASM_MPZERO
71 #  define ASM_MPFILL
72 #  define ASM_MPEVEN
73 #  define ASM_MPODD
74 #  define ASM_MPADD
75 #  define ASM_MPADDW
76 #  define ASM_MPSUB
77 #  define ASM_MPSUBW
78 #  define ASM_MPMULTWO
79 #  define ASM_MPDIVTWO
80 #  define ASM_MPSETMUL
81 #  define ASM_MPADDMUL
82 #  define ASM_MPADDSQRTRC
83 #  define ASM_MPPNDIV
84 # elif defined(OPTIMIZE_IA64)
85 #  define ASM_MPZERO
86 #  define ASM_MPCOPY
87 #  define ASM_MPADD
88 #  define ASM_MPSUB
89 #  define ASM_MPMULTWO
90 #  define ASM_MPSETMUL
91 #  define ASM_MPADDMUL
92 # elif defined(OPTIMIZE_M68K)
93 #  define ASM_MPADD
94 #  define ASM_MPSUB
95 #  define ASM_MPSETMUL
96 #  define ASM_MPADDMUL
97 #  define ASM_MPADDSQRTRC
98 # elif defined(OPTIMIZE_POWERPC) || defined(OPTIMIZE_POWERPC64)
99 #  define ASM_MPSETMUL
100 #  define ASM_MPADD
101 #  define ASM_MPADDW
102 #  define ASM_MPSUB
103 #  define ASM_MPSUBW
104 #  define ASM_MPMULTWO
105 #  define ASM_MPADDMUL
106 #  define ASM_MPADDSQRTRC
107 # elif defined(OPTIMIZE_S390X)
108 #  define ASM_MPSETMUL
109 #  define ASM_MPADDMUL
110 #  define ASM_MPADDSQRTRC
111 # elif defined(OPTIMIZE_SPARCV8)
112 #  define ASM_MPSETMUL
113 #  define ASM_MPADDMUL
114 #  define ASM_MPADDSQRTRC
115 # elif defined(OPTIMIZE_SPARCV8PLUS)
116 #  define ASM_MPADDW
117 #  define ASM_MPSUBW
118 #  define ASM_MPADD
119 #  define ASM_MPSUB
120 #  define ASM_MPMULTWO
121 #  define ASM_MPSETMUL
122 #  define ASM_MPADDMUL
123 #  define ASM_MPADDSQRTRC
124 # elif defined(OPTIMIZE_X86_64)
125 #  define ASM_MPZERO
126 #  define ASM_MPFILL
127 #  define ASM_MPEVEN
128 #  define ASM_MPODD
129 #  define ASM_MPADD
130 #  define ASM_MPADDW
131 #  define ASM_MPSUB
132 #  define ASM_MPSUBW
133 #  define ASM_MPDIVTWO
134 #  define ASM_MPMULTWO
135 #  define ASM_MPSETMUL
136 #  define ASM_MPADDMUL
137 #  define ASM_MPADDSQRTRC
138 # endif
139 #endif
140 
141 #if defined(__IBMC__)
142 # if defined(OPTIMIZE_POWERPC) || defined(OPTIMIZE_POWERPC64)
143 #  define ASM_MPSETMUL
144 #  define ASM_MPADDW
145 #  define ASM_MPSUBW
146 #  define ASM_MPADD
147 #  define ASM_MPSUB
148 #  define ASM_MPMULTWO
149 #  define ASM_MPADDMUL
150 #  define ASM_MPADDSQRTRC
151 # endif
152 #endif
153 
154 #if defined(__INTEL_COMPILER)
155 # if defined(OPTIMIZE_I386) || defined(OPTIMIZE_I486) || defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)
156 #  define ASM_MPZERO
157 #  define ASM_MPFILL
158 #  define ASM_MPEVEN
159 #  define ASM_MPODD
160 #  define ASM_MPADDW
161 #  define ASM_MPSUBW
162 #  define ASM_MPADD
163 #  define ASM_MPSUB
164 #  define ASM_MPMULTWO
165 #  define ASM_MPDIVTWO
166 #  define ASM_MPSETMUL
167 #  define ASM_MPADDMUL
168 #  define ASM_MPADDSQRTRC
169 #  define ASM_MPPNDIV
170 # endif
171 #endif
172 
173 #if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
174 # if defined(OPTIMIZE_SPARCV8)
175 #  define ASM_MPSETMUL
176 #  define ASM_MPADDMUL
177 #  define ASM_MPADDSQRTRC
178 # elif defined(OPTIMIZE_SPARCV8PLUS)
179 #  define ASM_MPADDW
180 #  define ASM_MPSUBW
181 #  define ASM_MPADD
182 #  define ASM_MPSUB
183 #  define ASM_MPMULTWO
184 #  define ASM_MPSETMUL
185 #  define ASM_MPADDMUL
186 #  define ASM_MPADDSQRTRC
187 # endif
188 #endif
189 
190 #endif
191