]>
Commit | Line | Data |
---|---|---|
df41dbaf | 1 | /* Costs of operations of individual x86 CPUs. |
99dee823 | 2 | Copyright (C) 1988-2021 Free Software Foundation, Inc. |
64766e8d | 3 | |
df41dbaf JH |
4 | This file is part of GCC. |
5 | ||
6 | GCC is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 3, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GCC is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | Under Section 7 of GPL version 3, you are granted additional | |
17 | permissions described in the GCC Runtime Library Exception, version | |
18 | 3.1, as published by the Free Software Foundation. | |
19 | ||
20 | You should have received a copy of the GNU General Public License and | |
21 | a copy of the GCC Runtime Library Exception along with this program; | |
22 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
23 | <http://www.gnu.org/licenses/>. */ | |
64766e8d JH |
24 | /* Processor costs (relative to an add) */ |
25 | /* We assume COSTS_N_INSNS is defined as (N)*4 and an addition is 2 bytes. */ | |
26 | #define COSTS_N_BYTES(N) ((N) * 2) | |
27 | ||
28 | #define DUMMY_STRINGOP_ALGS {libcall, {{-1, libcall, false}}} | |
29 | ||
30 | static stringop_algs ix86_size_memcpy[2] = { | |
31 | {rep_prefix_1_byte, {{-1, rep_prefix_1_byte, false}}}, | |
32 | {rep_prefix_1_byte, {{-1, rep_prefix_1_byte, false}}}}; | |
33 | static stringop_algs ix86_size_memset[2] = { | |
34 | {rep_prefix_1_byte, {{-1, rep_prefix_1_byte, false}}}, | |
35 | {rep_prefix_1_byte, {{-1, rep_prefix_1_byte, false}}}}; | |
36 | ||
37 | const | |
38 | struct processor_costs ix86_size_cost = {/* costs for tuning for size */ | |
72bb85f8 | 39 | { |
d321551c L |
40 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
41 | 2, /* cost for loading QImode using movzbl */ | |
42 | {2, 2, 2}, /* cost of loading integer registers | |
43 | in QImode, HImode and SImode. | |
44 | Relative to reg-reg move (2). */ | |
45 | {2, 2, 2}, /* cost of storing integer registers */ | |
46 | 2, /* cost of reg,reg fld/fst */ | |
47 | {2, 2, 2}, /* cost of loading fp registers | |
48 | in SFmode, DFmode and XFmode */ | |
49 | {2, 2, 2}, /* cost of storing fp registers | |
50 | in SFmode, DFmode and XFmode */ | |
51 | 3, /* cost of moving MMX register */ | |
52 | {3, 3}, /* cost of loading MMX registers | |
53 | in SImode and DImode */ | |
54 | {3, 3}, /* cost of storing MMX registers | |
55 | in SImode and DImode */ | |
56 | 3, 3, 3, /* cost of moving XMM,YMM,ZMM register */ | |
57 | {3, 3, 3, 3, 3}, /* cost of loading SSE registers | |
58 | in 32,64,128,256 and 512-bit */ | |
59 | {3, 3, 3, 3, 3}, /* cost of storing SSE registers | |
60 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 61 | 3, 3, /* SSE->integer and integer->SSE moves */ |
62 | 3, 3, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
63 | {2, 2, 2}, /* cost of loading mask register |
64 | in QImode, HImode, SImode. */ | |
65 | {2, 2, 2}, /* cost if storing mask register | |
66 | in QImode, HImode, SImode. */ | |
67 | 2, /* cost of moving mask register. */ | |
d321551c | 68 | /* End of register allocator costs. */ |
72bb85f8 | 69 | }, |
d321551c | 70 | |
64766e8d JH |
71 | COSTS_N_BYTES (2), /* cost of an add instruction */ |
72 | COSTS_N_BYTES (3), /* cost of a lea instruction */ | |
73 | COSTS_N_BYTES (2), /* variable shift costs */ | |
74 | COSTS_N_BYTES (3), /* constant shift costs */ | |
75 | {COSTS_N_BYTES (3), /* cost of starting multiply for QI */ | |
76 | COSTS_N_BYTES (3), /* HI */ | |
77 | COSTS_N_BYTES (3), /* SI */ | |
78 | COSTS_N_BYTES (3), /* DI */ | |
79 | COSTS_N_BYTES (5)}, /* other */ | |
80 | 0, /* cost of multiply per each bit set */ | |
81 | {COSTS_N_BYTES (3), /* cost of a divide/mod for QI */ | |
82 | COSTS_N_BYTES (3), /* HI */ | |
83 | COSTS_N_BYTES (3), /* SI */ | |
84 | COSTS_N_BYTES (3), /* DI */ | |
85 | COSTS_N_BYTES (5)}, /* other */ | |
86 | COSTS_N_BYTES (3), /* cost of movsx */ | |
87 | COSTS_N_BYTES (3), /* cost of movzx */ | |
88 | 0, /* "large" insn */ | |
89 | 2, /* MOVE_RATIO */ | |
25e22b19 | 90 | 2, /* CLEAR_RATIO */ |
64766e8d JH |
91 | {2, 2, 2}, /* cost of loading integer registers |
92 | in QImode, HImode and SImode. | |
93 | Relative to reg-reg move (2). */ | |
94 | {2, 2, 2}, /* cost of storing integer registers */ | |
d321551c L |
95 | {3, 3, 3, 3, 3}, /* cost of loading SSE register |
96 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
97 | {3, 3, 3, 3, 3}, /* cost of storing SSE register | |
98 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf JH |
99 | {3, 3, 3, 3, 3}, /* cost of unaligned SSE load |
100 | in 128bit, 256bit and 512bit */ | |
d321551c | 101 | {3, 3, 3, 3, 3}, /* cost of unaligned SSE store |
df41dbaf | 102 | in 128bit, 256bit and 512bit */ |
d321551c L |
103 | 3, 3, 3, /* cost of moving XMM,YMM,ZMM register */ |
104 | 3, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
105 | 5, 0, /* Gather load static, per_elt. */ |
106 | 5, 0, /* Gather store static, per_elt. */ | |
64766e8d JH |
107 | 0, /* size of l1 cache */ |
108 | 0, /* size of l2 cache */ | |
109 | 0, /* size of prefetch block */ | |
110 | 0, /* number of parallel prefetches */ | |
111 | 2, /* Branch cost */ | |
112 | COSTS_N_BYTES (2), /* cost of FADD and FSUB insns. */ | |
113 | COSTS_N_BYTES (2), /* cost of FMUL instruction. */ | |
114 | COSTS_N_BYTES (2), /* cost of FDIV instruction. */ | |
115 | COSTS_N_BYTES (2), /* cost of FABS instruction. */ | |
116 | COSTS_N_BYTES (2), /* cost of FCHS instruction. */ | |
117 | COSTS_N_BYTES (2), /* cost of FSQRT instruction. */ | |
6065f444 | 118 | |
c53c148c | 119 | COSTS_N_BYTES (2), /* cost of cheap SSE instruction. */ |
6065f444 JH |
120 | COSTS_N_BYTES (2), /* cost of ADDSS/SD SUBSS/SD insns. */ |
121 | COSTS_N_BYTES (2), /* cost of MULSS instruction. */ | |
122 | COSTS_N_BYTES (2), /* cost of MULSD instruction. */ | |
c53c148c JH |
123 | COSTS_N_BYTES (2), /* cost of FMA SS instruction. */ |
124 | COSTS_N_BYTES (2), /* cost of FMA SD instruction. */ | |
6065f444 JH |
125 | COSTS_N_BYTES (2), /* cost of DIVSS instruction. */ |
126 | COSTS_N_BYTES (2), /* cost of DIVSD instruction. */ | |
127 | COSTS_N_BYTES (2), /* cost of SQRTSS instruction. */ | |
128 | COSTS_N_BYTES (2), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
129 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
130 | ix86_size_memcpy, | |
131 | ix86_size_memset, | |
f6fd8f2b JH |
132 | COSTS_N_BYTES (1), /* cond_taken_branch_cost. */ |
133 | COSTS_N_BYTES (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
134 | NULL, /* Loop alignment. */ |
135 | NULL, /* Jump alignment. */ | |
136 | NULL, /* Label alignment. */ | |
137 | NULL, /* Func alignment. */ | |
64766e8d JH |
138 | }; |
139 | ||
140 | /* Processor costs (relative to an add) */ | |
141 | static stringop_algs i386_memcpy[2] = { | |
142 | {rep_prefix_1_byte, {{-1, rep_prefix_1_byte, false}}}, | |
143 | DUMMY_STRINGOP_ALGS}; | |
144 | static stringop_algs i386_memset[2] = { | |
145 | {rep_prefix_1_byte, {{-1, rep_prefix_1_byte, false}}}, | |
146 | DUMMY_STRINGOP_ALGS}; | |
147 | ||
148 | static const | |
149 | struct processor_costs i386_cost = { /* 386 specific costs */ | |
72bb85f8 | 150 | { |
d321551c L |
151 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
152 | 4, /* cost for loading QImode using movzbl */ | |
153 | {2, 4, 2}, /* cost of loading integer registers | |
154 | in QImode, HImode and SImode. | |
155 | Relative to reg-reg move (2). */ | |
156 | {2, 4, 2}, /* cost of storing integer registers */ | |
157 | 2, /* cost of reg,reg fld/fst */ | |
158 | {8, 8, 8}, /* cost of loading fp registers | |
159 | in SFmode, DFmode and XFmode */ | |
160 | {8, 8, 8}, /* cost of storing fp registers | |
161 | in SFmode, DFmode and XFmode */ | |
162 | 2, /* cost of moving MMX register */ | |
163 | {4, 8}, /* cost of loading MMX registers | |
164 | in SImode and DImode */ | |
165 | {4, 8}, /* cost of storing MMX registers | |
166 | in SImode and DImode */ | |
167 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
168 | {4, 8, 16, 32, 64}, /* cost of loading SSE registers | |
169 | in 32,64,128,256 and 512-bit */ | |
170 | {4, 8, 16, 32, 64}, /* cost of storing SSE registers | |
171 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 172 | 3, 3, /* SSE->integer and integer->SSE moves */ |
173 | 3, 3, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
174 | {2, 4, 2}, /* cost of loading mask register |
175 | in QImode, HImode, SImode. */ | |
176 | {2, 4, 2}, /* cost if storing mask register | |
177 | in QImode, HImode, SImode. */ | |
178 | 2, /* cost of moving mask register. */ | |
d321551c | 179 | /* End of register allocator costs. */ |
72bb85f8 | 180 | }, |
d321551c | 181 | |
64766e8d JH |
182 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
183 | COSTS_N_INSNS (1), /* cost of a lea instruction */ | |
184 | COSTS_N_INSNS (3), /* variable shift costs */ | |
185 | COSTS_N_INSNS (2), /* constant shift costs */ | |
186 | {COSTS_N_INSNS (6), /* cost of starting multiply for QI */ | |
187 | COSTS_N_INSNS (6), /* HI */ | |
188 | COSTS_N_INSNS (6), /* SI */ | |
189 | COSTS_N_INSNS (6), /* DI */ | |
190 | COSTS_N_INSNS (6)}, /* other */ | |
191 | COSTS_N_INSNS (1), /* cost of multiply per each bit set */ | |
192 | {COSTS_N_INSNS (23), /* cost of a divide/mod for QI */ | |
193 | COSTS_N_INSNS (23), /* HI */ | |
194 | COSTS_N_INSNS (23), /* SI */ | |
195 | COSTS_N_INSNS (23), /* DI */ | |
196 | COSTS_N_INSNS (23)}, /* other */ | |
197 | COSTS_N_INSNS (3), /* cost of movsx */ | |
198 | COSTS_N_INSNS (2), /* cost of movzx */ | |
199 | 15, /* "large" insn */ | |
200 | 3, /* MOVE_RATIO */ | |
25e22b19 | 201 | 3, /* CLEAR_RATIO */ |
64766e8d JH |
202 | {2, 4, 2}, /* cost of loading integer registers |
203 | in QImode, HImode and SImode. | |
204 | Relative to reg-reg move (2). */ | |
205 | {2, 4, 2}, /* cost of storing integer registers */ | |
d321551c L |
206 | {4, 8, 16, 32, 64}, /* cost of loading SSE register |
207 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
208 | {4, 8, 16, 32, 64}, /* cost of storing SSE register | |
209 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf | 210 | {4, 8, 16, 32, 64}, /* cost of unaligned loads. */ |
df41dbaf | 211 | {4, 8, 16, 32, 64}, /* cost of unaligned stores. */ |
d321551c L |
212 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
213 | 3, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
214 | 4, 4, /* Gather load static, per_elt. */ |
215 | 4, 4, /* Gather store static, per_elt. */ | |
64766e8d JH |
216 | 0, /* size of l1 cache */ |
217 | 0, /* size of l2 cache */ | |
218 | 0, /* size of prefetch block */ | |
219 | 0, /* number of parallel prefetches */ | |
220 | 1, /* Branch cost */ | |
221 | COSTS_N_INSNS (23), /* cost of FADD and FSUB insns. */ | |
222 | COSTS_N_INSNS (27), /* cost of FMUL instruction. */ | |
223 | COSTS_N_INSNS (88), /* cost of FDIV instruction. */ | |
224 | COSTS_N_INSNS (22), /* cost of FABS instruction. */ | |
225 | COSTS_N_INSNS (24), /* cost of FCHS instruction. */ | |
226 | COSTS_N_INSNS (122), /* cost of FSQRT instruction. */ | |
6065f444 | 227 | |
c53c148c | 228 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
229 | COSTS_N_INSNS (23), /* cost of ADDSS/SD SUBSS/SD insns. */ |
230 | COSTS_N_INSNS (27), /* cost of MULSS instruction. */ | |
231 | COSTS_N_INSNS (27), /* cost of MULSD instruction. */ | |
c53c148c JH |
232 | COSTS_N_INSNS (27), /* cost of FMA SS instruction. */ |
233 | COSTS_N_INSNS (27), /* cost of FMA SD instruction. */ | |
6065f444 JH |
234 | COSTS_N_INSNS (88), /* cost of DIVSS instruction. */ |
235 | COSTS_N_INSNS (88), /* cost of DIVSD instruction. */ | |
236 | COSTS_N_INSNS (122), /* cost of SQRTSS instruction. */ | |
237 | COSTS_N_INSNS (122), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
238 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
239 | i386_memcpy, | |
240 | i386_memset, | |
f6fd8f2b JH |
241 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
242 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
243 | "4", /* Loop alignment. */ |
244 | "4", /* Jump alignment. */ | |
245 | NULL, /* Label alignment. */ | |
246 | "4", /* Func alignment. */ | |
64766e8d JH |
247 | }; |
248 | ||
249 | static stringop_algs i486_memcpy[2] = { | |
250 | {rep_prefix_4_byte, {{-1, rep_prefix_4_byte, false}}}, | |
251 | DUMMY_STRINGOP_ALGS}; | |
252 | static stringop_algs i486_memset[2] = { | |
253 | {rep_prefix_4_byte, {{-1, rep_prefix_4_byte, false}}}, | |
254 | DUMMY_STRINGOP_ALGS}; | |
255 | ||
256 | static const | |
257 | struct processor_costs i486_cost = { /* 486 specific costs */ | |
72bb85f8 | 258 | { |
d321551c L |
259 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
260 | 4, /* cost for loading QImode using movzbl */ | |
261 | {2, 4, 2}, /* cost of loading integer registers | |
262 | in QImode, HImode and SImode. | |
263 | Relative to reg-reg move (2). */ | |
264 | {2, 4, 2}, /* cost of storing integer registers */ | |
265 | 2, /* cost of reg,reg fld/fst */ | |
266 | {8, 8, 8}, /* cost of loading fp registers | |
267 | in SFmode, DFmode and XFmode */ | |
268 | {8, 8, 8}, /* cost of storing fp registers | |
269 | in SFmode, DFmode and XFmode */ | |
270 | 2, /* cost of moving MMX register */ | |
271 | {4, 8}, /* cost of loading MMX registers | |
272 | in SImode and DImode */ | |
273 | {4, 8}, /* cost of storing MMX registers | |
274 | in SImode and DImode */ | |
275 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
276 | {4, 8, 16, 32, 64}, /* cost of loading SSE registers | |
277 | in 32,64,128,256 and 512-bit */ | |
278 | {4, 8, 16, 32, 64}, /* cost of storing SSE registers | |
279 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 280 | 3, 3, /* SSE->integer and integer->SSE moves */ |
281 | 3, 3, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
282 | {2, 4, 2}, /* cost of loading mask register |
283 | in QImode, HImode, SImode. */ | |
284 | {2, 4, 2}, /* cost if storing mask register | |
285 | in QImode, HImode, SImode. */ | |
286 | 2, /* cost of moving mask register. */ | |
d321551c | 287 | /* End of register allocator costs. */ |
72bb85f8 | 288 | }, |
d321551c | 289 | |
64766e8d JH |
290 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
291 | COSTS_N_INSNS (1), /* cost of a lea instruction */ | |
292 | COSTS_N_INSNS (3), /* variable shift costs */ | |
293 | COSTS_N_INSNS (2), /* constant shift costs */ | |
294 | {COSTS_N_INSNS (12), /* cost of starting multiply for QI */ | |
295 | COSTS_N_INSNS (12), /* HI */ | |
296 | COSTS_N_INSNS (12), /* SI */ | |
297 | COSTS_N_INSNS (12), /* DI */ | |
298 | COSTS_N_INSNS (12)}, /* other */ | |
299 | 1, /* cost of multiply per each bit set */ | |
300 | {COSTS_N_INSNS (40), /* cost of a divide/mod for QI */ | |
301 | COSTS_N_INSNS (40), /* HI */ | |
302 | COSTS_N_INSNS (40), /* SI */ | |
303 | COSTS_N_INSNS (40), /* DI */ | |
304 | COSTS_N_INSNS (40)}, /* other */ | |
305 | COSTS_N_INSNS (3), /* cost of movsx */ | |
306 | COSTS_N_INSNS (2), /* cost of movzx */ | |
307 | 15, /* "large" insn */ | |
308 | 3, /* MOVE_RATIO */ | |
25e22b19 | 309 | 3, /* CLEAR_RATIO */ |
64766e8d JH |
310 | {2, 4, 2}, /* cost of loading integer registers |
311 | in QImode, HImode and SImode. | |
312 | Relative to reg-reg move (2). */ | |
313 | {2, 4, 2}, /* cost of storing integer registers */ | |
d321551c L |
314 | {4, 8, 16, 32, 64}, /* cost of loading SSE register |
315 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
316 | {4, 8, 16, 32, 64}, /* cost of storing SSE register | |
317 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf | 318 | {4, 8, 16, 32, 64}, /* cost of unaligned loads. */ |
df41dbaf | 319 | {4, 8, 16, 32, 64}, /* cost of unaligned stores. */ |
d321551c L |
320 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
321 | 3, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
322 | 4, 4, /* Gather load static, per_elt. */ |
323 | 4, 4, /* Gather store static, per_elt. */ | |
64766e8d JH |
324 | 4, /* size of l1 cache. 486 has 8kB cache |
325 | shared for code and data, so 4kB is | |
326 | not really precise. */ | |
327 | 4, /* size of l2 cache */ | |
328 | 0, /* size of prefetch block */ | |
329 | 0, /* number of parallel prefetches */ | |
330 | 1, /* Branch cost */ | |
331 | COSTS_N_INSNS (8), /* cost of FADD and FSUB insns. */ | |
332 | COSTS_N_INSNS (16), /* cost of FMUL instruction. */ | |
333 | COSTS_N_INSNS (73), /* cost of FDIV instruction. */ | |
334 | COSTS_N_INSNS (3), /* cost of FABS instruction. */ | |
335 | COSTS_N_INSNS (3), /* cost of FCHS instruction. */ | |
336 | COSTS_N_INSNS (83), /* cost of FSQRT instruction. */ | |
6065f444 | 337 | |
c53c148c | 338 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
339 | COSTS_N_INSNS (8), /* cost of ADDSS/SD SUBSS/SD insns. */ |
340 | COSTS_N_INSNS (16), /* cost of MULSS instruction. */ | |
341 | COSTS_N_INSNS (16), /* cost of MULSD instruction. */ | |
c53c148c JH |
342 | COSTS_N_INSNS (16), /* cost of FMA SS instruction. */ |
343 | COSTS_N_INSNS (16), /* cost of FMA SD instruction. */ | |
6065f444 JH |
344 | COSTS_N_INSNS (73), /* cost of DIVSS instruction. */ |
345 | COSTS_N_INSNS (74), /* cost of DIVSD instruction. */ | |
346 | COSTS_N_INSNS (83), /* cost of SQRTSS instruction. */ | |
347 | COSTS_N_INSNS (83), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
348 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
349 | i486_memcpy, | |
350 | i486_memset, | |
f6fd8f2b JH |
351 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
352 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
353 | "16", /* Loop alignment. */ |
354 | "16", /* Jump alignment. */ | |
355 | "0:0:8", /* Label alignment. */ | |
356 | "16", /* Func alignment. */ | |
64766e8d JH |
357 | }; |
358 | ||
359 | static stringop_algs pentium_memcpy[2] = { | |
360 | {libcall, {{256, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
361 | DUMMY_STRINGOP_ALGS}; | |
362 | static stringop_algs pentium_memset[2] = { | |
363 | {libcall, {{-1, rep_prefix_4_byte, false}}}, | |
364 | DUMMY_STRINGOP_ALGS}; | |
365 | ||
366 | static const | |
367 | struct processor_costs pentium_cost = { | |
72bb85f8 | 368 | { |
d321551c L |
369 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
370 | 6, /* cost for loading QImode using movzbl */ | |
371 | {2, 4, 2}, /* cost of loading integer registers | |
372 | in QImode, HImode and SImode. | |
373 | Relative to reg-reg move (2). */ | |
374 | {2, 4, 2}, /* cost of storing integer registers */ | |
375 | 2, /* cost of reg,reg fld/fst */ | |
376 | {2, 2, 6}, /* cost of loading fp registers | |
377 | in SFmode, DFmode and XFmode */ | |
378 | {4, 4, 6}, /* cost of storing fp registers | |
379 | in SFmode, DFmode and XFmode */ | |
380 | 8, /* cost of moving MMX register */ | |
381 | {8, 8}, /* cost of loading MMX registers | |
382 | in SImode and DImode */ | |
383 | {8, 8}, /* cost of storing MMX registers | |
384 | in SImode and DImode */ | |
385 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
386 | {4, 8, 16, 32, 64}, /* cost of loading SSE registers | |
387 | in 32,64,128,256 and 512-bit */ | |
388 | {4, 8, 16, 32, 64}, /* cost of storing SSE registers | |
389 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 390 | 3, 3, /* SSE->integer and integer->SSE moves */ |
391 | 3, 3, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
392 | {2, 4, 2}, /* cost of loading mask register |
393 | in QImode, HImode, SImode. */ | |
394 | {2, 4, 2}, /* cost if storing mask register | |
395 | in QImode, HImode, SImode. */ | |
396 | 2, /* cost of moving mask register. */ | |
d321551c | 397 | /* End of register allocator costs. */ |
72bb85f8 | 398 | }, |
d321551c | 399 | |
64766e8d JH |
400 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
401 | COSTS_N_INSNS (1), /* cost of a lea instruction */ | |
402 | COSTS_N_INSNS (4), /* variable shift costs */ | |
403 | COSTS_N_INSNS (1), /* constant shift costs */ | |
404 | {COSTS_N_INSNS (11), /* cost of starting multiply for QI */ | |
405 | COSTS_N_INSNS (11), /* HI */ | |
406 | COSTS_N_INSNS (11), /* SI */ | |
407 | COSTS_N_INSNS (11), /* DI */ | |
408 | COSTS_N_INSNS (11)}, /* other */ | |
409 | 0, /* cost of multiply per each bit set */ | |
410 | {COSTS_N_INSNS (25), /* cost of a divide/mod for QI */ | |
411 | COSTS_N_INSNS (25), /* HI */ | |
412 | COSTS_N_INSNS (25), /* SI */ | |
413 | COSTS_N_INSNS (25), /* DI */ | |
414 | COSTS_N_INSNS (25)}, /* other */ | |
415 | COSTS_N_INSNS (3), /* cost of movsx */ | |
416 | COSTS_N_INSNS (2), /* cost of movzx */ | |
417 | 8, /* "large" insn */ | |
418 | 6, /* MOVE_RATIO */ | |
25e22b19 | 419 | 6, /* CLEAR_RATIO */ |
64766e8d JH |
420 | {2, 4, 2}, /* cost of loading integer registers |
421 | in QImode, HImode and SImode. | |
422 | Relative to reg-reg move (2). */ | |
423 | {2, 4, 2}, /* cost of storing integer registers */ | |
d321551c L |
424 | {4, 8, 16, 32, 64}, /* cost of loading SSE register |
425 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
426 | {4, 8, 16, 32, 64}, /* cost of storing SSE register | |
427 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf | 428 | {4, 8, 16, 32, 64}, /* cost of unaligned loads. */ |
df41dbaf | 429 | {4, 8, 16, 32, 64}, /* cost of unaligned stores. */ |
d321551c L |
430 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
431 | 3, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
432 | 4, 4, /* Gather load static, per_elt. */ |
433 | 4, 4, /* Gather store static, per_elt. */ | |
64766e8d JH |
434 | 8, /* size of l1 cache. */ |
435 | 8, /* size of l2 cache */ | |
436 | 0, /* size of prefetch block */ | |
437 | 0, /* number of parallel prefetches */ | |
438 | 2, /* Branch cost */ | |
439 | COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */ | |
440 | COSTS_N_INSNS (3), /* cost of FMUL instruction. */ | |
441 | COSTS_N_INSNS (39), /* cost of FDIV instruction. */ | |
442 | COSTS_N_INSNS (1), /* cost of FABS instruction. */ | |
443 | COSTS_N_INSNS (1), /* cost of FCHS instruction. */ | |
444 | COSTS_N_INSNS (70), /* cost of FSQRT instruction. */ | |
6065f444 | 445 | |
c53c148c | 446 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
447 | COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */ |
448 | COSTS_N_INSNS (3), /* cost of MULSS instruction. */ | |
449 | COSTS_N_INSNS (3), /* cost of MULSD instruction. */ | |
c53c148c JH |
450 | COSTS_N_INSNS (6), /* cost of FMA SS instruction. */ |
451 | COSTS_N_INSNS (6), /* cost of FMA SD instruction. */ | |
6065f444 JH |
452 | COSTS_N_INSNS (39), /* cost of DIVSS instruction. */ |
453 | COSTS_N_INSNS (39), /* cost of DIVSD instruction. */ | |
454 | COSTS_N_INSNS (70), /* cost of SQRTSS instruction. */ | |
455 | COSTS_N_INSNS (70), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
456 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
457 | pentium_memcpy, | |
458 | pentium_memset, | |
f6fd8f2b JH |
459 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
460 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
461 | "16:8:8", /* Loop alignment. */ |
462 | "16:8:8", /* Jump alignment. */ | |
463 | "0:0:8", /* Label alignment. */ | |
464 | "16", /* Func alignment. */ | |
64766e8d JH |
465 | }; |
466 | ||
467 | static const | |
468 | struct processor_costs lakemont_cost = { | |
72bb85f8 | 469 | { |
d321551c L |
470 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
471 | 6, /* cost for loading QImode using movzbl */ | |
472 | {2, 4, 2}, /* cost of loading integer registers | |
473 | in QImode, HImode and SImode. | |
474 | Relative to reg-reg move (2). */ | |
475 | {2, 4, 2}, /* cost of storing integer registers */ | |
476 | 2, /* cost of reg,reg fld/fst */ | |
477 | {2, 2, 6}, /* cost of loading fp registers | |
478 | in SFmode, DFmode and XFmode */ | |
479 | {4, 4, 6}, /* cost of storing fp registers | |
480 | in SFmode, DFmode and XFmode */ | |
481 | 8, /* cost of moving MMX register */ | |
482 | {8, 8}, /* cost of loading MMX registers | |
483 | in SImode and DImode */ | |
484 | {8, 8}, /* cost of storing MMX registers | |
485 | in SImode and DImode */ | |
486 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
487 | {4, 8, 16, 32, 64}, /* cost of loading SSE registers | |
488 | in 32,64,128,256 and 512-bit */ | |
489 | {4, 8, 16, 32, 64}, /* cost of storing SSE registers | |
490 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 491 | 3, 3, /* SSE->integer and integer->SSE moves */ |
492 | 3, 3, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
493 | {2, 4, 2}, /* cost of loading mask register |
494 | in QImode, HImode, SImode. */ | |
495 | {2, 4, 2}, /* cost if storing mask register | |
496 | in QImode, HImode, SImode. */ | |
497 | 2, /* cost of moving mask register. */ | |
d321551c | 498 | /* End of register allocator costs. */ |
72bb85f8 | 499 | }, |
d321551c | 500 | |
64766e8d JH |
501 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
502 | COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */ | |
503 | COSTS_N_INSNS (1), /* variable shift costs */ | |
504 | COSTS_N_INSNS (1), /* constant shift costs */ | |
505 | {COSTS_N_INSNS (11), /* cost of starting multiply for QI */ | |
506 | COSTS_N_INSNS (11), /* HI */ | |
507 | COSTS_N_INSNS (11), /* SI */ | |
508 | COSTS_N_INSNS (11), /* DI */ | |
509 | COSTS_N_INSNS (11)}, /* other */ | |
510 | 0, /* cost of multiply per each bit set */ | |
511 | {COSTS_N_INSNS (25), /* cost of a divide/mod for QI */ | |
512 | COSTS_N_INSNS (25), /* HI */ | |
513 | COSTS_N_INSNS (25), /* SI */ | |
514 | COSTS_N_INSNS (25), /* DI */ | |
515 | COSTS_N_INSNS (25)}, /* other */ | |
516 | COSTS_N_INSNS (3), /* cost of movsx */ | |
517 | COSTS_N_INSNS (2), /* cost of movzx */ | |
518 | 8, /* "large" insn */ | |
519 | 17, /* MOVE_RATIO */ | |
25e22b19 | 520 | 6, /* CLEAR_RATIO */ |
64766e8d JH |
521 | {2, 4, 2}, /* cost of loading integer registers |
522 | in QImode, HImode and SImode. | |
523 | Relative to reg-reg move (2). */ | |
524 | {2, 4, 2}, /* cost of storing integer registers */ | |
d321551c L |
525 | {4, 8, 16, 32, 64}, /* cost of loading SSE register |
526 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
527 | {4, 8, 16, 32, 64}, /* cost of storing SSE register | |
528 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf | 529 | {4, 8, 16, 32, 64}, /* cost of unaligned loads. */ |
df41dbaf | 530 | {4, 8, 16, 32, 64}, /* cost of unaligned stores. */ |
d321551c L |
531 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
532 | 3, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
533 | 4, 4, /* Gather load static, per_elt. */ |
534 | 4, 4, /* Gather store static, per_elt. */ | |
64766e8d JH |
535 | 8, /* size of l1 cache. */ |
536 | 8, /* size of l2 cache */ | |
537 | 0, /* size of prefetch block */ | |
538 | 0, /* number of parallel prefetches */ | |
539 | 2, /* Branch cost */ | |
540 | COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */ | |
541 | COSTS_N_INSNS (3), /* cost of FMUL instruction. */ | |
542 | COSTS_N_INSNS (39), /* cost of FDIV instruction. */ | |
543 | COSTS_N_INSNS (1), /* cost of FABS instruction. */ | |
544 | COSTS_N_INSNS (1), /* cost of FCHS instruction. */ | |
545 | COSTS_N_INSNS (70), /* cost of FSQRT instruction. */ | |
6065f444 | 546 | |
c53c148c | 547 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
548 | COSTS_N_INSNS (5), /* cost of ADDSS/SD SUBSS/SD insns. */ |
549 | COSTS_N_INSNS (5), /* cost of MULSS instruction. */ | |
550 | COSTS_N_INSNS (5), /* cost of MULSD instruction. */ | |
c53c148c JH |
551 | COSTS_N_INSNS (10), /* cost of FMA SS instruction. */ |
552 | COSTS_N_INSNS (10), /* cost of FMA SD instruction. */ | |
6065f444 JH |
553 | COSTS_N_INSNS (31), /* cost of DIVSS instruction. */ |
554 | COSTS_N_INSNS (60), /* cost of DIVSD instruction. */ | |
555 | COSTS_N_INSNS (31), /* cost of SQRTSS instruction. */ | |
556 | COSTS_N_INSNS (63), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
557 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
558 | pentium_memcpy, | |
559 | pentium_memset, | |
f6fd8f2b JH |
560 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
561 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
562 | "16:8:8", /* Loop alignment. */ |
563 | "16:8:8", /* Jump alignment. */ | |
564 | "0:0:8", /* Label alignment. */ | |
565 | "16", /* Func alignment. */ | |
64766e8d JH |
566 | }; |
567 | ||
568 | /* PentiumPro has optimized rep instructions for blocks aligned by 8 bytes | |
569 | (we ensure the alignment). For small blocks inline loop is still a | |
570 | noticeable win, for bigger blocks either rep movsl or rep movsb is | |
571 | way to go. Rep movsb has apparently more expensive startup time in CPU, | |
572 | but after 4K the difference is down in the noise. */ | |
573 | static stringop_algs pentiumpro_memcpy[2] = { | |
574 | {rep_prefix_4_byte, {{128, loop, false}, {1024, unrolled_loop, false}, | |
575 | {8192, rep_prefix_4_byte, false}, | |
576 | {-1, rep_prefix_1_byte, false}}}, | |
577 | DUMMY_STRINGOP_ALGS}; | |
578 | static stringop_algs pentiumpro_memset[2] = { | |
579 | {rep_prefix_4_byte, {{1024, unrolled_loop, false}, | |
580 | {8192, rep_prefix_4_byte, false}, | |
581 | {-1, libcall, false}}}, | |
582 | DUMMY_STRINGOP_ALGS}; | |
583 | static const | |
584 | struct processor_costs pentiumpro_cost = { | |
72bb85f8 | 585 | { |
d321551c L |
586 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
587 | 2, /* cost for loading QImode using movzbl */ | |
588 | {4, 4, 4}, /* cost of loading integer registers | |
589 | in QImode, HImode and SImode. | |
590 | Relative to reg-reg move (2). */ | |
591 | {2, 2, 2}, /* cost of storing integer registers */ | |
592 | 2, /* cost of reg,reg fld/fst */ | |
593 | {2, 2, 6}, /* cost of loading fp registers | |
594 | in SFmode, DFmode and XFmode */ | |
595 | {4, 4, 6}, /* cost of storing fp registers | |
596 | in SFmode, DFmode and XFmode */ | |
597 | 2, /* cost of moving MMX register */ | |
598 | {2, 2}, /* cost of loading MMX registers | |
599 | in SImode and DImode */ | |
600 | {2, 2}, /* cost of storing MMX registers | |
601 | in SImode and DImode */ | |
602 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
603 | {4, 8, 16, 32, 64}, /* cost of loading SSE registers | |
604 | in 32,64,128,256 and 512-bit */ | |
605 | {4, 8, 16, 32, 64}, /* cost of storing SSE registers | |
606 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 607 | 3, 3, /* SSE->integer and integer->SSE moves */ |
608 | 3, 3, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
609 | {4, 4, 4}, /* cost of loading mask register |
610 | in QImode, HImode, SImode. */ | |
611 | {2, 2, 2}, /* cost if storing mask register | |
612 | in QImode, HImode, SImode. */ | |
613 | 2, /* cost of moving mask register. */ | |
d321551c | 614 | /* End of register allocator costs. */ |
72bb85f8 | 615 | }, |
d321551c | 616 | |
64766e8d JH |
617 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
618 | COSTS_N_INSNS (1), /* cost of a lea instruction */ | |
619 | COSTS_N_INSNS (1), /* variable shift costs */ | |
620 | COSTS_N_INSNS (1), /* constant shift costs */ | |
621 | {COSTS_N_INSNS (4), /* cost of starting multiply for QI */ | |
622 | COSTS_N_INSNS (4), /* HI */ | |
623 | COSTS_N_INSNS (4), /* SI */ | |
624 | COSTS_N_INSNS (4), /* DI */ | |
625 | COSTS_N_INSNS (4)}, /* other */ | |
626 | 0, /* cost of multiply per each bit set */ | |
627 | {COSTS_N_INSNS (17), /* cost of a divide/mod for QI */ | |
628 | COSTS_N_INSNS (17), /* HI */ | |
629 | COSTS_N_INSNS (17), /* SI */ | |
630 | COSTS_N_INSNS (17), /* DI */ | |
631 | COSTS_N_INSNS (17)}, /* other */ | |
632 | COSTS_N_INSNS (1), /* cost of movsx */ | |
633 | COSTS_N_INSNS (1), /* cost of movzx */ | |
634 | 8, /* "large" insn */ | |
635 | 6, /* MOVE_RATIO */ | |
25e22b19 | 636 | 6, /* CLEAR_RATIO */ |
64766e8d JH |
637 | {4, 4, 4}, /* cost of loading integer registers |
638 | in QImode, HImode and SImode. | |
639 | Relative to reg-reg move (2). */ | |
640 | {2, 2, 2}, /* cost of storing integer registers */ | |
d321551c L |
641 | {4, 8, 16, 32, 64}, /* cost of loading SSE register |
642 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
643 | {4, 8, 16, 32, 64}, /* cost of storing SSE register | |
644 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf | 645 | {4, 8, 16, 32, 64}, /* cost of unaligned loads. */ |
df41dbaf | 646 | {4, 8, 16, 32, 64}, /* cost of unaligned stores. */ |
d321551c L |
647 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
648 | 3, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
649 | 4, 4, /* Gather load static, per_elt. */ |
650 | 4, 4, /* Gather store static, per_elt. */ | |
64766e8d JH |
651 | 8, /* size of l1 cache. */ |
652 | 256, /* size of l2 cache */ | |
653 | 32, /* size of prefetch block */ | |
654 | 6, /* number of parallel prefetches */ | |
655 | 2, /* Branch cost */ | |
656 | COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */ | |
657 | COSTS_N_INSNS (5), /* cost of FMUL instruction. */ | |
658 | COSTS_N_INSNS (56), /* cost of FDIV instruction. */ | |
659 | COSTS_N_INSNS (2), /* cost of FABS instruction. */ | |
660 | COSTS_N_INSNS (2), /* cost of FCHS instruction. */ | |
661 | COSTS_N_INSNS (56), /* cost of FSQRT instruction. */ | |
6065f444 | 662 | |
c53c148c | 663 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
664 | COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */ |
665 | COSTS_N_INSNS (4), /* cost of MULSS instruction. */ | |
666 | COSTS_N_INSNS (4), /* cost of MULSD instruction. */ | |
c53c148c JH |
667 | COSTS_N_INSNS (7), /* cost of FMA SS instruction. */ |
668 | COSTS_N_INSNS (7), /* cost of FMA SD instruction. */ | |
6065f444 JH |
669 | COSTS_N_INSNS (18), /* cost of DIVSS instruction. */ |
670 | COSTS_N_INSNS (18), /* cost of DIVSD instruction. */ | |
671 | COSTS_N_INSNS (31), /* cost of SQRTSS instruction. */ | |
672 | COSTS_N_INSNS (31), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
673 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
674 | pentiumpro_memcpy, | |
675 | pentiumpro_memset, | |
f6fd8f2b JH |
676 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
677 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
678 | "16", /* Loop alignment. */ |
679 | "16:11:8", /* Jump alignment. */ | |
680 | "0:0:8", /* Label alignment. */ | |
681 | "16", /* Func alignment. */ | |
64766e8d JH |
682 | }; |
683 | ||
684 | static stringop_algs geode_memcpy[2] = { | |
685 | {libcall, {{256, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
686 | DUMMY_STRINGOP_ALGS}; | |
687 | static stringop_algs geode_memset[2] = { | |
688 | {libcall, {{256, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
689 | DUMMY_STRINGOP_ALGS}; | |
690 | static const | |
691 | struct processor_costs geode_cost = { | |
72bb85f8 | 692 | { |
d321551c L |
693 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
694 | 2, /* cost for loading QImode using movzbl */ | |
695 | {2, 2, 2}, /* cost of loading integer registers | |
696 | in QImode, HImode and SImode. | |
697 | Relative to reg-reg move (2). */ | |
698 | {2, 2, 2}, /* cost of storing integer registers */ | |
699 | 2, /* cost of reg,reg fld/fst */ | |
700 | {2, 2, 2}, /* cost of loading fp registers | |
701 | in SFmode, DFmode and XFmode */ | |
702 | {4, 6, 6}, /* cost of storing fp registers | |
703 | in SFmode, DFmode and XFmode */ | |
704 | 2, /* cost of moving MMX register */ | |
705 | {2, 2}, /* cost of loading MMX registers | |
706 | in SImode and DImode */ | |
707 | {2, 2}, /* cost of storing MMX registers | |
708 | in SImode and DImode */ | |
709 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
710 | {2, 2, 8, 16, 32}, /* cost of loading SSE registers | |
711 | in 32,64,128,256 and 512-bit */ | |
712 | {2, 2, 8, 16, 32}, /* cost of storing SSE registers | |
713 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 714 | 6, 6, /* SSE->integer and integer->SSE moves */ |
715 | 6, 6, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
716 | {2, 2, 2}, /* cost of loading mask register |
717 | in QImode, HImode, SImode. */ | |
718 | {2, 2, 2}, /* cost if storing mask register | |
719 | in QImode, HImode, SImode. */ | |
720 | 2, /* cost of moving mask register. */ | |
d321551c | 721 | /* End of register allocator costs. */ |
72bb85f8 | 722 | }, |
d321551c | 723 | |
64766e8d JH |
724 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
725 | COSTS_N_INSNS (1), /* cost of a lea instruction */ | |
726 | COSTS_N_INSNS (2), /* variable shift costs */ | |
727 | COSTS_N_INSNS (1), /* constant shift costs */ | |
728 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ | |
729 | COSTS_N_INSNS (4), /* HI */ | |
730 | COSTS_N_INSNS (7), /* SI */ | |
731 | COSTS_N_INSNS (7), /* DI */ | |
732 | COSTS_N_INSNS (7)}, /* other */ | |
733 | 0, /* cost of multiply per each bit set */ | |
734 | {COSTS_N_INSNS (15), /* cost of a divide/mod for QI */ | |
735 | COSTS_N_INSNS (23), /* HI */ | |
736 | COSTS_N_INSNS (39), /* SI */ | |
737 | COSTS_N_INSNS (39), /* DI */ | |
738 | COSTS_N_INSNS (39)}, /* other */ | |
739 | COSTS_N_INSNS (1), /* cost of movsx */ | |
740 | COSTS_N_INSNS (1), /* cost of movzx */ | |
741 | 8, /* "large" insn */ | |
742 | 4, /* MOVE_RATIO */ | |
25e22b19 | 743 | 4, /* CLEAR_RATIO */ |
df41dbaf | 744 | {2, 2, 2}, /* cost of loading integer registers |
64766e8d JH |
745 | in QImode, HImode and SImode. |
746 | Relative to reg-reg move (2). */ | |
df41dbaf | 747 | {2, 2, 2}, /* cost of storing integer registers */ |
d321551c L |
748 | {2, 2, 8, 16, 32}, /* cost of loading SSE register |
749 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
750 | {2, 2, 8, 16, 32}, /* cost of storing SSE register | |
751 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf | 752 | {2, 2, 8, 16, 32}, /* cost of unaligned loads. */ |
df41dbaf | 753 | {2, 2, 8, 16, 32}, /* cost of unaligned stores. */ |
d321551c L |
754 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
755 | 6, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
756 | 2, 2, /* Gather load static, per_elt. */ |
757 | 2, 2, /* Gather store static, per_elt. */ | |
64766e8d JH |
758 | 64, /* size of l1 cache. */ |
759 | 128, /* size of l2 cache. */ | |
760 | 32, /* size of prefetch block */ | |
761 | 1, /* number of parallel prefetches */ | |
762 | 1, /* Branch cost */ | |
763 | COSTS_N_INSNS (6), /* cost of FADD and FSUB insns. */ | |
764 | COSTS_N_INSNS (11), /* cost of FMUL instruction. */ | |
765 | COSTS_N_INSNS (47), /* cost of FDIV instruction. */ | |
766 | COSTS_N_INSNS (1), /* cost of FABS instruction. */ | |
767 | COSTS_N_INSNS (1), /* cost of FCHS instruction. */ | |
768 | COSTS_N_INSNS (54), /* cost of FSQRT instruction. */ | |
6065f444 | 769 | |
c53c148c | 770 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
771 | COSTS_N_INSNS (6), /* cost of ADDSS/SD SUBSS/SD insns. */ |
772 | COSTS_N_INSNS (11), /* cost of MULSS instruction. */ | |
773 | COSTS_N_INSNS (11), /* cost of MULSD instruction. */ | |
c53c148c JH |
774 | COSTS_N_INSNS (17), /* cost of FMA SS instruction. */ |
775 | COSTS_N_INSNS (17), /* cost of FMA SD instruction. */ | |
6065f444 JH |
776 | COSTS_N_INSNS (47), /* cost of DIVSS instruction. */ |
777 | COSTS_N_INSNS (47), /* cost of DIVSD instruction. */ | |
778 | COSTS_N_INSNS (54), /* cost of SQRTSS instruction. */ | |
779 | COSTS_N_INSNS (54), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
780 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
781 | geode_memcpy, | |
782 | geode_memset, | |
f6fd8f2b JH |
783 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
784 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
785 | NULL, /* Loop alignment. */ |
786 | NULL, /* Jump alignment. */ | |
787 | NULL, /* Label alignment. */ | |
788 | NULL, /* Func alignment. */ | |
64766e8d JH |
789 | }; |
790 | ||
791 | static stringop_algs k6_memcpy[2] = { | |
792 | {libcall, {{256, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
793 | DUMMY_STRINGOP_ALGS}; | |
794 | static stringop_algs k6_memset[2] = { | |
795 | {libcall, {{256, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
796 | DUMMY_STRINGOP_ALGS}; | |
797 | static const | |
798 | struct processor_costs k6_cost = { | |
72bb85f8 | 799 | { |
d321551c L |
800 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
801 | 3, /* cost for loading QImode using movzbl */ | |
802 | {4, 5, 4}, /* cost of loading integer registers | |
803 | in QImode, HImode and SImode. | |
804 | Relative to reg-reg move (2). */ | |
805 | {2, 3, 2}, /* cost of storing integer registers */ | |
806 | 4, /* cost of reg,reg fld/fst */ | |
807 | {6, 6, 6}, /* cost of loading fp registers | |
808 | in SFmode, DFmode and XFmode */ | |
809 | {4, 4, 4}, /* cost of storing fp registers | |
810 | in SFmode, DFmode and XFmode */ | |
811 | 2, /* cost of moving MMX register */ | |
812 | {2, 2}, /* cost of loading MMX registers | |
813 | in SImode and DImode */ | |
814 | {2, 2}, /* cost of storing MMX registers | |
815 | in SImode and DImode */ | |
816 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
817 | {2, 2, 8, 16, 32}, /* cost of loading SSE registers | |
818 | in 32,64,128,256 and 512-bit */ | |
819 | {2, 2, 8, 16, 32}, /* cost of storing SSE registers | |
820 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 821 | 6, 6, /* SSE->integer and integer->SSE moves */ |
822 | 6, 6, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
823 | {4, 5, 4}, /* cost of loading mask register |
824 | in QImode, HImode, SImode. */ | |
825 | {2, 3, 2}, /* cost if storing mask register | |
826 | in QImode, HImode, SImode. */ | |
827 | 2, /* cost of moving mask register. */ | |
d321551c | 828 | /* End of register allocator costs. */ |
72bb85f8 | 829 | }, |
d321551c | 830 | |
64766e8d JH |
831 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
832 | COSTS_N_INSNS (2), /* cost of a lea instruction */ | |
833 | COSTS_N_INSNS (1), /* variable shift costs */ | |
834 | COSTS_N_INSNS (1), /* constant shift costs */ | |
835 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ | |
836 | COSTS_N_INSNS (3), /* HI */ | |
837 | COSTS_N_INSNS (3), /* SI */ | |
838 | COSTS_N_INSNS (3), /* DI */ | |
839 | COSTS_N_INSNS (3)}, /* other */ | |
840 | 0, /* cost of multiply per each bit set */ | |
841 | {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */ | |
842 | COSTS_N_INSNS (18), /* HI */ | |
843 | COSTS_N_INSNS (18), /* SI */ | |
844 | COSTS_N_INSNS (18), /* DI */ | |
845 | COSTS_N_INSNS (18)}, /* other */ | |
846 | COSTS_N_INSNS (2), /* cost of movsx */ | |
847 | COSTS_N_INSNS (2), /* cost of movzx */ | |
848 | 8, /* "large" insn */ | |
849 | 4, /* MOVE_RATIO */ | |
25e22b19 | 850 | 4, /* CLEAR_RATIO */ |
64766e8d JH |
851 | {4, 5, 4}, /* cost of loading integer registers |
852 | in QImode, HImode and SImode. | |
853 | Relative to reg-reg move (2). */ | |
854 | {2, 3, 2}, /* cost of storing integer registers */ | |
d321551c L |
855 | {2, 2, 8, 16, 32}, /* cost of loading SSE register |
856 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
857 | {2, 2, 8, 16, 32}, /* cost of storing SSE register | |
858 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf | 859 | {2, 2, 8, 16, 32}, /* cost of unaligned loads. */ |
df41dbaf | 860 | {2, 2, 8, 16, 32}, /* cost of unaligned stores. */ |
d321551c L |
861 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
862 | 6, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
863 | 2, 2, /* Gather load static, per_elt. */ |
864 | 2, 2, /* Gather store static, per_elt. */ | |
64766e8d JH |
865 | 32, /* size of l1 cache. */ |
866 | 32, /* size of l2 cache. Some models | |
867 | have integrated l2 cache, but | |
868 | optimizing for k6 is not important | |
869 | enough to worry about that. */ | |
870 | 32, /* size of prefetch block */ | |
871 | 1, /* number of parallel prefetches */ | |
872 | 1, /* Branch cost */ | |
873 | COSTS_N_INSNS (2), /* cost of FADD and FSUB insns. */ | |
874 | COSTS_N_INSNS (2), /* cost of FMUL instruction. */ | |
875 | COSTS_N_INSNS (56), /* cost of FDIV instruction. */ | |
876 | COSTS_N_INSNS (2), /* cost of FABS instruction. */ | |
877 | COSTS_N_INSNS (2), /* cost of FCHS instruction. */ | |
878 | COSTS_N_INSNS (56), /* cost of FSQRT instruction. */ | |
6065f444 | 879 | |
c53c148c | 880 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
881 | COSTS_N_INSNS (2), /* cost of ADDSS/SD SUBSS/SD insns. */ |
882 | COSTS_N_INSNS (2), /* cost of MULSS instruction. */ | |
883 | COSTS_N_INSNS (2), /* cost of MULSD instruction. */ | |
c53c148c JH |
884 | COSTS_N_INSNS (4), /* cost of FMA SS instruction. */ |
885 | COSTS_N_INSNS (4), /* cost of FMA SD instruction. */ | |
6065f444 JH |
886 | COSTS_N_INSNS (56), /* cost of DIVSS instruction. */ |
887 | COSTS_N_INSNS (56), /* cost of DIVSD instruction. */ | |
888 | COSTS_N_INSNS (56), /* cost of SQRTSS instruction. */ | |
889 | COSTS_N_INSNS (56), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
890 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
891 | k6_memcpy, | |
892 | k6_memset, | |
f6fd8f2b JH |
893 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
894 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
895 | "32:8:8", /* Loop alignment. */ |
896 | "32:8:8", /* Jump alignment. */ | |
897 | "0:0:8", /* Label alignment. */ | |
898 | "32", /* Func alignment. */ | |
64766e8d JH |
899 | }; |
900 | ||
901 | /* For some reason, Athlon deals better with REP prefix (relative to loops) | |
902 | compared to K8. Alignment becomes important after 8 bytes for memcpy and | |
903 | 128 bytes for memset. */ | |
904 | static stringop_algs athlon_memcpy[2] = { | |
905 | {libcall, {{2048, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
906 | DUMMY_STRINGOP_ALGS}; | |
907 | static stringop_algs athlon_memset[2] = { | |
908 | {libcall, {{2048, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
909 | DUMMY_STRINGOP_ALGS}; | |
910 | static const | |
911 | struct processor_costs athlon_cost = { | |
72bb85f8 | 912 | { |
d321551c L |
913 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
914 | 4, /* cost for loading QImode using movzbl */ | |
915 | {3, 4, 3}, /* cost of loading integer registers | |
916 | in QImode, HImode and SImode. | |
917 | Relative to reg-reg move (2). */ | |
918 | {3, 4, 3}, /* cost of storing integer registers */ | |
919 | 4, /* cost of reg,reg fld/fst */ | |
920 | {4, 4, 12}, /* cost of loading fp registers | |
921 | in SFmode, DFmode and XFmode */ | |
922 | {6, 6, 8}, /* cost of storing fp registers | |
923 | in SFmode, DFmode and XFmode */ | |
924 | 2, /* cost of moving MMX register */ | |
925 | {4, 4}, /* cost of loading MMX registers | |
926 | in SImode and DImode */ | |
927 | {4, 4}, /* cost of storing MMX registers | |
928 | in SImode and DImode */ | |
929 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
930 | {4, 4, 12, 12, 24}, /* cost of loading SSE registers | |
931 | in 32,64,128,256 and 512-bit */ | |
932 | {4, 4, 10, 10, 20}, /* cost of storing SSE registers | |
933 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 934 | 5, 5, /* SSE->integer and integer->SSE moves */ |
935 | 5, 5, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
936 | {3, 4, 3}, /* cost of loading mask register |
937 | in QImode, HImode, SImode. */ | |
938 | {3, 4, 3}, /* cost if storing mask register | |
939 | in QImode, HImode, SImode. */ | |
940 | 2, /* cost of moving mask register. */ | |
d321551c | 941 | /* End of register allocator costs. */ |
72bb85f8 | 942 | }, |
d321551c | 943 | |
64766e8d JH |
944 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
945 | COSTS_N_INSNS (2), /* cost of a lea instruction */ | |
946 | COSTS_N_INSNS (1), /* variable shift costs */ | |
947 | COSTS_N_INSNS (1), /* constant shift costs */ | |
948 | {COSTS_N_INSNS (5), /* cost of starting multiply for QI */ | |
949 | COSTS_N_INSNS (5), /* HI */ | |
950 | COSTS_N_INSNS (5), /* SI */ | |
951 | COSTS_N_INSNS (5), /* DI */ | |
952 | COSTS_N_INSNS (5)}, /* other */ | |
953 | 0, /* cost of multiply per each bit set */ | |
954 | {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */ | |
955 | COSTS_N_INSNS (26), /* HI */ | |
956 | COSTS_N_INSNS (42), /* SI */ | |
957 | COSTS_N_INSNS (74), /* DI */ | |
958 | COSTS_N_INSNS (74)}, /* other */ | |
959 | COSTS_N_INSNS (1), /* cost of movsx */ | |
960 | COSTS_N_INSNS (1), /* cost of movzx */ | |
961 | 8, /* "large" insn */ | |
962 | 9, /* MOVE_RATIO */ | |
25e22b19 | 963 | 6, /* CLEAR_RATIO */ |
64766e8d JH |
964 | {3, 4, 3}, /* cost of loading integer registers |
965 | in QImode, HImode and SImode. | |
966 | Relative to reg-reg move (2). */ | |
967 | {3, 4, 3}, /* cost of storing integer registers */ | |
d321551c L |
968 | {4, 4, 12, 12, 24}, /* cost of loading SSE register |
969 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
970 | {4, 4, 10, 10, 20}, /* cost of storing SSE register | |
971 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
b7167993 | 972 | {4, 4, 12, 12, 24}, /* cost of unaligned loads. */ |
b7167993 | 973 | {4, 4, 10, 10, 20}, /* cost of unaligned stores. */ |
d321551c L |
974 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
975 | 5, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
976 | 4, 4, /* Gather load static, per_elt. */ |
977 | 4, 4, /* Gather store static, per_elt. */ | |
64766e8d JH |
978 | 64, /* size of l1 cache. */ |
979 | 256, /* size of l2 cache. */ | |
980 | 64, /* size of prefetch block */ | |
981 | 6, /* number of parallel prefetches */ | |
982 | 5, /* Branch cost */ | |
983 | COSTS_N_INSNS (4), /* cost of FADD and FSUB insns. */ | |
984 | COSTS_N_INSNS (4), /* cost of FMUL instruction. */ | |
985 | COSTS_N_INSNS (24), /* cost of FDIV instruction. */ | |
986 | COSTS_N_INSNS (2), /* cost of FABS instruction. */ | |
987 | COSTS_N_INSNS (2), /* cost of FCHS instruction. */ | |
988 | COSTS_N_INSNS (35), /* cost of FSQRT instruction. */ | |
6065f444 | 989 | |
c53c148c | 990 | COSTS_N_INSNS (2), /* cost of cheap SSE instruction. */ |
6065f444 JH |
991 | COSTS_N_INSNS (4), /* cost of ADDSS/SD SUBSS/SD insns. */ |
992 | COSTS_N_INSNS (4), /* cost of MULSS instruction. */ | |
993 | COSTS_N_INSNS (4), /* cost of MULSD instruction. */ | |
c53c148c JH |
994 | COSTS_N_INSNS (8), /* cost of FMA SS instruction. */ |
995 | COSTS_N_INSNS (8), /* cost of FMA SD instruction. */ | |
6065f444 JH |
996 | /* 11-16 */ |
997 | COSTS_N_INSNS (16), /* cost of DIVSS instruction. */ | |
998 | COSTS_N_INSNS (24), /* cost of DIVSD instruction. */ | |
999 | COSTS_N_INSNS (19), /* cost of SQRTSS instruction. */ | |
1000 | COSTS_N_INSNS (19), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
1001 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
1002 | athlon_memcpy, | |
1003 | athlon_memset, | |
f6fd8f2b JH |
1004 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
1005 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
1006 | "16:8:8", /* Loop alignment. */ |
1007 | "16:8:8", /* Jump alignment. */ | |
1008 | "0:0:8", /* Label alignment. */ | |
1009 | "16", /* Func alignment. */ | |
64766e8d JH |
1010 | }; |
1011 | ||
1012 | /* K8 has optimized REP instruction for medium sized blocks, but for very | |
1013 | small blocks it is better to use loop. For large blocks, libcall can | |
1014 | do nontemporary accesses and beat inline considerably. */ | |
1015 | static stringop_algs k8_memcpy[2] = { | |
1016 | {libcall, {{6, loop, false}, {14, unrolled_loop, false}, | |
1017 | {-1, rep_prefix_4_byte, false}}}, | |
1018 | {libcall, {{16, loop, false}, {8192, rep_prefix_8_byte, false}, | |
1019 | {-1, libcall, false}}}}; | |
1020 | static stringop_algs k8_memset[2] = { | |
1021 | {libcall, {{8, loop, false}, {24, unrolled_loop, false}, | |
1022 | {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
1023 | {libcall, {{48, unrolled_loop, false}, | |
1024 | {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}}; | |
1025 | static const | |
1026 | struct processor_costs k8_cost = { | |
72bb85f8 | 1027 | { |
d321551c L |
1028 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
1029 | 4, /* cost for loading QImode using movzbl */ | |
1030 | {3, 4, 3}, /* cost of loading integer registers | |
1031 | in QImode, HImode and SImode. | |
1032 | Relative to reg-reg move (2). */ | |
1033 | {3, 4, 3}, /* cost of storing integer registers */ | |
1034 | 4, /* cost of reg,reg fld/fst */ | |
1035 | {4, 4, 12}, /* cost of loading fp registers | |
1036 | in SFmode, DFmode and XFmode */ | |
1037 | {6, 6, 8}, /* cost of storing fp registers | |
1038 | in SFmode, DFmode and XFmode */ | |
1039 | 2, /* cost of moving MMX register */ | |
1040 | {3, 3}, /* cost of loading MMX registers | |
1041 | in SImode and DImode */ | |
1042 | {4, 4}, /* cost of storing MMX registers | |
1043 | in SImode and DImode */ | |
1044 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
1045 | {4, 3, 12, 12, 24}, /* cost of loading SSE registers | |
1046 | in 32,64,128,256 and 512-bit */ | |
1047 | {4, 4, 10, 10, 20}, /* cost of storing SSE registers | |
1048 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 1049 | 5, 5, /* SSE->integer and integer->SSE moves */ |
1050 | 5, 5, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
1051 | {3, 4, 3}, /* cost of loading mask register |
1052 | in QImode, HImode, SImode. */ | |
1053 | {3, 4, 3}, /* cost if storing mask register | |
1054 | in QImode, HImode, SImode. */ | |
1055 | 2, /* cost of moving mask register. */ | |
d321551c | 1056 | /* End of register allocator costs. */ |
72bb85f8 | 1057 | }, |
d321551c | 1058 | |
64766e8d JH |
1059 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
1060 | COSTS_N_INSNS (2), /* cost of a lea instruction */ | |
1061 | COSTS_N_INSNS (1), /* variable shift costs */ | |
1062 | COSTS_N_INSNS (1), /* constant shift costs */ | |
1063 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ | |
1064 | COSTS_N_INSNS (4), /* HI */ | |
1065 | COSTS_N_INSNS (3), /* SI */ | |
1066 | COSTS_N_INSNS (4), /* DI */ | |
1067 | COSTS_N_INSNS (5)}, /* other */ | |
1068 | 0, /* cost of multiply per each bit set */ | |
1069 | {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */ | |
1070 | COSTS_N_INSNS (26), /* HI */ | |
1071 | COSTS_N_INSNS (42), /* SI */ | |
1072 | COSTS_N_INSNS (74), /* DI */ | |
1073 | COSTS_N_INSNS (74)}, /* other */ | |
1074 | COSTS_N_INSNS (1), /* cost of movsx */ | |
1075 | COSTS_N_INSNS (1), /* cost of movzx */ | |
1076 | 8, /* "large" insn */ | |
1077 | 9, /* MOVE_RATIO */ | |
25e22b19 | 1078 | 6, /* CLEAR_RATIO */ |
64766e8d JH |
1079 | {3, 4, 3}, /* cost of loading integer registers |
1080 | in QImode, HImode and SImode. | |
1081 | Relative to reg-reg move (2). */ | |
1082 | {3, 4, 3}, /* cost of storing integer registers */ | |
d321551c L |
1083 | {4, 3, 12, 12, 24}, /* cost of loading SSE register |
1084 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
1085 | {4, 4, 10, 10, 20}, /* cost of storing SSE register | |
1086 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
b7167993 | 1087 | {4, 3, 12, 12, 24}, /* cost of unaligned loads. */ |
b7167993 | 1088 | {4, 4, 10, 10, 20}, /* cost of unaligned stores. */ |
d321551c L |
1089 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
1090 | 5, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
1091 | 4, 4, /* Gather load static, per_elt. */ |
1092 | 4, 4, /* Gather store static, per_elt. */ | |
64766e8d JH |
1093 | 64, /* size of l1 cache. */ |
1094 | 512, /* size of l2 cache. */ | |
1095 | 64, /* size of prefetch block */ | |
1096 | /* New AMD processors never drop prefetches; if they cannot be performed | |
1097 | immediately, they are queued. We set number of simultaneous prefetches | |
1098 | to a large constant to reflect this (it probably is not a good idea not | |
1099 | to limit number of prefetches at all, as their execution also takes some | |
1100 | time). */ | |
1101 | 100, /* number of parallel prefetches */ | |
1102 | 3, /* Branch cost */ | |
1103 | COSTS_N_INSNS (4), /* cost of FADD and FSUB insns. */ | |
1104 | COSTS_N_INSNS (4), /* cost of FMUL instruction. */ | |
1105 | COSTS_N_INSNS (19), /* cost of FDIV instruction. */ | |
1106 | COSTS_N_INSNS (2), /* cost of FABS instruction. */ | |
1107 | COSTS_N_INSNS (2), /* cost of FCHS instruction. */ | |
1108 | COSTS_N_INSNS (35), /* cost of FSQRT instruction. */ | |
6065f444 | 1109 | |
c53c148c | 1110 | COSTS_N_INSNS (2), /* cost of cheap SSE instruction. */ |
6065f444 JH |
1111 | COSTS_N_INSNS (4), /* cost of ADDSS/SD SUBSS/SD insns. */ |
1112 | COSTS_N_INSNS (4), /* cost of MULSS instruction. */ | |
1113 | COSTS_N_INSNS (4), /* cost of MULSD instruction. */ | |
c53c148c JH |
1114 | COSTS_N_INSNS (8), /* cost of FMA SS instruction. */ |
1115 | COSTS_N_INSNS (8), /* cost of FMA SD instruction. */ | |
6065f444 JH |
1116 | /* 11-16 */ |
1117 | COSTS_N_INSNS (16), /* cost of DIVSS instruction. */ | |
1118 | COSTS_N_INSNS (20), /* cost of DIVSD instruction. */ | |
1119 | COSTS_N_INSNS (19), /* cost of SQRTSS instruction. */ | |
1120 | COSTS_N_INSNS (27), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
1121 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
1122 | k8_memcpy, | |
1123 | k8_memset, | |
f6fd8f2b JH |
1124 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
1125 | COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
1126 | "16:8:8", /* Loop alignment. */ |
1127 | "16:8:8", /* Jump alignment. */ | |
1128 | "0:0:8", /* Label alignment. */ | |
1129 | "16", /* Func alignment. */ | |
64766e8d JH |
1130 | }; |
1131 | ||
1132 | /* AMDFAM10 has optimized REP instruction for medium sized blocks, but for | |
1133 | very small blocks it is better to use loop. For large blocks, libcall can | |
1134 | do nontemporary accesses and beat inline considerably. */ | |
1135 | static stringop_algs amdfam10_memcpy[2] = { | |
1136 | {libcall, {{6, loop, false}, {14, unrolled_loop, false}, | |
1137 | {-1, rep_prefix_4_byte, false}}}, | |
1138 | {libcall, {{16, loop, false}, {8192, rep_prefix_8_byte, false}, | |
1139 | {-1, libcall, false}}}}; | |
1140 | static stringop_algs amdfam10_memset[2] = { | |
1141 | {libcall, {{8, loop, false}, {24, unrolled_loop, false}, | |
1142 | {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
1143 | {libcall, {{48, unrolled_loop, false}, {8192, rep_prefix_8_byte, false}, | |
1144 | {-1, libcall, false}}}}; | |
1145 | struct processor_costs amdfam10_cost = { | |
72bb85f8 | 1146 | { |
d321551c | 1147 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
64766e8d JH |
1148 | 4, /* cost for loading QImode using movzbl */ |
1149 | {3, 4, 3}, /* cost of loading integer registers | |
1150 | in QImode, HImode and SImode. | |
1151 | Relative to reg-reg move (2). */ | |
1152 | {3, 4, 3}, /* cost of storing integer registers */ | |
1153 | 4, /* cost of reg,reg fld/fst */ | |
1154 | {4, 4, 12}, /* cost of loading fp registers | |
1155 | in SFmode, DFmode and XFmode */ | |
1156 | {6, 6, 8}, /* cost of storing fp registers | |
1157 | in SFmode, DFmode and XFmode */ | |
1158 | 2, /* cost of moving MMX register */ | |
1159 | {3, 3}, /* cost of loading MMX registers | |
1160 | in SImode and DImode */ | |
1161 | {4, 4}, /* cost of storing MMX registers | |
1162 | in SImode and DImode */ | |
df41dbaf JH |
1163 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
1164 | {4, 4, 3, 6, 12}, /* cost of loading SSE registers | |
1165 | in 32,64,128,256 and 512-bit */ | |
df41dbaf JH |
1166 | {4, 4, 5, 10, 20}, /* cost of storing SSE registers |
1167 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 1168 | 3, 3, /* SSE->integer and integer->SSE moves */ |
1169 | 3, 3, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
1170 | {3, 4, 3}, /* cost of loading mask register |
1171 | in QImode, HImode, SImode. */ | |
1172 | {3, 4, 3}, /* cost if storing mask register | |
1173 | in QImode, HImode, SImode. */ | |
1174 | 2, /* cost of moving mask register. */ | |
d321551c | 1175 | |
64766e8d JH |
1176 | /* On K8: |
1177 | MOVD reg64, xmmreg Double FSTORE 4 | |
1178 | MOVD reg32, xmmreg Double FSTORE 4 | |
1179 | On AMDFAM10: | |
1180 | MOVD reg64, xmmreg Double FADD 3 | |
1181 | 1/1 1/1 | |
1182 | MOVD reg32, xmmreg Double FADD 3 | |
1183 | 1/1 1/1 */ | |
d321551c | 1184 | /* End of register allocator costs. */ |
72bb85f8 | 1185 | }, |
d321551c L |
1186 | |
1187 | COSTS_N_INSNS (1), /* cost of an add instruction */ | |
1188 | COSTS_N_INSNS (2), /* cost of a lea instruction */ | |
1189 | COSTS_N_INSNS (1), /* variable shift costs */ | |
1190 | COSTS_N_INSNS (1), /* constant shift costs */ | |
1191 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ | |
1192 | COSTS_N_INSNS (4), /* HI */ | |
1193 | COSTS_N_INSNS (3), /* SI */ | |
1194 | COSTS_N_INSNS (4), /* DI */ | |
1195 | COSTS_N_INSNS (5)}, /* other */ | |
1196 | 0, /* cost of multiply per each bit set */ | |
1197 | {COSTS_N_INSNS (19), /* cost of a divide/mod for QI */ | |
1198 | COSTS_N_INSNS (35), /* HI */ | |
1199 | COSTS_N_INSNS (51), /* SI */ | |
1200 | COSTS_N_INSNS (83), /* DI */ | |
1201 | COSTS_N_INSNS (83)}, /* other */ | |
1202 | COSTS_N_INSNS (1), /* cost of movsx */ | |
1203 | COSTS_N_INSNS (1), /* cost of movzx */ | |
1204 | 8, /* "large" insn */ | |
1205 | 9, /* MOVE_RATIO */ | |
25e22b19 | 1206 | 6, /* CLEAR_RATIO */ |
d321551c L |
1207 | {3, 4, 3}, /* cost of loading integer registers |
1208 | in QImode, HImode and SImode. | |
1209 | Relative to reg-reg move (2). */ | |
1210 | {3, 4, 3}, /* cost of storing integer registers */ | |
1211 | {4, 4, 3, 6, 12}, /* cost of loading SSE register | |
1212 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
1213 | {4, 4, 5, 10, 20}, /* cost of storing SSE register | |
1214 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
1215 | {4, 4, 3, 7, 12}, /* cost of unaligned loads. */ | |
1216 | {4, 4, 5, 10, 20}, /* cost of unaligned stores. */ | |
1217 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
1218 | 3, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
1219 | 4, 4, /* Gather load static, per_elt. */ |
1220 | 4, 4, /* Gather store static, per_elt. */ | |
64766e8d JH |
1221 | 64, /* size of l1 cache. */ |
1222 | 512, /* size of l2 cache. */ | |
1223 | 64, /* size of prefetch block */ | |
1224 | /* New AMD processors never drop prefetches; if they cannot be performed | |
1225 | immediately, they are queued. We set number of simultaneous prefetches | |
1226 | to a large constant to reflect this (it probably is not a good idea not | |
1227 | to limit number of prefetches at all, as their execution also takes some | |
1228 | time). */ | |
1229 | 100, /* number of parallel prefetches */ | |
1230 | 2, /* Branch cost */ | |
1231 | COSTS_N_INSNS (4), /* cost of FADD and FSUB insns. */ | |
1232 | COSTS_N_INSNS (4), /* cost of FMUL instruction. */ | |
1233 | COSTS_N_INSNS (19), /* cost of FDIV instruction. */ | |
1234 | COSTS_N_INSNS (2), /* cost of FABS instruction. */ | |
1235 | COSTS_N_INSNS (2), /* cost of FCHS instruction. */ | |
1236 | COSTS_N_INSNS (35), /* cost of FSQRT instruction. */ | |
6065f444 | 1237 | |
c53c148c | 1238 | COSTS_N_INSNS (2), /* cost of cheap SSE instruction. */ |
6065f444 JH |
1239 | COSTS_N_INSNS (4), /* cost of ADDSS/SD SUBSS/SD insns. */ |
1240 | COSTS_N_INSNS (4), /* cost of MULSS instruction. */ | |
1241 | COSTS_N_INSNS (4), /* cost of MULSD instruction. */ | |
c53c148c JH |
1242 | COSTS_N_INSNS (8), /* cost of FMA SS instruction. */ |
1243 | COSTS_N_INSNS (8), /* cost of FMA SD instruction. */ | |
6065f444 JH |
1244 | /* 11-16 */ |
1245 | COSTS_N_INSNS (16), /* cost of DIVSS instruction. */ | |
1246 | COSTS_N_INSNS (20), /* cost of DIVSD instruction. */ | |
1247 | COSTS_N_INSNS (19), /* cost of SQRTSS instruction. */ | |
1248 | COSTS_N_INSNS (27), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
1249 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
1250 | amdfam10_memcpy, | |
1251 | amdfam10_memset, | |
f6fd8f2b JH |
1252 | COSTS_N_INSNS (2), /* cond_taken_branch_cost. */ |
1253 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
1254 | "32:25:8", /* Loop alignment. */ |
1255 | "32:8:8", /* Jump alignment. */ | |
1256 | "0:0:8", /* Label alignment. */ | |
1257 | "32", /* Func alignment. */ | |
64766e8d JH |
1258 | }; |
1259 | ||
c727b835 | 1260 | /* BDVER has optimized REP instruction for medium sized blocks, but for |
64766e8d JH |
1261 | very small blocks it is better to use loop. For large blocks, libcall |
1262 | can do nontemporary accesses and beat inline considerably. */ | |
c727b835 | 1263 | static stringop_algs bdver_memcpy[2] = { |
64766e8d JH |
1264 | {libcall, {{6, loop, false}, {14, unrolled_loop, false}, |
1265 | {-1, rep_prefix_4_byte, false}}}, | |
1266 | {libcall, {{16, loop, false}, {8192, rep_prefix_8_byte, false}, | |
1267 | {-1, libcall, false}}}}; | |
c727b835 | 1268 | static stringop_algs bdver_memset[2] = { |
64766e8d JH |
1269 | {libcall, {{8, loop, false}, {24, unrolled_loop, false}, |
1270 | {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
1271 | {libcall, {{48, unrolled_loop, false}, {8192, rep_prefix_8_byte, false}, | |
1272 | {-1, libcall, false}}}}; | |
1273 | ||
c727b835 | 1274 | const struct processor_costs bdver_cost = { |
72bb85f8 | 1275 | { |
d321551c L |
1276 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
1277 | 8, /* cost for loading QImode using movzbl */ | |
1278 | {8, 8, 8}, /* cost of loading integer registers | |
1279 | in QImode, HImode and SImode. | |
1280 | Relative to reg-reg move (2). */ | |
1281 | {8, 8, 8}, /* cost of storing integer registers */ | |
1282 | 4, /* cost of reg,reg fld/fst */ | |
1283 | {12, 12, 28}, /* cost of loading fp registers | |
1284 | in SFmode, DFmode and XFmode */ | |
1285 | {10, 10, 18}, /* cost of storing fp registers | |
1286 | in SFmode, DFmode and XFmode */ | |
1287 | 4, /* cost of moving MMX register */ | |
1288 | {12, 12}, /* cost of loading MMX registers | |
1289 | in SImode and DImode */ | |
1290 | {10, 10}, /* cost of storing MMX registers | |
1291 | in SImode and DImode */ | |
1292 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
1293 | {12, 12, 10, 40, 60}, /* cost of loading SSE registers | |
1294 | in 32,64,128,256 and 512-bit */ | |
1295 | {10, 10, 10, 40, 60}, /* cost of storing SSE registers | |
1296 | in 32,64,128,256 and 512-bit */ | |
1297 | 16, 20, /* SSE->integer and integer->SSE moves */ | |
ecc3135a | 1298 | 16, 20, /* mask->integer and integer->mask moves */ |
00cb3494 L |
1299 | {8, 8, 8}, /* cost of loading mask register |
1300 | in QImode, HImode, SImode. */ | |
1301 | {8, 8, 8}, /* cost if storing mask register | |
1302 | in QImode, HImode, SImode. */ | |
1303 | 2, /* cost of moving mask register. */ | |
d321551c | 1304 | /* End of register allocator costs. */ |
72bb85f8 | 1305 | }, |
d321551c | 1306 | |
64766e8d JH |
1307 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
1308 | COSTS_N_INSNS (1), /* cost of a lea instruction */ | |
1309 | COSTS_N_INSNS (1), /* variable shift costs */ | |
1310 | COSTS_N_INSNS (1), /* constant shift costs */ | |
1311 | {COSTS_N_INSNS (4), /* cost of starting multiply for QI */ | |
1312 | COSTS_N_INSNS (4), /* HI */ | |
1313 | COSTS_N_INSNS (4), /* SI */ | |
1314 | COSTS_N_INSNS (6), /* DI */ | |
1315 | COSTS_N_INSNS (6)}, /* other */ | |
1316 | 0, /* cost of multiply per each bit set */ | |
1317 | {COSTS_N_INSNS (19), /* cost of a divide/mod for QI */ | |
1318 | COSTS_N_INSNS (35), /* HI */ | |
1319 | COSTS_N_INSNS (51), /* SI */ | |
1320 | COSTS_N_INSNS (83), /* DI */ | |
1321 | COSTS_N_INSNS (83)}, /* other */ | |
1322 | COSTS_N_INSNS (1), /* cost of movsx */ | |
1323 | COSTS_N_INSNS (1), /* cost of movzx */ | |
1324 | 8, /* "large" insn */ | |
1325 | 9, /* MOVE_RATIO */ | |
25e22b19 | 1326 | 6, /* CLEAR_RATIO */ |
df41dbaf | 1327 | {8, 8, 8}, /* cost of loading integer registers |
64766e8d JH |
1328 | in QImode, HImode and SImode. |
1329 | Relative to reg-reg move (2). */ | |
df41dbaf | 1330 | {8, 8, 8}, /* cost of storing integer registers */ |
d321551c L |
1331 | {12, 12, 10, 40, 60}, /* cost of loading SSE register |
1332 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
1333 | {10, 10, 10, 40, 60}, /* cost of storing SSE register | |
1334 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
b7167993 | 1335 | {12, 12, 10, 40, 60}, /* cost of unaligned loads. */ |
b7167993 | 1336 | {10, 10, 10, 40, 60}, /* cost of unaligned stores. */ |
d321551c L |
1337 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
1338 | 16, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
1339 | 12, 12, /* Gather load static, per_elt. */ |
1340 | 10, 10, /* Gather store static, per_elt. */ | |
64766e8d JH |
1341 | 16, /* size of l1 cache. */ |
1342 | 2048, /* size of l2 cache. */ | |
1343 | 64, /* size of prefetch block */ | |
1344 | /* New AMD processors never drop prefetches; if they cannot be performed | |
1345 | immediately, they are queued. We set number of simultaneous prefetches | |
1346 | to a large constant to reflect this (it probably is not a good idea not | |
1347 | to limit number of prefetches at all, as their execution also takes some | |
1348 | time). */ | |
1349 | 100, /* number of parallel prefetches */ | |
1350 | 2, /* Branch cost */ | |
1351 | COSTS_N_INSNS (6), /* cost of FADD and FSUB insns. */ | |
1352 | COSTS_N_INSNS (6), /* cost of FMUL instruction. */ | |
1353 | COSTS_N_INSNS (42), /* cost of FDIV instruction. */ | |
1354 | COSTS_N_INSNS (2), /* cost of FABS instruction. */ | |
1355 | COSTS_N_INSNS (2), /* cost of FCHS instruction. */ | |
1356 | COSTS_N_INSNS (52), /* cost of FSQRT instruction. */ | |
6065f444 | 1357 | |
c53c148c | 1358 | COSTS_N_INSNS (2), /* cost of cheap SSE instruction. */ |
6065f444 JH |
1359 | COSTS_N_INSNS (6), /* cost of ADDSS/SD SUBSS/SD insns. */ |
1360 | COSTS_N_INSNS (6), /* cost of MULSS instruction. */ | |
1361 | COSTS_N_INSNS (6), /* cost of MULSD instruction. */ | |
c53c148c JH |
1362 | COSTS_N_INSNS (6), /* cost of FMA SS instruction. */ |
1363 | COSTS_N_INSNS (6), /* cost of FMA SD instruction. */ | |
6065f444 JH |
1364 | /* 9-24 */ |
1365 | COSTS_N_INSNS (24), /* cost of DIVSS instruction. */ | |
1366 | /* 9-27 */ | |
1367 | COSTS_N_INSNS (27), /* cost of DIVSD instruction. */ | |
1368 | COSTS_N_INSNS (15), /* cost of SQRTSS instruction. */ | |
1369 | COSTS_N_INSNS (26), /* cost of SQRTSD instruction. */ | |
64766e8d | 1370 | 1, 2, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
c727b835 RB |
1371 | bdver_memcpy, |
1372 | bdver_memset, | |
f6fd8f2b JH |
1373 | COSTS_N_INSNS (4), /* cond_taken_branch_cost. */ |
1374 | COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
1375 | "16:11:8", /* Loop alignment. */ |
1376 | "16:8:8", /* Jump alignment. */ | |
1377 | "0:0:8", /* Label alignment. */ | |
1378 | "11", /* Func alignment. */ | |
64766e8d JH |
1379 | }; |
1380 | ||
1381 | ||
1382 | /* ZNVER1 has optimized REP instruction for medium sized blocks, but for | |
1383 | very small blocks it is better to use loop. For large blocks, libcall | |
1384 | can do nontemporary accesses and beat inline considerably. */ | |
1385 | static stringop_algs znver1_memcpy[2] = { | |
da346efd ML |
1386 | /* 32-bit tuning. */ |
1387 | {libcall, {{6, loop, false}, | |
1388 | {14, unrolled_loop, false}, | |
dc65aba7 | 1389 | {-1, libcall, false}}}, |
da346efd ML |
1390 | /* 64-bit tuning. */ |
1391 | {libcall, {{16, loop, false}, | |
dc65aba7 | 1392 | {128, rep_prefix_8_byte, false}, |
64766e8d JH |
1393 | {-1, libcall, false}}}}; |
1394 | static stringop_algs znver1_memset[2] = { | |
da346efd ML |
1395 | /* 32-bit tuning. */ |
1396 | {libcall, {{8, loop, false}, | |
1397 | {24, unrolled_loop, false}, | |
dc65aba7 | 1398 | {128, rep_prefix_4_byte, false}, |
da346efd ML |
1399 | {-1, libcall, false}}}, |
1400 | /* 64-bit tuning. */ | |
1401 | {libcall, {{48, unrolled_loop, false}, | |
dc65aba7 | 1402 | {128, rep_prefix_8_byte, false}, |
64766e8d JH |
1403 | {-1, libcall, false}}}}; |
1404 | struct processor_costs znver1_cost = { | |
72bb85f8 | 1405 | { |
d321551c L |
1406 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
1407 | ||
1408 | /* reg-reg moves are done by renaming and thus they are even cheaper than | |
1409 | 1 cycle. Becuase reg-reg move cost is 2 and the following tables correspond | |
1410 | to doubles of latencies, we do not model this correctly. It does not | |
1411 | seem to make practical difference to bump prices up even more. */ | |
1412 | 6, /* cost for loading QImode using | |
1413 | movzbl. */ | |
1414 | {6, 6, 6}, /* cost of loading integer registers | |
1415 | in QImode, HImode and SImode. | |
1416 | Relative to reg-reg move (2). */ | |
1417 | {8, 8, 8}, /* cost of storing integer | |
1418 | registers. */ | |
1419 | 2, /* cost of reg,reg fld/fst. */ | |
1420 | {6, 6, 16}, /* cost of loading fp registers | |
1421 | in SFmode, DFmode and XFmode. */ | |
1422 | {8, 8, 16}, /* cost of storing fp registers | |
1423 | in SFmode, DFmode and XFmode. */ | |
1424 | 2, /* cost of moving MMX register. */ | |
1425 | {6, 6}, /* cost of loading MMX registers | |
1426 | in SImode and DImode. */ | |
1427 | {8, 8}, /* cost of storing MMX registers | |
1428 | in SImode and DImode. */ | |
1429 | 2, 3, 6, /* cost of moving XMM,YMM,ZMM register. */ | |
1430 | {6, 6, 6, 12, 24}, /* cost of loading SSE registers | |
1431 | in 32,64,128,256 and 512-bit. */ | |
1432 | {8, 8, 8, 16, 32}, /* cost of storing SSE registers | |
1433 | in 32,64,128,256 and 512-bit. */ | |
ecc3135a | 1434 | 6, 6, /* SSE->integer and integer->SSE moves. */ |
1435 | 8, 8, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
1436 | {6, 6, 6}, /* cost of loading mask register |
1437 | in QImode, HImode, SImode. */ | |
1438 | {8, 8, 8}, /* cost if storing mask register | |
1439 | in QImode, HImode, SImode. */ | |
1440 | 2, /* cost of moving mask register. */ | |
d321551c | 1441 | /* End of register allocator costs. */ |
72bb85f8 | 1442 | }, |
d321551c | 1443 | |
64766e8d JH |
1444 | COSTS_N_INSNS (1), /* cost of an add instruction. */ |
1445 | COSTS_N_INSNS (1), /* cost of a lea instruction. */ | |
1446 | COSTS_N_INSNS (1), /* variable shift costs. */ | |
1447 | COSTS_N_INSNS (1), /* constant shift costs. */ | |
1448 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI. */ | |
1449 | COSTS_N_INSNS (3), /* HI. */ | |
1450 | COSTS_N_INSNS (3), /* SI. */ | |
6065f444 JH |
1451 | COSTS_N_INSNS (3), /* DI. */ |
1452 | COSTS_N_INSNS (3)}, /* other. */ | |
64766e8d JH |
1453 | 0, /* cost of multiply per each bit |
1454 | set. */ | |
6065f444 JH |
1455 | /* Depending on parameters, idiv can get faster on ryzen. This is upper |
1456 | bound. */ | |
1457 | {COSTS_N_INSNS (16), /* cost of a divide/mod for QI. */ | |
1458 | COSTS_N_INSNS (22), /* HI. */ | |
1459 | COSTS_N_INSNS (30), /* SI. */ | |
1460 | COSTS_N_INSNS (45), /* DI. */ | |
1461 | COSTS_N_INSNS (45)}, /* other. */ | |
64766e8d JH |
1462 | COSTS_N_INSNS (1), /* cost of movsx. */ |
1463 | COSTS_N_INSNS (1), /* cost of movzx. */ | |
1464 | 8, /* "large" insn. */ | |
1465 | 9, /* MOVE_RATIO. */ | |
25e22b19 | 1466 | 6, /* CLEAR_RATIO */ |
01118373 | 1467 | {6, 6, 6}, /* cost of loading integer registers |
64766e8d JH |
1468 | in QImode, HImode and SImode. |
1469 | Relative to reg-reg move (2). */ | |
01118373 | 1470 | {8, 8, 8}, /* cost of storing integer |
64766e8d | 1471 | registers. */ |
d321551c L |
1472 | {6, 6, 6, 12, 24}, /* cost of loading SSE register |
1473 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
1474 | {8, 8, 8, 16, 32}, /* cost of storing SSE register | |
1475 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
b7167993 | 1476 | {6, 6, 6, 12, 24}, /* cost of unaligned loads. */ |
b7167993 | 1477 | {8, 8, 8, 16, 32}, /* cost of unaligned stores. */ |
d321551c L |
1478 | 2, 3, 6, /* cost of moving XMM,YMM,ZMM register. */ |
1479 | 6, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
1480 | /* VGATHERDPD is 23 uops and throughput is 9, VGATHERDPD is 35 uops, |
1481 | throughput 12. Approx 9 uops do not depend on vector size and every load | |
1482 | is 7 uops. */ | |
1483 | 18, 8, /* Gather load static, per_elt. */ | |
1484 | 18, 10, /* Gather store static, per_elt. */ | |
64766e8d JH |
1485 | 32, /* size of l1 cache. */ |
1486 | 512, /* size of l2 cache. */ | |
1487 | 64, /* size of prefetch block. */ | |
1488 | /* New AMD processors never drop prefetches; if they cannot be performed | |
1489 | immediately, they are queued. We set number of simultaneous prefetches | |
1490 | to a large constant to reflect this (it probably is not a good idea not | |
1491 | to limit number of prefetches at all, as their execution also takes some | |
1492 | time). */ | |
1493 | 100, /* number of parallel prefetches. */ | |
1494 | 3, /* Branch cost. */ | |
6065f444 JH |
1495 | COSTS_N_INSNS (5), /* cost of FADD and FSUB insns. */ |
1496 | COSTS_N_INSNS (5), /* cost of FMUL instruction. */ | |
1497 | /* Latency of fdiv is 8-15. */ | |
1498 | COSTS_N_INSNS (15), /* cost of FDIV instruction. */ | |
1499 | COSTS_N_INSNS (1), /* cost of FABS instruction. */ | |
1500 | COSTS_N_INSNS (1), /* cost of FCHS instruction. */ | |
1501 | /* Latency of fsqrt is 4-10. */ | |
1502 | COSTS_N_INSNS (10), /* cost of FSQRT instruction. */ | |
1503 | ||
c53c148c | 1504 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
1505 | COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */ |
1506 | COSTS_N_INSNS (3), /* cost of MULSS instruction. */ | |
1507 | COSTS_N_INSNS (4), /* cost of MULSD instruction. */ | |
c53c148c JH |
1508 | COSTS_N_INSNS (5), /* cost of FMA SS instruction. */ |
1509 | COSTS_N_INSNS (5), /* cost of FMA SD instruction. */ | |
6065f444 JH |
1510 | COSTS_N_INSNS (10), /* cost of DIVSS instruction. */ |
1511 | /* 9-13 */ | |
1512 | COSTS_N_INSNS (13), /* cost of DIVSD instruction. */ | |
1513 | COSTS_N_INSNS (10), /* cost of SQRTSS instruction. */ | |
1514 | COSTS_N_INSNS (15), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
1515 | /* Zen can execute 4 integer operations per cycle. FP operations take 3 cycles |
1516 | and it can execute 2 integer additions and 2 multiplications thus | |
1517 | reassociation may make sense up to with of 6. SPEC2k6 bencharks suggests | |
1518 | that 4 works better than 6 probably due to register pressure. | |
1519 | ||
1520 | Integer vector operations are taken by FP unit and execute 3 vector | |
1521 | plus/minus operations per cycle but only one multiply. This is adjusted | |
1522 | in ix86_reassociation_width. */ | |
1523 | 4, 4, 3, 6, /* reassoc int, fp, vec_int, vec_fp. */ | |
1524 | znver1_memcpy, | |
1525 | znver1_memset, | |
f6fd8f2b JH |
1526 | COSTS_N_INSNS (4), /* cond_taken_branch_cost. */ |
1527 | COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
1528 | "16", /* Loop alignment. */ |
1529 | "16", /* Jump alignment. */ | |
1530 | "0:0:8", /* Label alignment. */ | |
1531 | "16", /* Func alignment. */ | |
64766e8d JH |
1532 | }; |
1533 | ||
2901f42f VK |
1534 | /* ZNVER2 has optimized REP instruction for medium sized blocks, but for |
1535 | very small blocks it is better to use loop. For large blocks, libcall | |
1536 | can do nontemporary accesses and beat inline considerably. */ | |
1537 | static stringop_algs znver2_memcpy[2] = { | |
da346efd ML |
1538 | /* 32-bit tuning. */ |
1539 | {libcall, {{6, loop, false}, | |
1540 | {14, unrolled_loop, false}, | |
dc65aba7 | 1541 | {-1, libcall, false}}}, |
da346efd ML |
1542 | /* 64-bit tuning. */ |
1543 | {libcall, {{16, loop, false}, | |
1544 | {64, rep_prefix_4_byte, false}, | |
2901f42f VK |
1545 | {-1, libcall, false}}}}; |
1546 | static stringop_algs znver2_memset[2] = { | |
da346efd ML |
1547 | /* 32-bit tuning. */ |
1548 | {libcall, {{8, loop, false}, | |
1549 | {24, unrolled_loop, false}, | |
dc65aba7 | 1550 | {128, rep_prefix_4_byte, false}, |
da346efd ML |
1551 | {-1, libcall, false}}}, |
1552 | /* 64-bit tuning. */ | |
1553 | {libcall, {{24, rep_prefix_4_byte, false}, | |
1554 | {128, rep_prefix_8_byte, false}, | |
2901f42f VK |
1555 | {-1, libcall, false}}}}; |
1556 | ||
1557 | struct processor_costs znver2_cost = { | |
72bb85f8 | 1558 | { |
d321551c | 1559 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
2901f42f | 1560 | |
5b32a181 JH |
1561 | /* reg-reg moves are done by renaming and thus they are even cheaper than |
1562 | 1 cycle. Because reg-reg move cost is 2 and following tables correspond | |
1563 | to doubles of latencies, we do not model this correctly. It does not | |
1564 | seem to make practical difference to bump prices up even more. */ | |
1565 | 6, /* cost for loading QImode using | |
1566 | movzbl. */ | |
1567 | {6, 6, 6}, /* cost of loading integer registers | |
1568 | in QImode, HImode and SImode. | |
1569 | Relative to reg-reg move (2). */ | |
1570 | {8, 8, 8}, /* cost of storing integer | |
1571 | registers. */ | |
1572 | 2, /* cost of reg,reg fld/fst. */ | |
1573 | {6, 6, 16}, /* cost of loading fp registers | |
1574 | in SFmode, DFmode and XFmode. */ | |
1575 | {8, 8, 16}, /* cost of storing fp registers | |
1576 | in SFmode, DFmode and XFmode. */ | |
1577 | 2, /* cost of moving MMX register. */ | |
1578 | {6, 6}, /* cost of loading MMX registers | |
1579 | in SImode and DImode. */ | |
1580 | {8, 8}, /* cost of storing MMX registers | |
1581 | in SImode and DImode. */ | |
1582 | 2, 2, 3, /* cost of moving XMM,YMM,ZMM | |
1583 | register. */ | |
1584 | {6, 6, 6, 6, 12}, /* cost of loading SSE registers | |
1585 | in 32,64,128,256 and 512-bit. */ | |
1586 | {8, 8, 8, 8, 16}, /* cost of storing SSE registers | |
1587 | in 32,64,128,256 and 512-bit. */ | |
1588 | 6, 6, /* SSE->integer and integer->SSE | |
1589 | moves. */ | |
1590 | 8, 8, /* mask->integer and integer->mask moves */ | |
1591 | {6, 6, 6}, /* cost of loading mask register | |
1592 | in QImode, HImode, SImode. */ | |
1593 | {8, 8, 8}, /* cost if storing mask register | |
1594 | in QImode, HImode, SImode. */ | |
1595 | 2, /* cost of moving mask register. */ | |
1596 | /* End of register allocator costs. */ | |
1597 | }, | |
1598 | ||
1599 | COSTS_N_INSNS (1), /* cost of an add instruction. */ | |
1600 | COSTS_N_INSNS (1), /* cost of a lea instruction. */ | |
1601 | COSTS_N_INSNS (1), /* variable shift costs. */ | |
1602 | COSTS_N_INSNS (1), /* constant shift costs. */ | |
1603 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI. */ | |
1604 | COSTS_N_INSNS (3), /* HI. */ | |
1605 | COSTS_N_INSNS (3), /* SI. */ | |
1606 | COSTS_N_INSNS (3), /* DI. */ | |
1607 | COSTS_N_INSNS (3)}, /* other. */ | |
1608 | 0, /* cost of multiply per each bit | |
1609 | set. */ | |
1610 | /* Depending on parameters, idiv can get faster on ryzen. This is upper | |
1611 | bound. */ | |
1612 | {COSTS_N_INSNS (16), /* cost of a divide/mod for QI. */ | |
1613 | COSTS_N_INSNS (22), /* HI. */ | |
1614 | COSTS_N_INSNS (30), /* SI. */ | |
1615 | COSTS_N_INSNS (45), /* DI. */ | |
1616 | COSTS_N_INSNS (45)}, /* other. */ | |
1617 | COSTS_N_INSNS (1), /* cost of movsx. */ | |
1618 | COSTS_N_INSNS (1), /* cost of movzx. */ | |
1619 | 8, /* "large" insn. */ | |
1620 | 9, /* MOVE_RATIO. */ | |
1621 | 6, /* CLEAR_RATIO */ | |
1622 | {6, 6, 6}, /* cost of loading integer registers | |
1623 | in QImode, HImode and SImode. | |
1624 | Relative to reg-reg move (2). */ | |
1625 | {8, 8, 8}, /* cost of storing integer | |
1626 | registers. */ | |
1627 | {6, 6, 6, 6, 12}, /* cost of loading SSE registers | |
1628 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
1629 | {8, 8, 8, 8, 16}, /* cost of storing SSE register | |
1630 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
1631 | {6, 6, 6, 6, 12}, /* cost of unaligned loads. */ | |
1632 | {8, 8, 8, 8, 16}, /* cost of unaligned stores. */ | |
1633 | 2, 2, 3, /* cost of moving XMM,YMM,ZMM | |
1634 | register. */ | |
1635 | 6, /* cost of moving SSE register to integer. */ | |
1636 | /* VGATHERDPD is 23 uops and throughput is 9, VGATHERDPD is 35 uops, | |
1637 | throughput 12. Approx 9 uops do not depend on vector size and every load | |
1638 | is 7 uops. */ | |
1639 | 18, 8, /* Gather load static, per_elt. */ | |
1640 | 18, 10, /* Gather store static, per_elt. */ | |
1641 | 32, /* size of l1 cache. */ | |
1642 | 512, /* size of l2 cache. */ | |
1643 | 64, /* size of prefetch block. */ | |
1644 | /* New AMD processors never drop prefetches; if they cannot be performed | |
1645 | immediately, they are queued. We set number of simultaneous prefetches | |
1646 | to a large constant to reflect this (it probably is not a good idea not | |
1647 | to limit number of prefetches at all, as their execution also takes some | |
1648 | time). */ | |
1649 | 100, /* number of parallel prefetches. */ | |
1650 | 3, /* Branch cost. */ | |
1651 | COSTS_N_INSNS (5), /* cost of FADD and FSUB insns. */ | |
1652 | COSTS_N_INSNS (5), /* cost of FMUL instruction. */ | |
1653 | /* Latency of fdiv is 8-15. */ | |
1654 | COSTS_N_INSNS (15), /* cost of FDIV instruction. */ | |
1655 | COSTS_N_INSNS (1), /* cost of FABS instruction. */ | |
1656 | COSTS_N_INSNS (1), /* cost of FCHS instruction. */ | |
1657 | /* Latency of fsqrt is 4-10. */ | |
1658 | COSTS_N_INSNS (10), /* cost of FSQRT instruction. */ | |
1659 | ||
1660 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ | |
1661 | COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */ | |
1662 | COSTS_N_INSNS (3), /* cost of MULSS instruction. */ | |
1663 | COSTS_N_INSNS (3), /* cost of MULSD instruction. */ | |
1664 | COSTS_N_INSNS (5), /* cost of FMA SS instruction. */ | |
1665 | COSTS_N_INSNS (5), /* cost of FMA SD instruction. */ | |
1666 | COSTS_N_INSNS (10), /* cost of DIVSS instruction. */ | |
1667 | /* 9-13. */ | |
1668 | COSTS_N_INSNS (13), /* cost of DIVSD instruction. */ | |
1669 | COSTS_N_INSNS (10), /* cost of SQRTSS instruction. */ | |
1670 | COSTS_N_INSNS (15), /* cost of SQRTSD instruction. */ | |
1671 | /* Zen can execute 4 integer operations per cycle. FP operations | |
1672 | take 3 cycles and it can execute 2 integer additions and 2 | |
1673 | multiplications thus reassociation may make sense up to with of 6. | |
1674 | SPEC2k6 bencharks suggests | |
1675 | that 4 works better than 6 probably due to register pressure. | |
1676 | ||
1677 | Integer vector operations are taken by FP unit and execute 3 vector | |
1678 | plus/minus operations per cycle but only one multiply. This is adjusted | |
1679 | in ix86_reassociation_width. */ | |
1680 | 4, 4, 3, 6, /* reassoc int, fp, vec_int, vec_fp. */ | |
1681 | znver2_memcpy, | |
1682 | znver2_memset, | |
1683 | COSTS_N_INSNS (4), /* cond_taken_branch_cost. */ | |
1684 | COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */ | |
1685 | "16", /* Loop alignment. */ | |
1686 | "16", /* Jump alignment. */ | |
1687 | "0:0:8", /* Label alignment. */ | |
1688 | "16", /* Func alignment. */ | |
1689 | }; | |
1690 | ||
1691 | struct processor_costs znver3_cost = { | |
1692 | { | |
1693 | /* Start of register allocator costs. integer->integer move cost is 2. */ | |
1694 | ||
2901f42f VK |
1695 | /* reg-reg moves are done by renaming and thus they are even cheaper than |
1696 | 1 cycle. Because reg-reg move cost is 2 and following tables correspond | |
1697 | to doubles of latencies, we do not model this correctly. It does not | |
1698 | seem to make practical difference to bump prices up even more. */ | |
1699 | 6, /* cost for loading QImode using | |
1700 | movzbl. */ | |
1701 | {6, 6, 6}, /* cost of loading integer registers | |
1702 | in QImode, HImode and SImode. | |
1703 | Relative to reg-reg move (2). */ | |
1704 | {8, 8, 8}, /* cost of storing integer | |
1705 | registers. */ | |
1706 | 2, /* cost of reg,reg fld/fst. */ | |
1707 | {6, 6, 16}, /* cost of loading fp registers | |
1708 | in SFmode, DFmode and XFmode. */ | |
1709 | {8, 8, 16}, /* cost of storing fp registers | |
1710 | in SFmode, DFmode and XFmode. */ | |
1711 | 2, /* cost of moving MMX register. */ | |
1712 | {6, 6}, /* cost of loading MMX registers | |
1713 | in SImode and DImode. */ | |
1714 | {8, 8}, /* cost of storing MMX registers | |
1715 | in SImode and DImode. */ | |
187dd65d | 1716 | 2, 2, 3, /* cost of moving XMM,YMM,ZMM |
2901f42f | 1717 | register. */ |
187dd65d | 1718 | {6, 6, 6, 6, 12}, /* cost of loading SSE registers |
2901f42f | 1719 | in 32,64,128,256 and 512-bit. */ |
2901f42f VK |
1720 | {8, 8, 8, 8, 16}, /* cost of storing SSE registers |
1721 | in 32,64,128,256 and 512-bit. */ | |
2901f42f VK |
1722 | 6, 6, /* SSE->integer and integer->SSE |
1723 | moves. */ | |
ecc3135a | 1724 | 8, 8, /* mask->integer and integer->mask moves */ |
00cb3494 L |
1725 | {6, 6, 6}, /* cost of loading mask register |
1726 | in QImode, HImode, SImode. */ | |
1727 | {8, 8, 8}, /* cost if storing mask register | |
1728 | in QImode, HImode, SImode. */ | |
1729 | 2, /* cost of moving mask register. */ | |
d321551c | 1730 | /* End of register allocator costs. */ |
72bb85f8 | 1731 | }, |
d321551c L |
1732 | |
1733 | COSTS_N_INSNS (1), /* cost of an add instruction. */ | |
1734 | COSTS_N_INSNS (1), /* cost of a lea instruction. */ | |
1735 | COSTS_N_INSNS (1), /* variable shift costs. */ | |
1736 | COSTS_N_INSNS (1), /* constant shift costs. */ | |
1737 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI. */ | |
1738 | COSTS_N_INSNS (3), /* HI. */ | |
1739 | COSTS_N_INSNS (3), /* SI. */ | |
1740 | COSTS_N_INSNS (3), /* DI. */ | |
1741 | COSTS_N_INSNS (3)}, /* other. */ | |
1742 | 0, /* cost of multiply per each bit | |
1743 | set. */ | |
ab03c0d5 JH |
1744 | {COSTS_N_INSNS (9), /* cost of a divide/mod for QI. */ |
1745 | COSTS_N_INSNS (10), /* HI. */ | |
1746 | COSTS_N_INSNS (12), /* SI. */ | |
1747 | COSTS_N_INSNS (17), /* DI. */ | |
1748 | COSTS_N_INSNS (17)}, /* other. */ | |
d321551c L |
1749 | COSTS_N_INSNS (1), /* cost of movsx. */ |
1750 | COSTS_N_INSNS (1), /* cost of movzx. */ | |
1751 | 8, /* "large" insn. */ | |
1752 | 9, /* MOVE_RATIO. */ | |
25e22b19 | 1753 | 6, /* CLEAR_RATIO */ |
d321551c L |
1754 | {6, 6, 6}, /* cost of loading integer registers |
1755 | in QImode, HImode and SImode. | |
1756 | Relative to reg-reg move (2). */ | |
1757 | {8, 8, 8}, /* cost of storing integer | |
1758 | registers. */ | |
1759 | {6, 6, 6, 6, 12}, /* cost of loading SSE registers | |
1760 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
1761 | {8, 8, 8, 8, 16}, /* cost of storing SSE register | |
1762 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
1763 | {6, 6, 6, 6, 12}, /* cost of unaligned loads. */ | |
1764 | {8, 8, 8, 8, 16}, /* cost of unaligned stores. */ | |
1765 | 2, 2, 3, /* cost of moving XMM,YMM,ZMM | |
1766 | register. */ | |
1767 | 6, /* cost of moving SSE register to integer. */ | |
bd364aae JH |
1768 | /* VGATHERDPD is 15 uops and throughput is 4, VGATHERDPS is 23 uops, |
1769 | throughput 9. Approx 7 uops do not depend on vector size and every load | |
1770 | is 4 uops. */ | |
1771 | 14, 8, /* Gather load static, per_elt. */ | |
1772 | 14, 10, /* Gather store static, per_elt. */ | |
2901f42f VK |
1773 | 32, /* size of l1 cache. */ |
1774 | 512, /* size of l2 cache. */ | |
1775 | 64, /* size of prefetch block. */ | |
1776 | /* New AMD processors never drop prefetches; if they cannot be performed | |
1777 | immediately, they are queued. We set number of simultaneous prefetches | |
1778 | to a large constant to reflect this (it probably is not a good idea not | |
1779 | to limit number of prefetches at all, as their execution also takes some | |
1780 | time). */ | |
1781 | 100, /* number of parallel prefetches. */ | |
1782 | 3, /* Branch cost. */ | |
1783 | COSTS_N_INSNS (5), /* cost of FADD and FSUB insns. */ | |
1784 | COSTS_N_INSNS (5), /* cost of FMUL instruction. */ | |
1785 | /* Latency of fdiv is 8-15. */ | |
1786 | COSTS_N_INSNS (15), /* cost of FDIV instruction. */ | |
1787 | COSTS_N_INSNS (1), /* cost of FABS instruction. */ | |
1788 | COSTS_N_INSNS (1), /* cost of FCHS instruction. */ | |
1789 | /* Latency of fsqrt is 4-10. */ | |
1790 | COSTS_N_INSNS (10), /* cost of FSQRT instruction. */ | |
1791 | ||
1792 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ | |
1793 | COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */ | |
1794 | COSTS_N_INSNS (3), /* cost of MULSS instruction. */ | |
187dd65d | 1795 | COSTS_N_INSNS (3), /* cost of MULSD instruction. */ |
2901f42f VK |
1796 | COSTS_N_INSNS (5), /* cost of FMA SS instruction. */ |
1797 | COSTS_N_INSNS (5), /* cost of FMA SD instruction. */ | |
1798 | COSTS_N_INSNS (10), /* cost of DIVSS instruction. */ | |
1799 | /* 9-13. */ | |
1800 | COSTS_N_INSNS (13), /* cost of DIVSD instruction. */ | |
1801 | COSTS_N_INSNS (10), /* cost of SQRTSS instruction. */ | |
1802 | COSTS_N_INSNS (15), /* cost of SQRTSD instruction. */ | |
1803 | /* Zen can execute 4 integer operations per cycle. FP operations | |
1804 | take 3 cycles and it can execute 2 integer additions and 2 | |
1805 | multiplications thus reassociation may make sense up to with of 6. | |
1806 | SPEC2k6 bencharks suggests | |
1807 | that 4 works better than 6 probably due to register pressure. | |
1808 | ||
1809 | Integer vector operations are taken by FP unit and execute 3 vector | |
1810 | plus/minus operations per cycle but only one multiply. This is adjusted | |
1811 | in ix86_reassociation_width. */ | |
1812 | 4, 4, 3, 6, /* reassoc int, fp, vec_int, vec_fp. */ | |
1813 | znver2_memcpy, | |
1814 | znver2_memset, | |
1815 | COSTS_N_INSNS (4), /* cond_taken_branch_cost. */ | |
1816 | COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */ | |
1817 | "16", /* Loop alignment. */ | |
1818 | "16", /* Jump alignment. */ | |
1819 | "0:0:8", /* Label alignment. */ | |
1820 | "16", /* Func alignment. */ | |
1821 | }; | |
1822 | ||
c234d831 UB |
1823 | /* skylake_cost should produce code tuned for Skylake familly of CPUs. */ |
1824 | static stringop_algs skylake_memcpy[2] = { | |
1825 | {libcall, {{1024, rep_prefix_4_byte, true}, {-1, libcall, false}}}, | |
6e559c70 | 1826 | {libcall, {{16, loop, false}, {512, unrolled_loop, false}, |
c234d831 UB |
1827 | {-1, libcall, false}}}}; |
1828 | ||
1829 | static stringop_algs skylake_memset[2] = { | |
1830 | {libcall, {{6, loop_1_byte, true}, | |
1831 | {24, loop, true}, | |
1832 | {8192, rep_prefix_4_byte, true}, | |
1833 | {-1, libcall, false}}}, | |
6e559c70 | 1834 | {libcall, {{24, loop, true}, {512, unrolled_loop, false}, |
c234d831 UB |
1835 | {-1, libcall, false}}}}; |
1836 | ||
1837 | static const | |
1838 | struct processor_costs skylake_cost = { | |
72bb85f8 | 1839 | { |
d321551c L |
1840 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
1841 | 6, /* cost for loading QImode using movzbl */ | |
1842 | {4, 4, 4}, /* cost of loading integer registers | |
1843 | in QImode, HImode and SImode. | |
1844 | Relative to reg-reg move (2). */ | |
7706f2f3 | 1845 | {6, 6, 6}, /* cost of storing integer registers */ |
d321551c L |
1846 | 2, /* cost of reg,reg fld/fst */ |
1847 | {6, 6, 8}, /* cost of loading fp registers | |
1848 | in SFmode, DFmode and XFmode */ | |
1849 | {6, 6, 10}, /* cost of storing fp registers | |
1850 | in SFmode, DFmode and XFmode */ | |
1851 | 2, /* cost of moving MMX register */ | |
1852 | {6, 6}, /* cost of loading MMX registers | |
1853 | in SImode and DImode */ | |
1854 | {6, 6}, /* cost of storing MMX registers | |
1855 | in SImode and DImode */ | |
1856 | 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */ | |
1857 | {6, 6, 6, 10, 20}, /* cost of loading SSE registers | |
1858 | in 32,64,128,256 and 512-bit */ | |
1859 | {8, 8, 8, 12, 24}, /* cost of storing SSE registers | |
1860 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 1861 | 6, 6, /* SSE->integer and integer->SSE moves */ |
1862 | 5, 5, /* mask->integer and integer->mask moves */ | |
1863 | {8, 8, 8}, /* cost of loading mask register | |
00cb3494 | 1864 | in QImode, HImode, SImode. */ |
ecc3135a | 1865 | {6, 6, 6}, /* cost if storing mask register |
00cb3494 | 1866 | in QImode, HImode, SImode. */ |
16516644 | 1867 | 3, /* cost of moving mask register. */ |
d321551c | 1868 | /* End of register allocator costs. */ |
72bb85f8 | 1869 | }, |
d321551c | 1870 | |
c234d831 UB |
1871 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
1872 | COSTS_N_INSNS (1)+1, /* cost of a lea instruction */ | |
1873 | COSTS_N_INSNS (1), /* variable shift costs */ | |
1874 | COSTS_N_INSNS (1), /* constant shift costs */ | |
1875 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ | |
1876 | COSTS_N_INSNS (4), /* HI */ | |
1877 | COSTS_N_INSNS (3), /* SI */ | |
a2ef9558 MT |
1878 | COSTS_N_INSNS (3), /* DI */ |
1879 | COSTS_N_INSNS (3)}, /* other */ | |
c234d831 | 1880 | 0, /* cost of multiply per each bit set */ |
02308bd3 MT |
1881 | /* Expanding div/mod currently doesn't consider parallelism. So the cost |
1882 | model is not realistic. We compensate by increasing the latencies a bit. */ | |
1883 | {COSTS_N_INSNS (11), /* cost of a divide/mod for QI */ | |
1884 | COSTS_N_INSNS (11), /* HI */ | |
1885 | COSTS_N_INSNS (14), /* SI */ | |
c234d831 UB |
1886 | COSTS_N_INSNS (76), /* DI */ |
1887 | COSTS_N_INSNS (76)}, /* other */ | |
1888 | COSTS_N_INSNS (1), /* cost of movsx */ | |
1889 | COSTS_N_INSNS (0), /* cost of movzx */ | |
1890 | 8, /* "large" insn */ | |
1891 | 17, /* MOVE_RATIO */ | |
25e22b19 | 1892 | 6, /* CLEAR_RATIO */ |
c234d831 UB |
1893 | {4, 4, 4}, /* cost of loading integer registers |
1894 | in QImode, HImode and SImode. | |
1895 | Relative to reg-reg move (2). */ | |
101a0841 | 1896 | {6, 6, 6}, /* cost of storing integer registers */ |
d321551c L |
1897 | {6, 6, 6, 10, 20}, /* cost of loading SSE register |
1898 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
1899 | {8, 8, 8, 12, 24}, /* cost of storing SSE register | |
1900 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
c234d831 | 1901 | {6, 6, 6, 10, 20}, /* cost of unaligned loads. */ |
c234d831 | 1902 | {8, 8, 8, 8, 16}, /* cost of unaligned stores. */ |
d321551c | 1903 | 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */ |
83858ba1 | 1904 | 6, /* cost of moving SSE register to integer. */ |
c234d831 UB |
1905 | 20, 8, /* Gather load static, per_elt. */ |
1906 | 22, 10, /* Gather store static, per_elt. */ | |
1907 | 64, /* size of l1 cache. */ | |
1908 | 512, /* size of l2 cache. */ | |
1909 | 64, /* size of prefetch block */ | |
1910 | 6, /* number of parallel prefetches */ | |
1911 | 3, /* Branch cost */ | |
1912 | COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */ | |
1913 | COSTS_N_INSNS (4), /* cost of FMUL instruction. */ | |
1914 | COSTS_N_INSNS (20), /* cost of FDIV instruction. */ | |
1915 | COSTS_N_INSNS (1), /* cost of FABS instruction. */ | |
1916 | COSTS_N_INSNS (1), /* cost of FCHS instruction. */ | |
1917 | COSTS_N_INSNS (20), /* cost of FSQRT instruction. */ | |
1918 | ||
1919 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ | |
1920 | COSTS_N_INSNS (4), /* cost of ADDSS/SD SUBSS/SD insns. */ | |
1921 | COSTS_N_INSNS (4), /* cost of MULSS instruction. */ | |
1922 | COSTS_N_INSNS (4), /* cost of MULSD instruction. */ | |
1923 | COSTS_N_INSNS (4), /* cost of FMA SS instruction. */ | |
1924 | COSTS_N_INSNS (4), /* cost of FMA SD instruction. */ | |
1925 | COSTS_N_INSNS (11), /* cost of DIVSS instruction. */ | |
1926 | COSTS_N_INSNS (14), /* cost of DIVSD instruction. */ | |
1927 | COSTS_N_INSNS (12), /* cost of SQRTSS instruction. */ | |
1928 | COSTS_N_INSNS (18), /* cost of SQRTSD instruction. */ | |
1929 | 1, 4, 2, 2, /* reassoc int, fp, vec_int, vec_fp. */ | |
1930 | skylake_memcpy, | |
1931 | skylake_memset, | |
1932 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ | |
1933 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
1934 | "16:11:8", /* Loop alignment. */ |
1935 | "16:11:8", /* Jump alignment. */ | |
1936 | "0:0:8", /* Label alignment. */ | |
1937 | "16", /* Func alignment. */ | |
c234d831 | 1938 | }; |
64766e8d JH |
1939 | /* BTVER1 has optimized REP instruction for medium sized blocks, but for |
1940 | very small blocks it is better to use loop. For large blocks, libcall can | |
1941 | do nontemporary accesses and beat inline considerably. */ | |
1942 | static stringop_algs btver1_memcpy[2] = { | |
1943 | {libcall, {{6, loop, false}, {14, unrolled_loop, false}, | |
1944 | {-1, rep_prefix_4_byte, false}}}, | |
1945 | {libcall, {{16, loop, false}, {8192, rep_prefix_8_byte, false}, | |
1946 | {-1, libcall, false}}}}; | |
1947 | static stringop_algs btver1_memset[2] = { | |
1948 | {libcall, {{8, loop, false}, {24, unrolled_loop, false}, | |
1949 | {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
1950 | {libcall, {{48, unrolled_loop, false}, {8192, rep_prefix_8_byte, false}, | |
1951 | {-1, libcall, false}}}}; | |
1952 | const struct processor_costs btver1_cost = { | |
72bb85f8 | 1953 | { |
d321551c L |
1954 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
1955 | 8, /* cost for loading QImode using movzbl */ | |
1956 | {6, 8, 6}, /* cost of loading integer registers | |
1957 | in QImode, HImode and SImode. | |
1958 | Relative to reg-reg move (2). */ | |
1959 | {6, 8, 6}, /* cost of storing integer registers */ | |
1960 | 4, /* cost of reg,reg fld/fst */ | |
1961 | {12, 12, 28}, /* cost of loading fp registers | |
1962 | in SFmode, DFmode and XFmode */ | |
1963 | {12, 12, 38}, /* cost of storing fp registers | |
1964 | in SFmode, DFmode and XFmode */ | |
1965 | 4, /* cost of moving MMX register */ | |
1966 | {10, 10}, /* cost of loading MMX registers | |
1967 | in SImode and DImode */ | |
1968 | {12, 12}, /* cost of storing MMX registers | |
1969 | in SImode and DImode */ | |
1970 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
1971 | {10, 10, 12, 48, 96}, /* cost of loading SSE registers | |
1972 | in 32,64,128,256 and 512-bit */ | |
1973 | {10, 10, 12, 48, 96}, /* cost of storing SSE registers | |
1974 | in 32,64,128,256 and 512-bit */ | |
1975 | 14, 14, /* SSE->integer and integer->SSE moves */ | |
ecc3135a | 1976 | 14, 14, /* mask->integer and integer->mask moves */ |
00cb3494 L |
1977 | {6, 8, 6}, /* cost of loading mask register |
1978 | in QImode, HImode, SImode. */ | |
1979 | {6, 8, 6}, /* cost if storing mask register | |
1980 | in QImode, HImode, SImode. */ | |
1981 | 2, /* cost of moving mask register. */ | |
d321551c | 1982 | /* End of register allocator costs. */ |
72bb85f8 | 1983 | }, |
d321551c | 1984 | |
64766e8d JH |
1985 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
1986 | COSTS_N_INSNS (2), /* cost of a lea instruction */ | |
1987 | COSTS_N_INSNS (1), /* variable shift costs */ | |
1988 | COSTS_N_INSNS (1), /* constant shift costs */ | |
1989 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ | |
1990 | COSTS_N_INSNS (4), /* HI */ | |
1991 | COSTS_N_INSNS (3), /* SI */ | |
1992 | COSTS_N_INSNS (4), /* DI */ | |
1993 | COSTS_N_INSNS (5)}, /* other */ | |
1994 | 0, /* cost of multiply per each bit set */ | |
1995 | {COSTS_N_INSNS (19), /* cost of a divide/mod for QI */ | |
1996 | COSTS_N_INSNS (35), /* HI */ | |
1997 | COSTS_N_INSNS (51), /* SI */ | |
1998 | COSTS_N_INSNS (83), /* DI */ | |
1999 | COSTS_N_INSNS (83)}, /* other */ | |
2000 | COSTS_N_INSNS (1), /* cost of movsx */ | |
2001 | COSTS_N_INSNS (1), /* cost of movzx */ | |
2002 | 8, /* "large" insn */ | |
2003 | 9, /* MOVE_RATIO */ | |
25e22b19 | 2004 | 6, /* CLEAR_RATIO */ |
df41dbaf | 2005 | {6, 8, 6}, /* cost of loading integer registers |
64766e8d JH |
2006 | in QImode, HImode and SImode. |
2007 | Relative to reg-reg move (2). */ | |
df41dbaf | 2008 | {6, 8, 6}, /* cost of storing integer registers */ |
d321551c L |
2009 | {10, 10, 12, 48, 96}, /* cost of loading SSE register |
2010 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
2011 | {10, 10, 12, 48, 96}, /* cost of storing SSE register | |
2012 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
b7167993 | 2013 | {10, 10, 12, 48, 96}, /* cost of unaligned loads. */ |
b7167993 | 2014 | {10, 10, 12, 48, 96}, /* cost of unaligned stores. */ |
d321551c L |
2015 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
2016 | 14, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
2017 | 10, 10, /* Gather load static, per_elt. */ |
2018 | 10, 10, /* Gather store static, per_elt. */ | |
64766e8d JH |
2019 | 32, /* size of l1 cache. */ |
2020 | 512, /* size of l2 cache. */ | |
2021 | 64, /* size of prefetch block */ | |
2022 | 100, /* number of parallel prefetches */ | |
2023 | 2, /* Branch cost */ | |
2024 | COSTS_N_INSNS (4), /* cost of FADD and FSUB insns. */ | |
2025 | COSTS_N_INSNS (4), /* cost of FMUL instruction. */ | |
2026 | COSTS_N_INSNS (19), /* cost of FDIV instruction. */ | |
2027 | COSTS_N_INSNS (2), /* cost of FABS instruction. */ | |
2028 | COSTS_N_INSNS (2), /* cost of FCHS instruction. */ | |
2029 | COSTS_N_INSNS (35), /* cost of FSQRT instruction. */ | |
6065f444 | 2030 | |
c53c148c | 2031 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
2032 | COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */ |
2033 | COSTS_N_INSNS (2), /* cost of MULSS instruction. */ | |
2034 | COSTS_N_INSNS (4), /* cost of MULSD instruction. */ | |
c53c148c JH |
2035 | COSTS_N_INSNS (5), /* cost of FMA SS instruction. */ |
2036 | COSTS_N_INSNS (5), /* cost of FMA SD instruction. */ | |
6065f444 JH |
2037 | COSTS_N_INSNS (13), /* cost of DIVSS instruction. */ |
2038 | COSTS_N_INSNS (17), /* cost of DIVSD instruction. */ | |
2039 | COSTS_N_INSNS (14), /* cost of SQRTSS instruction. */ | |
2040 | COSTS_N_INSNS (48), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
2041 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
2042 | btver1_memcpy, | |
2043 | btver1_memset, | |
f6fd8f2b JH |
2044 | COSTS_N_INSNS (2), /* cond_taken_branch_cost. */ |
2045 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
2046 | "16:11:8", /* Loop alignment. */ |
2047 | "16:8:8", /* Jump alignment. */ | |
2048 | "0:0:8", /* Label alignment. */ | |
2049 | "11", /* Func alignment. */ | |
64766e8d JH |
2050 | }; |
2051 | ||
2052 | static stringop_algs btver2_memcpy[2] = { | |
2053 | {libcall, {{6, loop, false}, {14, unrolled_loop, false}, | |
2054 | {-1, rep_prefix_4_byte, false}}}, | |
2055 | {libcall, {{16, loop, false}, {8192, rep_prefix_8_byte, false}, | |
2056 | {-1, libcall, false}}}}; | |
2057 | static stringop_algs btver2_memset[2] = { | |
2058 | {libcall, {{8, loop, false}, {24, unrolled_loop, false}, | |
2059 | {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
2060 | {libcall, {{48, unrolled_loop, false}, {8192, rep_prefix_8_byte, false}, | |
2061 | {-1, libcall, false}}}}; | |
2062 | const struct processor_costs btver2_cost = { | |
72bb85f8 | 2063 | { |
d321551c L |
2064 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
2065 | 8, /* cost for loading QImode using movzbl */ | |
2066 | {8, 8, 6}, /* cost of loading integer registers | |
2067 | in QImode, HImode and SImode. | |
2068 | Relative to reg-reg move (2). */ | |
2069 | {8, 8, 6}, /* cost of storing integer registers */ | |
2070 | 4, /* cost of reg,reg fld/fst */ | |
2071 | {12, 12, 28}, /* cost of loading fp registers | |
2072 | in SFmode, DFmode and XFmode */ | |
2073 | {12, 12, 38}, /* cost of storing fp registers | |
2074 | in SFmode, DFmode and XFmode */ | |
2075 | 4, /* cost of moving MMX register */ | |
2076 | {10, 10}, /* cost of loading MMX registers | |
2077 | in SImode and DImode */ | |
2078 | {12, 12}, /* cost of storing MMX registers | |
2079 | in SImode and DImode */ | |
2080 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
2081 | {10, 10, 12, 48, 96}, /* cost of loading SSE registers | |
2082 | in 32,64,128,256 and 512-bit */ | |
2083 | {10, 10, 12, 48, 96}, /* cost of storing SSE registers | |
2084 | in 32,64,128,256 and 512-bit */ | |
2085 | 14, 14, /* SSE->integer and integer->SSE moves */ | |
ecc3135a | 2086 | 14, 14, /* mask->integer and integer->mask moves */ |
00cb3494 L |
2087 | {8, 8, 6}, /* cost of loading mask register |
2088 | in QImode, HImode, SImode. */ | |
2089 | {8, 8, 6}, /* cost if storing mask register | |
2090 | in QImode, HImode, SImode. */ | |
2091 | 2, /* cost of moving mask register. */ | |
d321551c | 2092 | /* End of register allocator costs. */ |
72bb85f8 | 2093 | }, |
d321551c | 2094 | |
64766e8d JH |
2095 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
2096 | COSTS_N_INSNS (2), /* cost of a lea instruction */ | |
2097 | COSTS_N_INSNS (1), /* variable shift costs */ | |
2098 | COSTS_N_INSNS (1), /* constant shift costs */ | |
2099 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ | |
2100 | COSTS_N_INSNS (4), /* HI */ | |
2101 | COSTS_N_INSNS (3), /* SI */ | |
2102 | COSTS_N_INSNS (4), /* DI */ | |
2103 | COSTS_N_INSNS (5)}, /* other */ | |
2104 | 0, /* cost of multiply per each bit set */ | |
2105 | {COSTS_N_INSNS (19), /* cost of a divide/mod for QI */ | |
2106 | COSTS_N_INSNS (35), /* HI */ | |
2107 | COSTS_N_INSNS (51), /* SI */ | |
2108 | COSTS_N_INSNS (83), /* DI */ | |
2109 | COSTS_N_INSNS (83)}, /* other */ | |
2110 | COSTS_N_INSNS (1), /* cost of movsx */ | |
2111 | COSTS_N_INSNS (1), /* cost of movzx */ | |
2112 | 8, /* "large" insn */ | |
2113 | 9, /* MOVE_RATIO */ | |
25e22b19 | 2114 | 6, /* CLEAR_RATIO */ |
df41dbaf | 2115 | {8, 8, 6}, /* cost of loading integer registers |
64766e8d JH |
2116 | in QImode, HImode and SImode. |
2117 | Relative to reg-reg move (2). */ | |
df41dbaf | 2118 | {8, 8, 6}, /* cost of storing integer registers */ |
d321551c L |
2119 | {10, 10, 12, 48, 96}, /* cost of loading SSE register |
2120 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
2121 | {10, 10, 12, 48, 96}, /* cost of storing SSE register | |
2122 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
b7167993 | 2123 | {10, 10, 12, 48, 96}, /* cost of unaligned loads. */ |
b7167993 | 2124 | {10, 10, 12, 48, 96}, /* cost of unaligned stores. */ |
d321551c L |
2125 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
2126 | 14, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
2127 | 10, 10, /* Gather load static, per_elt. */ |
2128 | 10, 10, /* Gather store static, per_elt. */ | |
64766e8d JH |
2129 | 32, /* size of l1 cache. */ |
2130 | 2048, /* size of l2 cache. */ | |
2131 | 64, /* size of prefetch block */ | |
2132 | 100, /* number of parallel prefetches */ | |
2133 | 2, /* Branch cost */ | |
2134 | COSTS_N_INSNS (4), /* cost of FADD and FSUB insns. */ | |
2135 | COSTS_N_INSNS (4), /* cost of FMUL instruction. */ | |
2136 | COSTS_N_INSNS (19), /* cost of FDIV instruction. */ | |
2137 | COSTS_N_INSNS (2), /* cost of FABS instruction. */ | |
2138 | COSTS_N_INSNS (2), /* cost of FCHS instruction. */ | |
2139 | COSTS_N_INSNS (35), /* cost of FSQRT instruction. */ | |
6065f444 | 2140 | |
c53c148c | 2141 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
2142 | COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */ |
2143 | COSTS_N_INSNS (2), /* cost of MULSS instruction. */ | |
2144 | COSTS_N_INSNS (4), /* cost of MULSD instruction. */ | |
c53c148c JH |
2145 | COSTS_N_INSNS (5), /* cost of FMA SS instruction. */ |
2146 | COSTS_N_INSNS (5), /* cost of FMA SD instruction. */ | |
6065f444 JH |
2147 | COSTS_N_INSNS (13), /* cost of DIVSS instruction. */ |
2148 | COSTS_N_INSNS (19), /* cost of DIVSD instruction. */ | |
2149 | COSTS_N_INSNS (16), /* cost of SQRTSS instruction. */ | |
2150 | COSTS_N_INSNS (21), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
2151 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
2152 | btver2_memcpy, | |
2153 | btver2_memset, | |
f6fd8f2b JH |
2154 | COSTS_N_INSNS (2), /* cond_taken_branch_cost. */ |
2155 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
2156 | "16:11:8", /* Loop alignment. */ |
2157 | "16:8:8", /* Jump alignment. */ | |
2158 | "0:0:8", /* Label alignment. */ | |
2159 | "11", /* Func alignment. */ | |
64766e8d JH |
2160 | }; |
2161 | ||
2162 | static stringop_algs pentium4_memcpy[2] = { | |
2163 | {libcall, {{12, loop_1_byte, false}, {-1, rep_prefix_4_byte, false}}}, | |
2164 | DUMMY_STRINGOP_ALGS}; | |
2165 | static stringop_algs pentium4_memset[2] = { | |
2166 | {libcall, {{6, loop_1_byte, false}, {48, loop, false}, | |
2167 | {20480, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
2168 | DUMMY_STRINGOP_ALGS}; | |
2169 | ||
2170 | static const | |
2171 | struct processor_costs pentium4_cost = { | |
72bb85f8 | 2172 | { |
d321551c | 2173 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
df41dbaf | 2174 | 5, /* cost for loading QImode using movzbl */ |
64766e8d JH |
2175 | {4, 5, 4}, /* cost of loading integer registers |
2176 | in QImode, HImode and SImode. | |
2177 | Relative to reg-reg move (2). */ | |
2178 | {2, 3, 2}, /* cost of storing integer registers */ | |
df41dbaf JH |
2179 | 12, /* cost of reg,reg fld/fst */ |
2180 | {14, 14, 14}, /* cost of loading fp registers | |
64766e8d | 2181 | in SFmode, DFmode and XFmode */ |
df41dbaf | 2182 | {14, 14, 14}, /* cost of storing fp registers |
64766e8d | 2183 | in SFmode, DFmode and XFmode */ |
df41dbaf JH |
2184 | 12, /* cost of moving MMX register */ |
2185 | {16, 16}, /* cost of loading MMX registers | |
64766e8d | 2186 | in SImode and DImode */ |
df41dbaf | 2187 | {16, 16}, /* cost of storing MMX registers |
64766e8d | 2188 | in SImode and DImode */ |
df41dbaf JH |
2189 | 12, 24, 48, /* cost of moving XMM,YMM,ZMM register */ |
2190 | {16, 16, 16, 32, 64}, /* cost of loading SSE registers | |
2191 | in 32,64,128,256 and 512-bit */ | |
d321551c L |
2192 | {16, 16, 16, 32, 64}, /* cost of storing SSE registers |
2193 | in 32,64,128,256 and 512-bit */ | |
2194 | 20, 12, /* SSE->integer and integer->SSE moves */ | |
ecc3135a | 2195 | 20, 12, /* mask->integer and integer->mask moves */ |
00cb3494 L |
2196 | {4, 5, 4}, /* cost of loading mask register |
2197 | in QImode, HImode, SImode. */ | |
2198 | {2, 3, 2}, /* cost if storing mask register | |
2199 | in QImode, HImode, SImode. */ | |
2200 | 2, /* cost of moving mask register. */ | |
d321551c | 2201 | /* End of register allocator costs. */ |
72bb85f8 | 2202 | }, |
d321551c L |
2203 | |
2204 | COSTS_N_INSNS (1), /* cost of an add instruction */ | |
2205 | COSTS_N_INSNS (3), /* cost of a lea instruction */ | |
2206 | COSTS_N_INSNS (4), /* variable shift costs */ | |
2207 | COSTS_N_INSNS (4), /* constant shift costs */ | |
2208 | {COSTS_N_INSNS (15), /* cost of starting multiply for QI */ | |
2209 | COSTS_N_INSNS (15), /* HI */ | |
2210 | COSTS_N_INSNS (15), /* SI */ | |
2211 | COSTS_N_INSNS (15), /* DI */ | |
2212 | COSTS_N_INSNS (15)}, /* other */ | |
2213 | 0, /* cost of multiply per each bit set */ | |
2214 | {COSTS_N_INSNS (56), /* cost of a divide/mod for QI */ | |
2215 | COSTS_N_INSNS (56), /* HI */ | |
2216 | COSTS_N_INSNS (56), /* SI */ | |
2217 | COSTS_N_INSNS (56), /* DI */ | |
2218 | COSTS_N_INSNS (56)}, /* other */ | |
2219 | COSTS_N_INSNS (1), /* cost of movsx */ | |
2220 | COSTS_N_INSNS (1), /* cost of movzx */ | |
2221 | 16, /* "large" insn */ | |
2222 | 6, /* MOVE_RATIO */ | |
25e22b19 | 2223 | 6, /* CLEAR_RATIO */ |
d321551c L |
2224 | {4, 5, 4}, /* cost of loading integer registers |
2225 | in QImode, HImode and SImode. | |
2226 | Relative to reg-reg move (2). */ | |
2227 | {2, 3, 2}, /* cost of storing integer registers */ | |
2228 | {16, 16, 16, 32, 64}, /* cost of loading SSE register | |
2229 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
2230 | {16, 16, 16, 32, 64}, /* cost of storing SSE register | |
2231 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf | 2232 | {32, 32, 32, 64, 128}, /* cost of unaligned loads. */ |
df41dbaf | 2233 | {32, 32, 32, 64, 128}, /* cost of unaligned stores. */ |
d321551c L |
2234 | 12, 24, 48, /* cost of moving XMM,YMM,ZMM register */ |
2235 | 20, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
2236 | 16, 16, /* Gather load static, per_elt. */ |
2237 | 16, 16, /* Gather store static, per_elt. */ | |
64766e8d JH |
2238 | 8, /* size of l1 cache. */ |
2239 | 256, /* size of l2 cache. */ | |
2240 | 64, /* size of prefetch block */ | |
2241 | 6, /* number of parallel prefetches */ | |
2242 | 2, /* Branch cost */ | |
2243 | COSTS_N_INSNS (5), /* cost of FADD and FSUB insns. */ | |
2244 | COSTS_N_INSNS (7), /* cost of FMUL instruction. */ | |
2245 | COSTS_N_INSNS (43), /* cost of FDIV instruction. */ | |
2246 | COSTS_N_INSNS (2), /* cost of FABS instruction. */ | |
2247 | COSTS_N_INSNS (2), /* cost of FCHS instruction. */ | |
2248 | COSTS_N_INSNS (43), /* cost of FSQRT instruction. */ | |
6065f444 | 2249 | |
c53c148c | 2250 | COSTS_N_INSNS (2), /* cost of cheap SSE instruction. */ |
6065f444 JH |
2251 | COSTS_N_INSNS (4), /* cost of ADDSS/SD SUBSS/SD insns. */ |
2252 | COSTS_N_INSNS (6), /* cost of MULSS instruction. */ | |
2253 | COSTS_N_INSNS (6), /* cost of MULSD instruction. */ | |
c53c148c JH |
2254 | COSTS_N_INSNS (6), /* cost of FMA SS instruction. */ |
2255 | COSTS_N_INSNS (6), /* cost of FMA SD instruction. */ | |
6065f444 JH |
2256 | COSTS_N_INSNS (23), /* cost of DIVSS instruction. */ |
2257 | COSTS_N_INSNS (38), /* cost of DIVSD instruction. */ | |
2258 | COSTS_N_INSNS (23), /* cost of SQRTSS instruction. */ | |
2259 | COSTS_N_INSNS (38), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
2260 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
2261 | pentium4_memcpy, | |
2262 | pentium4_memset, | |
f6fd8f2b JH |
2263 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
2264 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
2265 | NULL, /* Loop alignment. */ |
2266 | NULL, /* Jump alignment. */ | |
2267 | NULL, /* Label alignment. */ | |
2268 | NULL, /* Func alignment. */ | |
64766e8d JH |
2269 | }; |
2270 | ||
2271 | static stringop_algs nocona_memcpy[2] = { | |
2272 | {libcall, {{12, loop_1_byte, false}, {-1, rep_prefix_4_byte, false}}}, | |
2273 | {libcall, {{32, loop, false}, {20000, rep_prefix_8_byte, false}, | |
2274 | {100000, unrolled_loop, false}, {-1, libcall, false}}}}; | |
2275 | ||
2276 | static stringop_algs nocona_memset[2] = { | |
2277 | {libcall, {{6, loop_1_byte, false}, {48, loop, false}, | |
2278 | {20480, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
2279 | {libcall, {{24, loop, false}, {64, unrolled_loop, false}, | |
2280 | {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}}; | |
2281 | ||
2282 | static const | |
2283 | struct processor_costs nocona_cost = { | |
72bb85f8 | 2284 | { |
d321551c L |
2285 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
2286 | 4, /* cost for loading QImode using movzbl */ | |
2287 | {4, 4, 4}, /* cost of loading integer registers | |
2288 | in QImode, HImode and SImode. | |
2289 | Relative to reg-reg move (2). */ | |
2290 | {4, 4, 4}, /* cost of storing integer registers */ | |
2291 | 12, /* cost of reg,reg fld/fst */ | |
2292 | {14, 14, 14}, /* cost of loading fp registers | |
2293 | in SFmode, DFmode and XFmode */ | |
2294 | {14, 14, 14}, /* cost of storing fp registers | |
2295 | in SFmode, DFmode and XFmode */ | |
2296 | 14, /* cost of moving MMX register */ | |
2297 | {12, 12}, /* cost of loading MMX registers | |
2298 | in SImode and DImode */ | |
2299 | {12, 12}, /* cost of storing MMX registers | |
2300 | in SImode and DImode */ | |
2301 | 6, 12, 24, /* cost of moving XMM,YMM,ZMM register */ | |
2302 | {12, 12, 12, 24, 48}, /* cost of loading SSE registers | |
2303 | in 32,64,128,256 and 512-bit */ | |
2304 | {12, 12, 12, 24, 48}, /* cost of storing SSE registers | |
2305 | in 32,64,128,256 and 512-bit */ | |
2306 | 20, 12, /* SSE->integer and integer->SSE moves */ | |
ecc3135a | 2307 | 20, 12, /* mask->integer and integer->mask moves */ |
00cb3494 L |
2308 | {4, 4, 4}, /* cost of loading mask register |
2309 | in QImode, HImode, SImode. */ | |
2310 | {4, 4, 4}, /* cost if storing mask register | |
2311 | in QImode, HImode, SImode. */ | |
2312 | 2, /* cost of moving mask register. */ | |
d321551c | 2313 | /* End of register allocator costs. */ |
72bb85f8 | 2314 | }, |
d321551c | 2315 | |
64766e8d JH |
2316 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
2317 | COSTS_N_INSNS (1), /* cost of a lea instruction */ | |
2318 | COSTS_N_INSNS (1), /* variable shift costs */ | |
2319 | COSTS_N_INSNS (1), /* constant shift costs */ | |
2320 | {COSTS_N_INSNS (10), /* cost of starting multiply for QI */ | |
2321 | COSTS_N_INSNS (10), /* HI */ | |
2322 | COSTS_N_INSNS (10), /* SI */ | |
2323 | COSTS_N_INSNS (10), /* DI */ | |
2324 | COSTS_N_INSNS (10)}, /* other */ | |
2325 | 0, /* cost of multiply per each bit set */ | |
2326 | {COSTS_N_INSNS (66), /* cost of a divide/mod for QI */ | |
2327 | COSTS_N_INSNS (66), /* HI */ | |
2328 | COSTS_N_INSNS (66), /* SI */ | |
2329 | COSTS_N_INSNS (66), /* DI */ | |
2330 | COSTS_N_INSNS (66)}, /* other */ | |
2331 | COSTS_N_INSNS (1), /* cost of movsx */ | |
2332 | COSTS_N_INSNS (1), /* cost of movzx */ | |
2333 | 16, /* "large" insn */ | |
2334 | 17, /* MOVE_RATIO */ | |
25e22b19 | 2335 | 6, /* CLEAR_RATIO */ |
64766e8d JH |
2336 | {4, 4, 4}, /* cost of loading integer registers |
2337 | in QImode, HImode and SImode. | |
2338 | Relative to reg-reg move (2). */ | |
2339 | {4, 4, 4}, /* cost of storing integer registers */ | |
d321551c L |
2340 | {12, 12, 12, 24, 48}, /* cost of loading SSE register |
2341 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
2342 | {12, 12, 12, 24, 48}, /* cost of storing SSE register | |
2343 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf | 2344 | {24, 24, 24, 48, 96}, /* cost of unaligned loads. */ |
df41dbaf | 2345 | {24, 24, 24, 48, 96}, /* cost of unaligned stores. */ |
d321551c L |
2346 | 6, 12, 24, /* cost of moving XMM,YMM,ZMM register */ |
2347 | 20, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
2348 | 12, 12, /* Gather load static, per_elt. */ |
2349 | 12, 12, /* Gather store static, per_elt. */ | |
64766e8d JH |
2350 | 8, /* size of l1 cache. */ |
2351 | 1024, /* size of l2 cache. */ | |
2352 | 64, /* size of prefetch block */ | |
2353 | 8, /* number of parallel prefetches */ | |
2354 | 1, /* Branch cost */ | |
2355 | COSTS_N_INSNS (6), /* cost of FADD and FSUB insns. */ | |
2356 | COSTS_N_INSNS (8), /* cost of FMUL instruction. */ | |
2357 | COSTS_N_INSNS (40), /* cost of FDIV instruction. */ | |
2358 | COSTS_N_INSNS (3), /* cost of FABS instruction. */ | |
2359 | COSTS_N_INSNS (3), /* cost of FCHS instruction. */ | |
2360 | COSTS_N_INSNS (44), /* cost of FSQRT instruction. */ | |
6065f444 | 2361 | |
c53c148c | 2362 | COSTS_N_INSNS (2), /* cost of cheap SSE instruction. */ |
6065f444 JH |
2363 | COSTS_N_INSNS (5), /* cost of ADDSS/SD SUBSS/SD insns. */ |
2364 | COSTS_N_INSNS (7), /* cost of MULSS instruction. */ | |
2365 | COSTS_N_INSNS (7), /* cost of MULSD instruction. */ | |
c53c148c JH |
2366 | COSTS_N_INSNS (7), /* cost of FMA SS instruction. */ |
2367 | COSTS_N_INSNS (7), /* cost of FMA SD instruction. */ | |
6065f444 JH |
2368 | COSTS_N_INSNS (32), /* cost of DIVSS instruction. */ |
2369 | COSTS_N_INSNS (40), /* cost of DIVSD instruction. */ | |
2370 | COSTS_N_INSNS (32), /* cost of SQRTSS instruction. */ | |
2371 | COSTS_N_INSNS (41), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
2372 | 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
2373 | nocona_memcpy, | |
2374 | nocona_memset, | |
f6fd8f2b JH |
2375 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
2376 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
2377 | NULL, /* Loop alignment. */ |
2378 | NULL, /* Jump alignment. */ | |
2379 | NULL, /* Label alignment. */ | |
2380 | NULL, /* Func alignment. */ | |
64766e8d JH |
2381 | }; |
2382 | ||
2383 | static stringop_algs atom_memcpy[2] = { | |
2384 | {libcall, {{11, loop, false}, {-1, rep_prefix_4_byte, false}}}, | |
2385 | {libcall, {{32, loop, false}, {64, rep_prefix_4_byte, false}, | |
2386 | {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}}; | |
2387 | static stringop_algs atom_memset[2] = { | |
2388 | {libcall, {{8, loop, false}, {15, unrolled_loop, false}, | |
2389 | {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
2390 | {libcall, {{24, loop, false}, {32, unrolled_loop, false}, | |
2391 | {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}}; | |
2392 | static const | |
2393 | struct processor_costs atom_cost = { | |
72bb85f8 | 2394 | { |
d321551c L |
2395 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
2396 | 6, /* cost for loading QImode using movzbl */ | |
2397 | {6, 6, 6}, /* cost of loading integer registers | |
2398 | in QImode, HImode and SImode. | |
2399 | Relative to reg-reg move (2). */ | |
2400 | {6, 6, 6}, /* cost of storing integer registers */ | |
2401 | 4, /* cost of reg,reg fld/fst */ | |
2402 | {6, 6, 18}, /* cost of loading fp registers | |
2403 | in SFmode, DFmode and XFmode */ | |
2404 | {14, 14, 24}, /* cost of storing fp registers | |
2405 | in SFmode, DFmode and XFmode */ | |
2406 | 2, /* cost of moving MMX register */ | |
2407 | {8, 8}, /* cost of loading MMX registers | |
2408 | in SImode and DImode */ | |
2409 | {10, 10}, /* cost of storing MMX registers | |
2410 | in SImode and DImode */ | |
2411 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
2412 | {8, 8, 8, 16, 32}, /* cost of loading SSE registers | |
2413 | in 32,64,128,256 and 512-bit */ | |
2414 | {8, 8, 8, 16, 32}, /* cost of storing SSE registers | |
2415 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 2416 | 8, 6, /* SSE->integer and integer->SSE moves */ |
2417 | 8, 6, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
2418 | {6, 6, 6}, /* cost of loading mask register |
2419 | in QImode, HImode, SImode. */ | |
2420 | {6, 6, 6}, /* cost if storing mask register | |
2421 | in QImode, HImode, SImode. */ | |
2422 | 2, /* cost of moving mask register. */ | |
d321551c | 2423 | /* End of register allocator costs. */ |
72bb85f8 | 2424 | }, |
d321551c | 2425 | |
64766e8d JH |
2426 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
2427 | COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */ | |
2428 | COSTS_N_INSNS (1), /* variable shift costs */ | |
2429 | COSTS_N_INSNS (1), /* constant shift costs */ | |
2430 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ | |
2431 | COSTS_N_INSNS (4), /* HI */ | |
2432 | COSTS_N_INSNS (3), /* SI */ | |
2433 | COSTS_N_INSNS (4), /* DI */ | |
2434 | COSTS_N_INSNS (2)}, /* other */ | |
2435 | 0, /* cost of multiply per each bit set */ | |
2436 | {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */ | |
2437 | COSTS_N_INSNS (26), /* HI */ | |
2438 | COSTS_N_INSNS (42), /* SI */ | |
2439 | COSTS_N_INSNS (74), /* DI */ | |
2440 | COSTS_N_INSNS (74)}, /* other */ | |
2441 | COSTS_N_INSNS (1), /* cost of movsx */ | |
2442 | COSTS_N_INSNS (1), /* cost of movzx */ | |
2443 | 8, /* "large" insn */ | |
2444 | 17, /* MOVE_RATIO */ | |
25e22b19 | 2445 | 6, /* CLEAR_RATIO */ |
df41dbaf | 2446 | {6, 6, 6}, /* cost of loading integer registers |
64766e8d JH |
2447 | in QImode, HImode and SImode. |
2448 | Relative to reg-reg move (2). */ | |
df41dbaf | 2449 | {6, 6, 6}, /* cost of storing integer registers */ |
d321551c L |
2450 | {8, 8, 8, 16, 32}, /* cost of loading SSE register |
2451 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
2452 | {8, 8, 8, 16, 32}, /* cost of storing SSE register | |
2453 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf | 2454 | {16, 16, 16, 32, 64}, /* cost of unaligned loads. */ |
df41dbaf | 2455 | {16, 16, 16, 32, 64}, /* cost of unaligned stores. */ |
d321551c L |
2456 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
2457 | 8, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
2458 | 8, 8, /* Gather load static, per_elt. */ |
2459 | 8, 8, /* Gather store static, per_elt. */ | |
64766e8d JH |
2460 | 32, /* size of l1 cache. */ |
2461 | 256, /* size of l2 cache. */ | |
2462 | 64, /* size of prefetch block */ | |
2463 | 6, /* number of parallel prefetches */ | |
2464 | 3, /* Branch cost */ | |
2465 | COSTS_N_INSNS (8), /* cost of FADD and FSUB insns. */ | |
2466 | COSTS_N_INSNS (8), /* cost of FMUL instruction. */ | |
2467 | COSTS_N_INSNS (20), /* cost of FDIV instruction. */ | |
2468 | COSTS_N_INSNS (8), /* cost of FABS instruction. */ | |
2469 | COSTS_N_INSNS (8), /* cost of FCHS instruction. */ | |
2470 | COSTS_N_INSNS (40), /* cost of FSQRT instruction. */ | |
6065f444 | 2471 | |
c53c148c | 2472 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
2473 | COSTS_N_INSNS (5), /* cost of ADDSS/SD SUBSS/SD insns. */ |
2474 | COSTS_N_INSNS (4), /* cost of MULSS instruction. */ | |
2475 | COSTS_N_INSNS (5), /* cost of MULSD instruction. */ | |
c53c148c JH |
2476 | COSTS_N_INSNS (6), /* cost of FMA SS instruction. */ |
2477 | COSTS_N_INSNS (6), /* cost of FMA SD instruction. */ | |
6065f444 JH |
2478 | COSTS_N_INSNS (31), /* cost of DIVSS instruction. */ |
2479 | COSTS_N_INSNS (60), /* cost of DIVSD instruction. */ | |
2480 | COSTS_N_INSNS (31), /* cost of SQRTSS instruction. */ | |
2481 | COSTS_N_INSNS (63), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
2482 | 2, 2, 2, 2, /* reassoc int, fp, vec_int, vec_fp. */ |
2483 | atom_memcpy, | |
2484 | atom_memset, | |
f6fd8f2b JH |
2485 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
2486 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
2487 | "16", /* Loop alignment. */ |
2488 | "16:8:8", /* Jump alignment. */ | |
2489 | "0:0:8", /* Label alignment. */ | |
2490 | "16", /* Func alignment. */ | |
64766e8d JH |
2491 | }; |
2492 | ||
2493 | static stringop_algs slm_memcpy[2] = { | |
2494 | {libcall, {{11, loop, false}, {-1, rep_prefix_4_byte, false}}}, | |
2495 | {libcall, {{32, loop, false}, {64, rep_prefix_4_byte, false}, | |
2496 | {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}}; | |
2497 | static stringop_algs slm_memset[2] = { | |
2498 | {libcall, {{8, loop, false}, {15, unrolled_loop, false}, | |
2499 | {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
2500 | {libcall, {{24, loop, false}, {32, unrolled_loop, false}, | |
2501 | {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}}; | |
2502 | static const | |
2503 | struct processor_costs slm_cost = { | |
72bb85f8 | 2504 | { |
d321551c L |
2505 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
2506 | 8, /* cost for loading QImode using movzbl */ | |
2507 | {8, 8, 8}, /* cost of loading integer registers | |
2508 | in QImode, HImode and SImode. | |
2509 | Relative to reg-reg move (2). */ | |
2510 | {6, 6, 6}, /* cost of storing integer registers */ | |
2511 | 2, /* cost of reg,reg fld/fst */ | |
2512 | {8, 8, 18}, /* cost of loading fp registers | |
2513 | in SFmode, DFmode and XFmode */ | |
2514 | {6, 6, 18}, /* cost of storing fp registers | |
2515 | in SFmode, DFmode and XFmode */ | |
2516 | 2, /* cost of moving MMX register */ | |
2517 | {8, 8}, /* cost of loading MMX registers | |
2518 | in SImode and DImode */ | |
2519 | {6, 6}, /* cost of storing MMX registers | |
2520 | in SImode and DImode */ | |
2521 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ | |
2522 | {8, 8, 8, 16, 32}, /* cost of loading SSE registers | |
2523 | in 32,64,128,256 and 512-bit */ | |
2524 | {8, 8, 8, 16, 32}, /* cost of storing SSE registers | |
2525 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 2526 | 8, 6, /* SSE->integer and integer->SSE moves */ |
2527 | 8, 6, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
2528 | {8, 8, 8}, /* cost of loading mask register |
2529 | in QImode, HImode, SImode. */ | |
2530 | {6, 6, 6}, /* cost if storing mask register | |
2531 | in QImode, HImode, SImode. */ | |
2532 | 2, /* cost of moving mask register. */ | |
d321551c | 2533 | /* End of register allocator costs. */ |
72bb85f8 | 2534 | }, |
d321551c | 2535 | |
64766e8d JH |
2536 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
2537 | COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */ | |
2538 | COSTS_N_INSNS (1), /* variable shift costs */ | |
2539 | COSTS_N_INSNS (1), /* constant shift costs */ | |
2540 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ | |
2541 | COSTS_N_INSNS (3), /* HI */ | |
2542 | COSTS_N_INSNS (3), /* SI */ | |
2543 | COSTS_N_INSNS (4), /* DI */ | |
2544 | COSTS_N_INSNS (2)}, /* other */ | |
2545 | 0, /* cost of multiply per each bit set */ | |
2546 | {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */ | |
2547 | COSTS_N_INSNS (26), /* HI */ | |
2548 | COSTS_N_INSNS (42), /* SI */ | |
2549 | COSTS_N_INSNS (74), /* DI */ | |
2550 | COSTS_N_INSNS (74)}, /* other */ | |
2551 | COSTS_N_INSNS (1), /* cost of movsx */ | |
2552 | COSTS_N_INSNS (1), /* cost of movzx */ | |
2553 | 8, /* "large" insn */ | |
2554 | 17, /* MOVE_RATIO */ | |
25e22b19 | 2555 | 6, /* CLEAR_RATIO */ |
df41dbaf | 2556 | {8, 8, 8}, /* cost of loading integer registers |
64766e8d JH |
2557 | in QImode, HImode and SImode. |
2558 | Relative to reg-reg move (2). */ | |
df41dbaf | 2559 | {6, 6, 6}, /* cost of storing integer registers */ |
d321551c L |
2560 | {8, 8, 8, 16, 32}, /* cost of loading SSE register |
2561 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
2562 | {8, 8, 8, 16, 32}, /* cost of storing SSE register | |
2563 | in SImode, DImode and TImode. */ | |
df41dbaf | 2564 | {16, 16, 16, 32, 64}, /* cost of unaligned loads. */ |
df41dbaf | 2565 | {16, 16, 16, 32, 64}, /* cost of unaligned stores. */ |
d321551c L |
2566 | 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */ |
2567 | 8, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
2568 | 8, 8, /* Gather load static, per_elt. */ |
2569 | 8, 8, /* Gather store static, per_elt. */ | |
64766e8d JH |
2570 | 32, /* size of l1 cache. */ |
2571 | 256, /* size of l2 cache. */ | |
2572 | 64, /* size of prefetch block */ | |
2573 | 6, /* number of parallel prefetches */ | |
2574 | 3, /* Branch cost */ | |
2575 | COSTS_N_INSNS (8), /* cost of FADD and FSUB insns. */ | |
2576 | COSTS_N_INSNS (8), /* cost of FMUL instruction. */ | |
2577 | COSTS_N_INSNS (20), /* cost of FDIV instruction. */ | |
2578 | COSTS_N_INSNS (8), /* cost of FABS instruction. */ | |
2579 | COSTS_N_INSNS (8), /* cost of FCHS instruction. */ | |
2580 | COSTS_N_INSNS (40), /* cost of FSQRT instruction. */ | |
6065f444 | 2581 | |
c53c148c | 2582 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
2583 | COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */ |
2584 | COSTS_N_INSNS (4), /* cost of MULSS instruction. */ | |
2585 | COSTS_N_INSNS (5), /* cost of MULSD instruction. */ | |
c53c148c JH |
2586 | COSTS_N_INSNS (6), /* cost of FMA SS instruction. */ |
2587 | COSTS_N_INSNS (6), /* cost of FMA SD instruction. */ | |
6065f444 JH |
2588 | COSTS_N_INSNS (39), /* cost of DIVSS instruction. */ |
2589 | COSTS_N_INSNS (69), /* cost of DIVSD instruction. */ | |
2590 | COSTS_N_INSNS (20), /* cost of SQRTSS instruction. */ | |
2591 | COSTS_N_INSNS (35), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
2592 | 1, 2, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
2593 | slm_memcpy, | |
2594 | slm_memset, | |
f6fd8f2b JH |
2595 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
2596 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
2597 | "16", /* Loop alignment. */ |
2598 | "16:8:8", /* Jump alignment. */ | |
2599 | "0:0:8", /* Label alignment. */ | |
2600 | "16", /* Func alignment. */ | |
64766e8d JH |
2601 | }; |
2602 | ||
2603 | static stringop_algs intel_memcpy[2] = { | |
2604 | {libcall, {{11, loop, false}, {-1, rep_prefix_4_byte, false}}}, | |
2605 | {libcall, {{32, loop, false}, {64, rep_prefix_4_byte, false}, | |
2606 | {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}}; | |
2607 | static stringop_algs intel_memset[2] = { | |
2608 | {libcall, {{8, loop, false}, {15, unrolled_loop, false}, | |
2609 | {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}}, | |
2610 | {libcall, {{24, loop, false}, {32, unrolled_loop, false}, | |
2611 | {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}}; | |
2612 | static const | |
2613 | struct processor_costs intel_cost = { | |
72bb85f8 | 2614 | { |
d321551c L |
2615 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
2616 | 6, /* cost for loading QImode using movzbl */ | |
2617 | {4, 4, 4}, /* cost of loading integer registers | |
2618 | in QImode, HImode and SImode. | |
2619 | Relative to reg-reg move (2). */ | |
2620 | {6, 6, 6}, /* cost of storing integer registers */ | |
2621 | 2, /* cost of reg,reg fld/fst */ | |
2622 | {6, 6, 8}, /* cost of loading fp registers | |
2623 | in SFmode, DFmode and XFmode */ | |
2624 | {6, 6, 10}, /* cost of storing fp registers | |
2625 | in SFmode, DFmode and XFmode */ | |
2626 | 2, /* cost of moving MMX register */ | |
2627 | {6, 6}, /* cost of loading MMX registers | |
2628 | in SImode and DImode */ | |
2629 | {6, 6}, /* cost of storing MMX registers | |
2630 | in SImode and DImode */ | |
2631 | 2, 2, 2, /* cost of moving XMM,YMM,ZMM register */ | |
2632 | {6, 6, 6, 6, 6}, /* cost of loading SSE registers | |
2633 | in 32,64,128,256 and 512-bit */ | |
2634 | {6, 6, 6, 6, 6}, /* cost of storing SSE registers | |
2635 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 2636 | 4, 4, /* SSE->integer and integer->SSE moves */ |
2637 | 4, 4, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
2638 | {4, 4, 4}, /* cost of loading mask register |
2639 | in QImode, HImode, SImode. */ | |
2640 | {6, 6, 6}, /* cost if storing mask register | |
2641 | in QImode, HImode, SImode. */ | |
2642 | 2, /* cost of moving mask register. */ | |
d321551c | 2643 | /* End of register allocator costs. */ |
72bb85f8 | 2644 | }, |
d321551c | 2645 | |
64766e8d JH |
2646 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
2647 | COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */ | |
2648 | COSTS_N_INSNS (1), /* variable shift costs */ | |
2649 | COSTS_N_INSNS (1), /* constant shift costs */ | |
2650 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ | |
2651 | COSTS_N_INSNS (3), /* HI */ | |
2652 | COSTS_N_INSNS (3), /* SI */ | |
2653 | COSTS_N_INSNS (4), /* DI */ | |
2654 | COSTS_N_INSNS (2)}, /* other */ | |
2655 | 0, /* cost of multiply per each bit set */ | |
2656 | {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */ | |
2657 | COSTS_N_INSNS (26), /* HI */ | |
2658 | COSTS_N_INSNS (42), /* SI */ | |
2659 | COSTS_N_INSNS (74), /* DI */ | |
2660 | COSTS_N_INSNS (74)}, /* other */ | |
2661 | COSTS_N_INSNS (1), /* cost of movsx */ | |
2662 | COSTS_N_INSNS (1), /* cost of movzx */ | |
2663 | 8, /* "large" insn */ | |
2664 | 17, /* MOVE_RATIO */ | |
25e22b19 | 2665 | 6, /* CLEAR_RATIO */ |
64766e8d JH |
2666 | {4, 4, 4}, /* cost of loading integer registers |
2667 | in QImode, HImode and SImode. | |
2668 | Relative to reg-reg move (2). */ | |
af863030 | 2669 | {6, 6, 6}, /* cost of storing integer registers */ |
d321551c L |
2670 | {6, 6, 6, 6, 6}, /* cost of loading SSE register |
2671 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
2672 | {6, 6, 6, 6, 6}, /* cost of storing SSE register | |
2673 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf | 2674 | {10, 10, 10, 10, 10}, /* cost of unaligned loads. */ |
df41dbaf | 2675 | {10, 10, 10, 10, 10}, /* cost of unaligned loads. */ |
d321551c L |
2676 | 2, 2, 2, /* cost of moving XMM,YMM,ZMM register */ |
2677 | 4, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
2678 | 6, 6, /* Gather load static, per_elt. */ |
2679 | 6, 6, /* Gather store static, per_elt. */ | |
64766e8d JH |
2680 | 32, /* size of l1 cache. */ |
2681 | 256, /* size of l2 cache. */ | |
2682 | 64, /* size of prefetch block */ | |
2683 | 6, /* number of parallel prefetches */ | |
2684 | 3, /* Branch cost */ | |
2685 | COSTS_N_INSNS (8), /* cost of FADD and FSUB insns. */ | |
2686 | COSTS_N_INSNS (8), /* cost of FMUL instruction. */ | |
2687 | COSTS_N_INSNS (20), /* cost of FDIV instruction. */ | |
2688 | COSTS_N_INSNS (8), /* cost of FABS instruction. */ | |
2689 | COSTS_N_INSNS (8), /* cost of FCHS instruction. */ | |
2690 | COSTS_N_INSNS (40), /* cost of FSQRT instruction. */ | |
6065f444 | 2691 | |
3ff59baa | 2692 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
2693 | COSTS_N_INSNS (8), /* cost of ADDSS/SD SUBSS/SD insns. */ |
2694 | COSTS_N_INSNS (8), /* cost of MULSS instruction. */ | |
2695 | COSTS_N_INSNS (8), /* cost of MULSD instruction. */ | |
c53c148c JH |
2696 | COSTS_N_INSNS (6), /* cost of FMA SS instruction. */ |
2697 | COSTS_N_INSNS (6), /* cost of FMA SD instruction. */ | |
6065f444 JH |
2698 | COSTS_N_INSNS (20), /* cost of DIVSS instruction. */ |
2699 | COSTS_N_INSNS (20), /* cost of DIVSD instruction. */ | |
2700 | COSTS_N_INSNS (40), /* cost of SQRTSS instruction. */ | |
2701 | COSTS_N_INSNS (40), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
2702 | 1, 4, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */ |
2703 | intel_memcpy, | |
2704 | intel_memset, | |
f6fd8f2b JH |
2705 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
2706 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
2707 | "16", /* Loop alignment. */ |
2708 | "16:8:8", /* Jump alignment. */ | |
2709 | "0:0:8", /* Label alignment. */ | |
2710 | "16", /* Func alignment. */ | |
64766e8d JH |
2711 | }; |
2712 | ||
2713 | /* Generic should produce code tuned for Core-i7 (and newer chips) | |
2714 | and btver1 (and newer chips). */ | |
2715 | ||
2716 | static stringop_algs generic_memcpy[2] = { | |
2717 | {libcall, {{32, loop, false}, {8192, rep_prefix_4_byte, false}, | |
2718 | {-1, libcall, false}}}, | |
2719 | {libcall, {{32, loop, false}, {8192, rep_prefix_8_byte, false}, | |
2720 | {-1, libcall, false}}}}; | |
2721 | static stringop_algs generic_memset[2] = { | |
2722 | {libcall, {{32, loop, false}, {8192, rep_prefix_4_byte, false}, | |
2723 | {-1, libcall, false}}}, | |
2724 | {libcall, {{32, loop, false}, {8192, rep_prefix_8_byte, false}, | |
2725 | {-1, libcall, false}}}}; | |
2726 | static const | |
2727 | struct processor_costs generic_cost = { | |
72bb85f8 | 2728 | { |
d321551c L |
2729 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
2730 | 6, /* cost for loading QImode using movzbl */ | |
2731 | {6, 6, 6}, /* cost of loading integer registers | |
2732 | in QImode, HImode and SImode. | |
2733 | Relative to reg-reg move (2). */ | |
2734 | {6, 6, 6}, /* cost of storing integer registers */ | |
2735 | 4, /* cost of reg,reg fld/fst */ | |
2736 | {6, 6, 12}, /* cost of loading fp registers | |
2737 | in SFmode, DFmode and XFmode */ | |
2738 | {6, 6, 12}, /* cost of storing fp registers | |
2739 | in SFmode, DFmode and XFmode */ | |
2740 | 2, /* cost of moving MMX register */ | |
2741 | {6, 6}, /* cost of loading MMX registers | |
2742 | in SImode and DImode */ | |
2743 | {6, 6}, /* cost of storing MMX registers | |
2744 | in SImode and DImode */ | |
2745 | 2, 3, 4, /* cost of moving XMM,YMM,ZMM register */ | |
2746 | {6, 6, 6, 10, 15}, /* cost of loading SSE registers | |
2747 | in 32,64,128,256 and 512-bit */ | |
2748 | {6, 6, 6, 10, 15}, /* cost of storing SSE registers | |
2749 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 2750 | 6, 6, /* SSE->integer and integer->SSE moves */ |
2751 | 6, 6, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
2752 | {6, 6, 6}, /* cost of loading mask register |
2753 | in QImode, HImode, SImode. */ | |
2754 | {6, 6, 6}, /* cost if storing mask register | |
2755 | in QImode, HImode, SImode. */ | |
2756 | 2, /* cost of moving mask register. */ | |
d321551c | 2757 | /* End of register allocator costs. */ |
72bb85f8 | 2758 | }, |
d321551c | 2759 | |
64766e8d | 2760 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
ef9eec0b | 2761 | /* Setting cost to 2 makes our current implementation of synth_mult result in |
64766e8d JH |
2762 | use of unnecessary temporary registers causing regression on several |
2763 | SPECfp benchmarks. */ | |
2764 | COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */ | |
2765 | COSTS_N_INSNS (1), /* variable shift costs */ | |
2766 | COSTS_N_INSNS (1), /* constant shift costs */ | |
2767 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ | |
2768 | COSTS_N_INSNS (4), /* HI */ | |
2769 | COSTS_N_INSNS (3), /* SI */ | |
2770 | COSTS_N_INSNS (4), /* DI */ | |
7c080ade | 2771 | COSTS_N_INSNS (4)}, /* other */ |
64766e8d | 2772 | 0, /* cost of multiply per each bit set */ |
7c080ade JH |
2773 | {COSTS_N_INSNS (16), /* cost of a divide/mod for QI */ |
2774 | COSTS_N_INSNS (22), /* HI */ | |
2775 | COSTS_N_INSNS (30), /* SI */ | |
64766e8d JH |
2776 | COSTS_N_INSNS (74), /* DI */ |
2777 | COSTS_N_INSNS (74)}, /* other */ | |
2778 | COSTS_N_INSNS (1), /* cost of movsx */ | |
2779 | COSTS_N_INSNS (1), /* cost of movzx */ | |
2780 | 8, /* "large" insn */ | |
2781 | 17, /* MOVE_RATIO */ | |
25e22b19 | 2782 | 6, /* CLEAR_RATIO */ |
d555138e | 2783 | {6, 6, 6}, /* cost of loading integer registers |
64766e8d JH |
2784 | in QImode, HImode and SImode. |
2785 | Relative to reg-reg move (2). */ | |
af863030 | 2786 | {6, 6, 6}, /* cost of storing integer registers */ |
d321551c L |
2787 | {6, 6, 6, 10, 15}, /* cost of loading SSE register |
2788 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
2789 | {6, 6, 6, 10, 15}, /* cost of storing SSE register | |
2790 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
7c080ade | 2791 | {6, 6, 6, 10, 15}, /* cost of unaligned loads. */ |
7c080ade | 2792 | {6, 6, 6, 10, 15}, /* cost of unaligned storess. */ |
d321551c L |
2793 | 2, 3, 4, /* cost of moving XMM,YMM,ZMM register */ |
2794 | 6, /* cost of moving SSE register to integer. */ | |
7c080ade JH |
2795 | 18, 6, /* Gather load static, per_elt. */ |
2796 | 18, 6, /* Gather store static, per_elt. */ | |
64766e8d JH |
2797 | 32, /* size of l1 cache. */ |
2798 | 512, /* size of l2 cache. */ | |
2799 | 64, /* size of prefetch block */ | |
2800 | 6, /* number of parallel prefetches */ | |
2801 | /* Benchmarks shows large regressions on K8 sixtrack benchmark when this | |
2802 | value is increased to perhaps more appropriate value of 5. */ | |
2803 | 3, /* Branch cost */ | |
ef9eec0b | 2804 | COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */ |
7c080ade | 2805 | COSTS_N_INSNS (5), /* cost of FMUL instruction. */ |
e8e3054e | 2806 | COSTS_N_INSNS (17), /* cost of FDIV instruction. */ |
ef9eec0b JH |
2807 | COSTS_N_INSNS (1), /* cost of FABS instruction. */ |
2808 | COSTS_N_INSNS (1), /* cost of FCHS instruction. */ | |
e8e3054e | 2809 | COSTS_N_INSNS (14), /* cost of FSQRT instruction. */ |
6065f444 | 2810 | |
ef9eec0b JH |
2811 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
2812 | COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */ | |
2813 | COSTS_N_INSNS (4), /* cost of MULSS instruction. */ | |
2814 | COSTS_N_INSNS (5), /* cost of MULSD instruction. */ | |
2815 | COSTS_N_INSNS (5), /* cost of FMA SS instruction. */ | |
2816 | COSTS_N_INSNS (5), /* cost of FMA SD instruction. */ | |
e8e3054e JH |
2817 | COSTS_N_INSNS (13), /* cost of DIVSS instruction. */ |
2818 | COSTS_N_INSNS (17), /* cost of DIVSD instruction. */ | |
2819 | COSTS_N_INSNS (14), /* cost of SQRTSS instruction. */ | |
2820 | COSTS_N_INSNS (18), /* cost of SQRTSD instruction. */ | |
7c080ade | 2821 | 1, 4, 3, 3, /* reassoc int, fp, vec_int, vec_fp. */ |
64766e8d JH |
2822 | generic_memcpy, |
2823 | generic_memset, | |
e8e3054e JH |
2824 | COSTS_N_INSNS (4), /* cond_taken_branch_cost. */ |
2825 | COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
2826 | "16:11:8", /* Loop alignment. */ |
2827 | "16:11:8", /* Jump alignment. */ | |
2828 | "0:0:8", /* Label alignment. */ | |
2829 | "16", /* Func alignment. */ | |
64766e8d JH |
2830 | }; |
2831 | ||
2832 | /* core_cost should produce code tuned for Core familly of CPUs. */ | |
2833 | static stringop_algs core_memcpy[2] = { | |
2834 | {libcall, {{1024, rep_prefix_4_byte, true}, {-1, libcall, false}}}, | |
2835 | {libcall, {{24, loop, true}, {128, rep_prefix_8_byte, true}, | |
2836 | {-1, libcall, false}}}}; | |
2837 | static stringop_algs core_memset[2] = { | |
2838 | {libcall, {{6, loop_1_byte, true}, | |
2839 | {24, loop, true}, | |
2840 | {8192, rep_prefix_4_byte, true}, | |
2841 | {-1, libcall, false}}}, | |
2842 | {libcall, {{24, loop, true}, {512, rep_prefix_8_byte, true}, | |
2843 | {-1, libcall, false}}}}; | |
2844 | ||
2845 | static const | |
2846 | struct processor_costs core_cost = { | |
72bb85f8 | 2847 | { |
d321551c L |
2848 | /* Start of register allocator costs. integer->integer move cost is 2. */ |
2849 | 6, /* cost for loading QImode using movzbl */ | |
2850 | {4, 4, 4}, /* cost of loading integer registers | |
2851 | in QImode, HImode and SImode. | |
2852 | Relative to reg-reg move (2). */ | |
2853 | {6, 6, 6}, /* cost of storing integer registers */ | |
2854 | 2, /* cost of reg,reg fld/fst */ | |
2855 | {6, 6, 8}, /* cost of loading fp registers | |
2856 | in SFmode, DFmode and XFmode */ | |
2857 | {6, 6, 10}, /* cost of storing fp registers | |
2858 | in SFmode, DFmode and XFmode */ | |
2859 | 2, /* cost of moving MMX register */ | |
2860 | {6, 6}, /* cost of loading MMX registers | |
2861 | in SImode and DImode */ | |
2862 | {6, 6}, /* cost of storing MMX registers | |
2863 | in SImode and DImode */ | |
2864 | 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */ | |
2865 | {6, 6, 6, 6, 12}, /* cost of loading SSE registers | |
2866 | in 32,64,128,256 and 512-bit */ | |
2867 | {6, 6, 6, 6, 12}, /* cost of storing SSE registers | |
2868 | in 32,64,128,256 and 512-bit */ | |
ecc3135a | 2869 | 6, 6, /* SSE->integer and integer->SSE moves */ |
2870 | 6, 6, /* mask->integer and integer->mask moves */ | |
00cb3494 L |
2871 | {4, 4, 4}, /* cost of loading mask register |
2872 | in QImode, HImode, SImode. */ | |
2873 | {6, 6, 6}, /* cost if storing mask register | |
2874 | in QImode, HImode, SImode. */ | |
2875 | 2, /* cost of moving mask register. */ | |
d321551c | 2876 | /* End of register allocator costs. */ |
72bb85f8 | 2877 | }, |
d321551c | 2878 | |
64766e8d JH |
2879 | COSTS_N_INSNS (1), /* cost of an add instruction */ |
2880 | /* On all chips taken into consideration lea is 2 cycles and more. With | |
2881 | this cost however our current implementation of synth_mult results in | |
2882 | use of unnecessary temporary registers causing regression on several | |
2883 | SPECfp benchmarks. */ | |
2884 | COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */ | |
2885 | COSTS_N_INSNS (1), /* variable shift costs */ | |
2886 | COSTS_N_INSNS (1), /* constant shift costs */ | |
2887 | {COSTS_N_INSNS (3), /* cost of starting multiply for QI */ | |
2888 | COSTS_N_INSNS (4), /* HI */ | |
2889 | COSTS_N_INSNS (3), /* SI */ | |
a2ef9558 MT |
2890 | /* Here we tune for Sandybridge or newer. */ |
2891 | COSTS_N_INSNS (3), /* DI */ | |
2892 | COSTS_N_INSNS (3)}, /* other */ | |
64766e8d | 2893 | 0, /* cost of multiply per each bit set */ |
02308bd3 MT |
2894 | /* Expanding div/mod currently doesn't consider parallelism. So the cost |
2895 | model is not realistic. We compensate by increasing the latencies a bit. */ | |
2896 | {COSTS_N_INSNS (11), /* cost of a divide/mod for QI */ | |
2897 | COSTS_N_INSNS (11), /* HI */ | |
2898 | COSTS_N_INSNS (14), /* SI */ | |
ffa3ce53 JH |
2899 | COSTS_N_INSNS (81), /* DI */ |
2900 | COSTS_N_INSNS (81)}, /* other */ | |
64766e8d JH |
2901 | COSTS_N_INSNS (1), /* cost of movsx */ |
2902 | COSTS_N_INSNS (1), /* cost of movzx */ | |
2903 | 8, /* "large" insn */ | |
2904 | 17, /* MOVE_RATIO */ | |
25e22b19 | 2905 | 6, /* CLEAR_RATIO */ |
64766e8d JH |
2906 | {4, 4, 4}, /* cost of loading integer registers |
2907 | in QImode, HImode and SImode. | |
2908 | Relative to reg-reg move (2). */ | |
ffa3ce53 | 2909 | {6, 6, 6}, /* cost of storing integer registers */ |
d321551c L |
2910 | {6, 6, 6, 6, 12}, /* cost of loading SSE register |
2911 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
2912 | {6, 6, 6, 6, 12}, /* cost of storing SSE register | |
2913 | in 32bit, 64bit, 128bit, 256bit and 512bit */ | |
df41dbaf | 2914 | {6, 6, 6, 6, 12}, /* cost of unaligned loads. */ |
df41dbaf | 2915 | {6, 6, 6, 6, 12}, /* cost of unaligned stores. */ |
d321551c L |
2916 | 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */ |
2917 | 2, /* cost of moving SSE register to integer. */ | |
a4fe6139 JH |
2918 | /* VGATHERDPD is 7 uops, rec throughput 5, while VGATHERDPD is 9 uops, |
2919 | rec. throughput 6. | |
2920 | So 5 uops statically and one uops per load. */ | |
2921 | 10, 6, /* Gather load static, per_elt. */ | |
2922 | 10, 6, /* Gather store static, per_elt. */ | |
64766e8d JH |
2923 | 64, /* size of l1 cache. */ |
2924 | 512, /* size of l2 cache. */ | |
2925 | 64, /* size of prefetch block */ | |
2926 | 6, /* number of parallel prefetches */ | |
2927 | /* FIXME perhaps more appropriate value is 5. */ | |
2928 | 3, /* Branch cost */ | |
ef9eec0b JH |
2929 | COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */ |
2930 | COSTS_N_INSNS (5), /* cost of FMUL instruction. */ | |
ffa3ce53 | 2931 | /* 10-24 */ |
ef9eec0b JH |
2932 | COSTS_N_INSNS (24), /* cost of FDIV instruction. */ |
2933 | COSTS_N_INSNS (1), /* cost of FABS instruction. */ | |
2934 | COSTS_N_INSNS (1), /* cost of FCHS instruction. */ | |
ffa3ce53 | 2935 | COSTS_N_INSNS (23), /* cost of FSQRT instruction. */ |
6065f444 | 2936 | |
c53c148c | 2937 | COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */ |
6065f444 JH |
2938 | COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */ |
2939 | COSTS_N_INSNS (4), /* cost of MULSS instruction. */ | |
2940 | COSTS_N_INSNS (5), /* cost of MULSD instruction. */ | |
c53c148c JH |
2941 | COSTS_N_INSNS (5), /* cost of FMA SS instruction. */ |
2942 | COSTS_N_INSNS (5), /* cost of FMA SD instruction. */ | |
6065f444 JH |
2943 | COSTS_N_INSNS (18), /* cost of DIVSS instruction. */ |
2944 | COSTS_N_INSNS (32), /* cost of DIVSD instruction. */ | |
2945 | COSTS_N_INSNS (30), /* cost of SQRTSS instruction. */ | |
2946 | COSTS_N_INSNS (58), /* cost of SQRTSD instruction. */ | |
64766e8d JH |
2947 | 1, 4, 2, 2, /* reassoc int, fp, vec_int, vec_fp. */ |
2948 | core_memcpy, | |
2949 | core_memset, | |
f6fd8f2b JH |
2950 | COSTS_N_INSNS (3), /* cond_taken_branch_cost. */ |
2951 | COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */ | |
7dc58b50 ML |
2952 | "16:11:8", /* Loop alignment. */ |
2953 | "16:11:8", /* Jump alignment. */ | |
2954 | "0:0:8", /* Label alignment. */ | |
2955 | "16", /* Func alignment. */ | |
64766e8d JH |
2956 | }; |
2957 |