Debian Codegraph @

gcc/config/i386/x86-tune-costs.h

raw
1 /* Costs of operations of individual x86 CPUs.
2 Copyright (C) 1988-2025 Free Software Foundation, Inc.
3
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/>. */
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 */
39 {
40 /* Start of register allocator costs. integer->integer move cost is 2
41 and coststs are relative to it. movl %eax, %ebx is 2 bytes, so the
42 sizes coincides with average size of instruction encoding. */
43 3, /* cost for loading QImode using movzbl */
44 /* Typical load/save from stack frame is 4 bytes with ebp and 5 with esp. */
45 {5, 6, 5}, /* cost of loading integer registers
46 in QImode, HImode and SImode.
47 Relative to reg-reg move (2). */
48 {5, 6, 5}, /* cost of storing integer registers */
49 2, /* cost of reg,reg fld/fst */
50 {5, 6, 5}, /* cost of loading fp registers
51 in SFmode, DFmode and XFmode */
52 {5, 6, 5}, /* cost of storing fp registers
53 in SFmode, DFmode and XFmode */
54 3, /* cost of moving MMX register */
55 {6, 6}, /* cost of loading MMX registers
56 in SImode and DImode */
57 {6, 6}, /* cost of storing MMX registers
58 in SImode and DImode */
59 4, 4, 6, /* cost of moving XMM,YMM,ZMM register */
60 {6, 6, 6, 6, 11}, /* cost of loading SSE registers
61 in 32,64,128,256 and 512-bit */
62 {6, 6, 6, 6, 11}, /* cost of storing SSE registers
63 in 32,64,128,256 and 512-bit */
64 4, 4, /* SSE->integer and integer->SSE moves */
65 4, 4, /* mask->integer and integer->mask moves */
66 {7, 7, 7}, /* cost of loading mask register
67 in QImode, HImode, SImode. */
68 {7, 7, 7}, /* cost if storing mask register
69 in QImode, HImode, SImode. */
70 4, /* cost of moving mask register. */
71 /* End of register allocator costs. */
72 },
73
74 COSTS_N_BYTES (2), /* cost of an add instruction */
75 COSTS_N_BYTES (3), /* cost of a lea instruction */
76 COSTS_N_BYTES (2), /* variable shift costs */
77 COSTS_N_BYTES (3), /* constant shift costs */
78 {COSTS_N_BYTES (3), /* cost of starting multiply for QI */
79 COSTS_N_BYTES (3), /* HI */
80 COSTS_N_BYTES (3), /* SI */
81 COSTS_N_BYTES (3), /* DI */
82 COSTS_N_BYTES (5)}, /* other */
83 0, /* cost of multiply per each bit set */
84 {COSTS_N_BYTES (3), /* cost of a divide/mod for QI */
85 COSTS_N_BYTES (3), /* HI */
86 COSTS_N_BYTES (3), /* SI */
87 COSTS_N_BYTES (3), /* DI */
88 COSTS_N_BYTES (5)}, /* other */
89 COSTS_N_BYTES (3), /* cost of movsx */
90 COSTS_N_BYTES (3), /* cost of movzx */
91 0, /* "large" insn */
92 2, /* MOVE_RATIO */
93 2, /* CLEAR_RATIO */
94 /* These costs are relative to reg-reg move with cost of 2. Since it has
95 2 bytes, this coincides with average instruction sizes. */
96 {5, 6, 5}, /* cost of loading integer registers
97 in QImode, HImode and SImode.
98 Relative to reg-reg move (2). */
99 {5, 6, 5}, /* cost of storing integer registers */
100 {6, 6, 6, 6, 11}, /* cost of loading SSE register
101 in 32bit, 64bit, 128bit, 256bit and 512bit */
102 {6, 6, 6, 6, 11}, /* cost of storing SSE register
103 in 32bit, 64bit, 128bit, 256bit and 512bit */
104 {6, 6, 6, 6, 11}, /* cost of unaligned SSE load
105 in 128bit, 256bit and 512bit */
106 {6, 6, 6, 6, 11}, /* cost of unaligned SSE store
107 in 128bit, 256bit and 512bit */
108 4, 4, 6, /* cost of moving XMM,YMM,ZMM register */
109 4, /* cost of moving SSE register to integer. */
110 COSTS_N_BYTES (5), 0, /* Gather load static, per_elt. */
111 COSTS_N_BYTES (5), 0, /* Gather store static, per_elt. */
112 0, /* size of l1 cache */
113 0, /* size of l2 cache */
114 0, /* size of prefetch block */
115 0, /* number of parallel prefetches */
116 2, /* Branch cost */
117 COSTS_N_BYTES (2), /* cost of FADD and FSUB insns. */
118 COSTS_N_BYTES (2), /* cost of FMUL instruction. */
119 COSTS_N_BYTES (2), /* cost of FDIV instruction. */
120 COSTS_N_BYTES (2), /* cost of FABS instruction. */
121 COSTS_N_BYTES (2), /* cost of FCHS instruction. */
122 COSTS_N_BYTES (2), /* cost of FSQRT instruction. */
123
124 COSTS_N_BYTES (2), /* cost of cheap SSE instruction. */
125 COSTS_N_BYTES (2), /* cost of ADDSS/SD SUBSS/SD insns. */
126 COSTS_N_BYTES (2), /* cost of MULSS instruction. */
127 COSTS_N_BYTES (2), /* cost of MULSD instruction. */
128 COSTS_N_BYTES (2), /* cost of FMA SS instruction. */
129 COSTS_N_BYTES (2), /* cost of FMA SD instruction. */
130 COSTS_N_BYTES (2), /* cost of DIVSS instruction. */
131 COSTS_N_BYTES (2), /* cost of DIVSD instruction. */
132 COSTS_N_BYTES (2), /* cost of SQRTSS instruction. */
133 COSTS_N_BYTES (2), /* cost of SQRTSD instruction. */
134 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
135 ix86_size_memcpy,
136 ix86_size_memset,
137 COSTS_N_BYTES (1), /* cond_taken_branch_cost. */
138 COSTS_N_BYTES (1), /* cond_not_taken_branch_cost. */
139 NULL, /* Loop alignment. */
140 NULL, /* Jump alignment. */
141 NULL, /* Label alignment. */
142 NULL, /* Func alignment. */
143 4, /* Small unroll limit. */
144 2, /* Small unroll factor. */
145 COSTS_N_INSNS (2), /* Branch mispredict scale. */
146 };
147
148 /* Processor costs (relative to an add) */
149 static stringop_algs i386_memcpy[2] = {
150 {rep_prefix_1_byte, {{-1, rep_prefix_1_byte, false}}},
151 DUMMY_STRINGOP_ALGS};
152 static stringop_algs i386_memset[2] = {
153 {rep_prefix_1_byte, {{-1, rep_prefix_1_byte, false}}},
154 DUMMY_STRINGOP_ALGS};
155
156 static const
157 struct processor_costs i386_cost = { /* 386 specific costs */
158 {
159 /* Start of register allocator costs. integer->integer move cost is 2. */
160 4, /* cost for loading QImode using movzbl */
161 {2, 4, 2}, /* cost of loading integer registers
162 in QImode, HImode and SImode.
163 Relative to reg-reg move (2). */
164 {2, 4, 2}, /* cost of storing integer registers */
165 2, /* cost of reg,reg fld/fst */
166 {8, 8, 8}, /* cost of loading fp registers
167 in SFmode, DFmode and XFmode */
168 {8, 8, 8}, /* cost of storing fp registers
169 in SFmode, DFmode and XFmode */
170 2, /* cost of moving MMX register */
171 {4, 8}, /* cost of loading MMX registers
172 in SImode and DImode */
173 {4, 8}, /* cost of storing MMX registers
174 in SImode and DImode */
175 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
176 {4, 8, 16, 32, 64}, /* cost of loading SSE registers
177 in 32,64,128,256 and 512-bit */
178 {4, 8, 16, 32, 64}, /* cost of storing SSE registers
179 in 32,64,128,256 and 512-bit */
180 3, 3, /* SSE->integer and integer->SSE moves */
181 3, 3, /* mask->integer and integer->mask moves */
182 {2, 4, 2}, /* cost of loading mask register
183 in QImode, HImode, SImode. */
184 {2, 4, 2}, /* cost if storing mask register
185 in QImode, HImode, SImode. */
186 2, /* cost of moving mask register. */
187 /* End of register allocator costs. */
188 },
189
190 COSTS_N_INSNS (1), /* cost of an add instruction */
191 COSTS_N_INSNS (1), /* cost of a lea instruction */
192 COSTS_N_INSNS (3), /* variable shift costs */
193 COSTS_N_INSNS (2), /* constant shift costs */
194 {COSTS_N_INSNS (6), /* cost of starting multiply for QI */
195 COSTS_N_INSNS (6), /* HI */
196 COSTS_N_INSNS (6), /* SI */
197 COSTS_N_INSNS (6), /* DI */
198 COSTS_N_INSNS (6)}, /* other */
199 COSTS_N_INSNS (1), /* cost of multiply per each bit set */
200 {COSTS_N_INSNS (23), /* cost of a divide/mod for QI */
201 COSTS_N_INSNS (23), /* HI */
202 COSTS_N_INSNS (23), /* SI */
203 COSTS_N_INSNS (23), /* DI */
204 COSTS_N_INSNS (23)}, /* other */
205 COSTS_N_INSNS (3), /* cost of movsx */
206 COSTS_N_INSNS (2), /* cost of movzx */
207 15, /* "large" insn */
208 3, /* MOVE_RATIO */
209 3, /* CLEAR_RATIO */
210 {2, 4, 2}, /* cost of loading integer registers
211 in QImode, HImode and SImode.
212 Relative to reg-reg move (2). */
213 {2, 4, 2}, /* cost of storing integer registers */
214 {4, 8, 16, 32, 64}, /* cost of loading SSE register
215 in 32bit, 64bit, 128bit, 256bit and 512bit */
216 {4, 8, 16, 32, 64}, /* cost of storing SSE register
217 in 32bit, 64bit, 128bit, 256bit and 512bit */
218 {4, 8, 16, 32, 64}, /* cost of unaligned loads. */
219 {4, 8, 16, 32, 64}, /* cost of unaligned stores. */
220 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
221 3, /* cost of moving SSE register to integer. */
222 4, 4, /* Gather load static, per_elt. */
223 4, 4, /* Gather store static, per_elt. */
224 0, /* size of l1 cache */
225 0, /* size of l2 cache */
226 0, /* size of prefetch block */
227 0, /* number of parallel prefetches */
228 1, /* Branch cost */
229 COSTS_N_INSNS (23), /* cost of FADD and FSUB insns. */
230 COSTS_N_INSNS (27), /* cost of FMUL instruction. */
231 COSTS_N_INSNS (88), /* cost of FDIV instruction. */
232 COSTS_N_INSNS (22), /* cost of FABS instruction. */
233 COSTS_N_INSNS (24), /* cost of FCHS instruction. */
234 COSTS_N_INSNS (122), /* cost of FSQRT instruction. */
235
236 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
237 COSTS_N_INSNS (23), /* cost of ADDSS/SD SUBSS/SD insns. */
238 COSTS_N_INSNS (27), /* cost of MULSS instruction. */
239 COSTS_N_INSNS (27), /* cost of MULSD instruction. */
240 COSTS_N_INSNS (27), /* cost of FMA SS instruction. */
241 COSTS_N_INSNS (27), /* cost of FMA SD instruction. */
242 COSTS_N_INSNS (88), /* cost of DIVSS instruction. */
243 COSTS_N_INSNS (88), /* cost of DIVSD instruction. */
244 COSTS_N_INSNS (122), /* cost of SQRTSS instruction. */
245 COSTS_N_INSNS (122), /* cost of SQRTSD instruction. */
246 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
247 i386_memcpy,
248 i386_memset,
249 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
250 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
251 "4", /* Loop alignment. */
252 "4", /* Jump alignment. */
253 NULL, /* Label alignment. */
254 "4", /* Func alignment. */
255 4, /* Small unroll limit. */
256 2, /* Small unroll factor. */
257 COSTS_N_INSNS (2), /* Branch mispredict scale. */
258 };
259
260 static stringop_algs i486_memcpy[2] = {
261 {rep_prefix_4_byte, {{-1, rep_prefix_4_byte, false}}},
262 DUMMY_STRINGOP_ALGS};
263 static stringop_algs i486_memset[2] = {
264 {rep_prefix_4_byte, {{-1, rep_prefix_4_byte, false}}},
265 DUMMY_STRINGOP_ALGS};
266
267 static const
268 struct processor_costs i486_cost = { /* 486 specific costs */
269 {
270 /* Start of register allocator costs. integer->integer move cost is 2. */
271 4, /* cost for loading QImode using movzbl */
272 {2, 4, 2}, /* cost of loading integer registers
273 in QImode, HImode and SImode.
274 Relative to reg-reg move (2). */
275 {2, 4, 2}, /* cost of storing integer registers */
276 2, /* cost of reg,reg fld/fst */
277 {8, 8, 8}, /* cost of loading fp registers
278 in SFmode, DFmode and XFmode */
279 {8, 8, 8}, /* cost of storing fp registers
280 in SFmode, DFmode and XFmode */
281 2, /* cost of moving MMX register */
282 {4, 8}, /* cost of loading MMX registers
283 in SImode and DImode */
284 {4, 8}, /* cost of storing MMX registers
285 in SImode and DImode */
286 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
287 {4, 8, 16, 32, 64}, /* cost of loading SSE registers
288 in 32,64,128,256 and 512-bit */
289 {4, 8, 16, 32, 64}, /* cost of storing SSE registers
290 in 32,64,128,256 and 512-bit */
291 3, 3, /* SSE->integer and integer->SSE moves */
292 3, 3, /* mask->integer and integer->mask moves */
293 {2, 4, 2}, /* cost of loading mask register
294 in QImode, HImode, SImode. */
295 {2, 4, 2}, /* cost if storing mask register
296 in QImode, HImode, SImode. */
297 2, /* cost of moving mask register. */
298 /* End of register allocator costs. */
299 },
300
301 COSTS_N_INSNS (1), /* cost of an add instruction */
302 COSTS_N_INSNS (1), /* cost of a lea instruction */
303 COSTS_N_INSNS (3), /* variable shift costs */
304 COSTS_N_INSNS (2), /* constant shift costs */
305 {COSTS_N_INSNS (12), /* cost of starting multiply for QI */
306 COSTS_N_INSNS (12), /* HI */
307 COSTS_N_INSNS (12), /* SI */
308 COSTS_N_INSNS (12), /* DI */
309 COSTS_N_INSNS (12)}, /* other */
310 1, /* cost of multiply per each bit set */
311 {COSTS_N_INSNS (40), /* cost of a divide/mod for QI */
312 COSTS_N_INSNS (40), /* HI */
313 COSTS_N_INSNS (40), /* SI */
314 COSTS_N_INSNS (40), /* DI */
315 COSTS_N_INSNS (40)}, /* other */
316 COSTS_N_INSNS (3), /* cost of movsx */
317 COSTS_N_INSNS (2), /* cost of movzx */
318 15, /* "large" insn */
319 3, /* MOVE_RATIO */
320 3, /* CLEAR_RATIO */
321 {2, 4, 2}, /* cost of loading integer registers
322 in QImode, HImode and SImode.
323 Relative to reg-reg move (2). */
324 {2, 4, 2}, /* cost of storing integer registers */
325 {4, 8, 16, 32, 64}, /* cost of loading SSE register
326 in 32bit, 64bit, 128bit, 256bit and 512bit */
327 {4, 8, 16, 32, 64}, /* cost of storing SSE register
328 in 32bit, 64bit, 128bit, 256bit and 512bit */
329 {4, 8, 16, 32, 64}, /* cost of unaligned loads. */
330 {4, 8, 16, 32, 64}, /* cost of unaligned stores. */
331 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
332 3, /* cost of moving SSE register to integer. */
333 4, 4, /* Gather load static, per_elt. */
334 4, 4, /* Gather store static, per_elt. */
335 4, /* size of l1 cache. 486 has 8kB cache
336 shared for code and data, so 4kB is
337 not really precise. */
338 4, /* size of l2 cache */
339 0, /* size of prefetch block */
340 0, /* number of parallel prefetches */
341 1, /* Branch cost */
342 COSTS_N_INSNS (8), /* cost of FADD and FSUB insns. */
343 COSTS_N_INSNS (16), /* cost of FMUL instruction. */
344 COSTS_N_INSNS (73), /* cost of FDIV instruction. */
345 COSTS_N_INSNS (3), /* cost of FABS instruction. */
346 COSTS_N_INSNS (3), /* cost of FCHS instruction. */
347 COSTS_N_INSNS (83), /* cost of FSQRT instruction. */
348
349 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
350 COSTS_N_INSNS (8), /* cost of ADDSS/SD SUBSS/SD insns. */
351 COSTS_N_INSNS (16), /* cost of MULSS instruction. */
352 COSTS_N_INSNS (16), /* cost of MULSD instruction. */
353 COSTS_N_INSNS (16), /* cost of FMA SS instruction. */
354 COSTS_N_INSNS (16), /* cost of FMA SD instruction. */
355 COSTS_N_INSNS (73), /* cost of DIVSS instruction. */
356 COSTS_N_INSNS (74), /* cost of DIVSD instruction. */
357 COSTS_N_INSNS (83), /* cost of SQRTSS instruction. */
358 COSTS_N_INSNS (83), /* cost of SQRTSD instruction. */
359 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
360 i486_memcpy,
361 i486_memset,
362 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
363 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
364 "16", /* Loop alignment. */
365 "16", /* Jump alignment. */
366 "0:0:8", /* Label alignment. */
367 "16", /* Func alignment. */
368 4, /* Small unroll limit. */
369 2, /* Small unroll factor. */
370 COSTS_N_INSNS (2), /* Branch mispredict scale. */
371 };
372
373 static stringop_algs pentium_memcpy[2] = {
374 {libcall, {{256, rep_prefix_4_byte, false}, {-1, libcall, false}}},
375 DUMMY_STRINGOP_ALGS};
376 static stringop_algs pentium_memset[2] = {
377 {libcall, {{-1, rep_prefix_4_byte, false}}},
378 DUMMY_STRINGOP_ALGS};
379
380 static const
381 struct processor_costs pentium_cost = {
382 {
383 /* Start of register allocator costs. integer->integer move cost is 2. */
384 6, /* cost for loading QImode using movzbl */
385 {2, 4, 2}, /* cost of loading integer registers
386 in QImode, HImode and SImode.
387 Relative to reg-reg move (2). */
388 {2, 4, 2}, /* cost of storing integer registers */
389 2, /* cost of reg,reg fld/fst */
390 {2, 2, 6}, /* cost of loading fp registers
391 in SFmode, DFmode and XFmode */
392 {4, 4, 6}, /* cost of storing fp registers
393 in SFmode, DFmode and XFmode */
394 8, /* cost of moving MMX register */
395 {8, 8}, /* cost of loading MMX registers
396 in SImode and DImode */
397 {8, 8}, /* cost of storing MMX registers
398 in SImode and DImode */
399 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
400 {4, 8, 16, 32, 64}, /* cost of loading SSE registers
401 in 32,64,128,256 and 512-bit */
402 {4, 8, 16, 32, 64}, /* cost of storing SSE registers
403 in 32,64,128,256 and 512-bit */
404 3, 3, /* SSE->integer and integer->SSE moves */
405 3, 3, /* mask->integer and integer->mask moves */
406 {2, 4, 2}, /* cost of loading mask register
407 in QImode, HImode, SImode. */
408 {2, 4, 2}, /* cost if storing mask register
409 in QImode, HImode, SImode. */
410 2, /* cost of moving mask register. */
411 /* End of register allocator costs. */
412 },
413
414 COSTS_N_INSNS (1), /* cost of an add instruction */
415 COSTS_N_INSNS (1), /* cost of a lea instruction */
416 COSTS_N_INSNS (4), /* variable shift costs */
417 COSTS_N_INSNS (1), /* constant shift costs */
418 {COSTS_N_INSNS (11), /* cost of starting multiply for QI */
419 COSTS_N_INSNS (11), /* HI */
420 COSTS_N_INSNS (11), /* SI */
421 COSTS_N_INSNS (11), /* DI */
422 COSTS_N_INSNS (11)}, /* other */
423 0, /* cost of multiply per each bit set */
424 {COSTS_N_INSNS (25), /* cost of a divide/mod for QI */
425 COSTS_N_INSNS (25), /* HI */
426 COSTS_N_INSNS (25), /* SI */
427 COSTS_N_INSNS (25), /* DI */
428 COSTS_N_INSNS (25)}, /* other */
429 COSTS_N_INSNS (3), /* cost of movsx */
430 COSTS_N_INSNS (2), /* cost of movzx */
431 8, /* "large" insn */
432 6, /* MOVE_RATIO */
433 6, /* CLEAR_RATIO */
434 {2, 4, 2}, /* cost of loading integer registers
435 in QImode, HImode and SImode.
436 Relative to reg-reg move (2). */
437 {2, 4, 2}, /* cost of storing integer registers */
438 {4, 8, 16, 32, 64}, /* cost of loading SSE register
439 in 32bit, 64bit, 128bit, 256bit and 512bit */
440 {4, 8, 16, 32, 64}, /* cost of storing SSE register
441 in 32bit, 64bit, 128bit, 256bit and 512bit */
442 {4, 8, 16, 32, 64}, /* cost of unaligned loads. */
443 {4, 8, 16, 32, 64}, /* cost of unaligned stores. */
444 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
445 3, /* cost of moving SSE register to integer. */
446 4, 4, /* Gather load static, per_elt. */
447 4, 4, /* Gather store static, per_elt. */
448 8, /* size of l1 cache. */
449 8, /* size of l2 cache */
450 0, /* size of prefetch block */
451 0, /* number of parallel prefetches */
452 2, /* Branch cost */
453 COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */
454 COSTS_N_INSNS (3), /* cost of FMUL instruction. */
455 COSTS_N_INSNS (39), /* cost of FDIV instruction. */
456 COSTS_N_INSNS (1), /* cost of FABS instruction. */
457 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
458 COSTS_N_INSNS (70), /* cost of FSQRT instruction. */
459
460 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
461 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
462 COSTS_N_INSNS (3), /* cost of MULSS instruction. */
463 COSTS_N_INSNS (3), /* cost of MULSD instruction. */
464 COSTS_N_INSNS (6), /* cost of FMA SS instruction. */
465 COSTS_N_INSNS (6), /* cost of FMA SD instruction. */
466 COSTS_N_INSNS (39), /* cost of DIVSS instruction. */
467 COSTS_N_INSNS (39), /* cost of DIVSD instruction. */
468 COSTS_N_INSNS (70), /* cost of SQRTSS instruction. */
469 COSTS_N_INSNS (70), /* cost of SQRTSD instruction. */
470 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
471 pentium_memcpy,
472 pentium_memset,
473 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
474 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
475 "16:8:8", /* Loop alignment. */
476 "16:8:8", /* Jump alignment. */
477 "0:0:8", /* Label alignment. */
478 "16", /* Func alignment. */
479 4, /* Small unroll limit. */
480 2, /* Small unroll factor. */
481 COSTS_N_INSNS (2), /* Branch mispredict scale. */
482 };
483
484 static const
485 struct processor_costs lakemont_cost = {
486 {
487 /* Start of register allocator costs. integer->integer move cost is 2. */
488 6, /* cost for loading QImode using movzbl */
489 {2, 4, 2}, /* cost of loading integer registers
490 in QImode, HImode and SImode.
491 Relative to reg-reg move (2). */
492 {2, 4, 2}, /* cost of storing integer registers */
493 2, /* cost of reg,reg fld/fst */
494 {2, 2, 6}, /* cost of loading fp registers
495 in SFmode, DFmode and XFmode */
496 {4, 4, 6}, /* cost of storing fp registers
497 in SFmode, DFmode and XFmode */
498 8, /* cost of moving MMX register */
499 {8, 8}, /* cost of loading MMX registers
500 in SImode and DImode */
501 {8, 8}, /* cost of storing MMX registers
502 in SImode and DImode */
503 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
504 {4, 8, 16, 32, 64}, /* cost of loading SSE registers
505 in 32,64,128,256 and 512-bit */
506 {4, 8, 16, 32, 64}, /* cost of storing SSE registers
507 in 32,64,128,256 and 512-bit */
508 3, 3, /* SSE->integer and integer->SSE moves */
509 3, 3, /* mask->integer and integer->mask moves */
510 {2, 4, 2}, /* cost of loading mask register
511 in QImode, HImode, SImode. */
512 {2, 4, 2}, /* cost if storing mask register
513 in QImode, HImode, SImode. */
514 2, /* cost of moving mask register. */
515 /* End of register allocator costs. */
516 },
517
518 COSTS_N_INSNS (1), /* cost of an add instruction */
519 COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */
520 COSTS_N_INSNS (1), /* variable shift costs */
521 COSTS_N_INSNS (1), /* constant shift costs */
522 {COSTS_N_INSNS (11), /* cost of starting multiply for QI */
523 COSTS_N_INSNS (11), /* HI */
524 COSTS_N_INSNS (11), /* SI */
525 COSTS_N_INSNS (11), /* DI */
526 COSTS_N_INSNS (11)}, /* other */
527 0, /* cost of multiply per each bit set */
528 {COSTS_N_INSNS (25), /* cost of a divide/mod for QI */
529 COSTS_N_INSNS (25), /* HI */
530 COSTS_N_INSNS (25), /* SI */
531 COSTS_N_INSNS (25), /* DI */
532 COSTS_N_INSNS (25)}, /* other */
533 COSTS_N_INSNS (3), /* cost of movsx */
534 COSTS_N_INSNS (2), /* cost of movzx */
535 8, /* "large" insn */
536 17, /* MOVE_RATIO */
537 6, /* CLEAR_RATIO */
538 {2, 4, 2}, /* cost of loading integer registers
539 in QImode, HImode and SImode.
540 Relative to reg-reg move (2). */
541 {2, 4, 2}, /* cost of storing integer registers */
542 {4, 8, 16, 32, 64}, /* cost of loading SSE register
543 in 32bit, 64bit, 128bit, 256bit and 512bit */
544 {4, 8, 16, 32, 64}, /* cost of storing SSE register
545 in 32bit, 64bit, 128bit, 256bit and 512bit */
546 {4, 8, 16, 32, 64}, /* cost of unaligned loads. */
547 {4, 8, 16, 32, 64}, /* cost of unaligned stores. */
548 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
549 3, /* cost of moving SSE register to integer. */
550 4, 4, /* Gather load static, per_elt. */
551 4, 4, /* Gather store static, per_elt. */
552 8, /* size of l1 cache. */
553 8, /* size of l2 cache */
554 0, /* size of prefetch block */
555 0, /* number of parallel prefetches */
556 2, /* Branch cost */
557 COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */
558 COSTS_N_INSNS (3), /* cost of FMUL instruction. */
559 COSTS_N_INSNS (39), /* cost of FDIV instruction. */
560 COSTS_N_INSNS (1), /* cost of FABS instruction. */
561 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
562 COSTS_N_INSNS (70), /* cost of FSQRT instruction. */
563
564 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
565 COSTS_N_INSNS (5), /* cost of ADDSS/SD SUBSS/SD insns. */
566 COSTS_N_INSNS (5), /* cost of MULSS instruction. */
567 COSTS_N_INSNS (5), /* cost of MULSD instruction. */
568 COSTS_N_INSNS (10), /* cost of FMA SS instruction. */
569 COSTS_N_INSNS (10), /* cost of FMA SD instruction. */
570 COSTS_N_INSNS (31), /* cost of DIVSS instruction. */
571 COSTS_N_INSNS (60), /* cost of DIVSD instruction. */
572 COSTS_N_INSNS (31), /* cost of SQRTSS instruction. */
573 COSTS_N_INSNS (63), /* cost of SQRTSD instruction. */
574 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
575 pentium_memcpy,
576 pentium_memset,
577 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
578 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
579 "16:8:8", /* Loop alignment. */
580 "16:8:8", /* Jump alignment. */
581 "0:0:8", /* Label alignment. */
582 "16", /* Func alignment. */
583 4, /* Small unroll limit. */
584 2, /* Small unroll factor. */
585 COSTS_N_INSNS (2), /* Branch mispredict scale. */
586 };
587
588 /* PentiumPro has optimized rep instructions for blocks aligned by 8 bytes
589 (we ensure the alignment). For small blocks inline loop is still a
590 noticeable win, for bigger blocks either rep movsl or rep movsb is
591 way to go. Rep movsb has apparently more expensive startup time in CPU,
592 but after 4K the difference is down in the noise. */
593 static stringop_algs pentiumpro_memcpy[2] = {
594 {rep_prefix_4_byte, {{128, loop, false}, {1024, unrolled_loop, false},
595 {8192, rep_prefix_4_byte, false},
596 {-1, rep_prefix_1_byte, false}}},
597 DUMMY_STRINGOP_ALGS};
598 static stringop_algs pentiumpro_memset[2] = {
599 {rep_prefix_4_byte, {{1024, unrolled_loop, false},
600 {8192, rep_prefix_4_byte, false},
601 {-1, libcall, false}}},
602 DUMMY_STRINGOP_ALGS};
603 static const
604 struct processor_costs pentiumpro_cost = {
605 {
606 /* Start of register allocator costs. integer->integer move cost is 2. */
607 2, /* cost for loading QImode using movzbl */
608 {4, 4, 4}, /* cost of loading integer registers
609 in QImode, HImode and SImode.
610 Relative to reg-reg move (2). */
611 {2, 2, 2}, /* cost of storing integer registers */
612 2, /* cost of reg,reg fld/fst */
613 {2, 2, 6}, /* cost of loading fp registers
614 in SFmode, DFmode and XFmode */
615 {4, 4, 6}, /* cost of storing fp registers
616 in SFmode, DFmode and XFmode */
617 2, /* cost of moving MMX register */
618 {2, 2}, /* cost of loading MMX registers
619 in SImode and DImode */
620 {2, 2}, /* cost of storing MMX registers
621 in SImode and DImode */
622 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
623 {4, 8, 16, 32, 64}, /* cost of loading SSE registers
624 in 32,64,128,256 and 512-bit */
625 {4, 8, 16, 32, 64}, /* cost of storing SSE registers
626 in 32,64,128,256 and 512-bit */
627 3, 3, /* SSE->integer and integer->SSE moves */
628 3, 3, /* mask->integer and integer->mask moves */
629 {4, 4, 4}, /* cost of loading mask register
630 in QImode, HImode, SImode. */
631 {2, 2, 2}, /* cost if storing mask register
632 in QImode, HImode, SImode. */
633 2, /* cost of moving mask register. */
634 /* End of register allocator costs. */
635 },
636
637 COSTS_N_INSNS (1), /* cost of an add instruction */
638 COSTS_N_INSNS (1), /* cost of a lea instruction */
639 COSTS_N_INSNS (1), /* variable shift costs */
640 COSTS_N_INSNS (1), /* constant shift costs */
641 {COSTS_N_INSNS (4), /* cost of starting multiply for QI */
642 COSTS_N_INSNS (4), /* HI */
643 COSTS_N_INSNS (4), /* SI */
644 COSTS_N_INSNS (4), /* DI */
645 COSTS_N_INSNS (4)}, /* other */
646 0, /* cost of multiply per each bit set */
647 {COSTS_N_INSNS (17), /* cost of a divide/mod for QI */
648 COSTS_N_INSNS (17), /* HI */
649 COSTS_N_INSNS (17), /* SI */
650 COSTS_N_INSNS (17), /* DI */
651 COSTS_N_INSNS (17)}, /* other */
652 COSTS_N_INSNS (1), /* cost of movsx */
653 COSTS_N_INSNS (1), /* cost of movzx */
654 8, /* "large" insn */
655 6, /* MOVE_RATIO */
656 6, /* CLEAR_RATIO */
657 {4, 4, 4}, /* cost of loading integer registers
658 in QImode, HImode and SImode.
659 Relative to reg-reg move (2). */
660 {2, 2, 2}, /* cost of storing integer registers */
661 {4, 8, 16, 32, 64}, /* cost of loading SSE register
662 in 32bit, 64bit, 128bit, 256bit and 512bit */
663 {4, 8, 16, 32, 64}, /* cost of storing SSE register
664 in 32bit, 64bit, 128bit, 256bit and 512bit */
665 {4, 8, 16, 32, 64}, /* cost of unaligned loads. */
666 {4, 8, 16, 32, 64}, /* cost of unaligned stores. */
667 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
668 3, /* cost of moving SSE register to integer. */
669 4, 4, /* Gather load static, per_elt. */
670 4, 4, /* Gather store static, per_elt. */
671 8, /* size of l1 cache. */
672 256, /* size of l2 cache */
673 32, /* size of prefetch block */
674 6, /* number of parallel prefetches */
675 2, /* Branch cost */
676 COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */
677 COSTS_N_INSNS (5), /* cost of FMUL instruction. */
678 COSTS_N_INSNS (56), /* cost of FDIV instruction. */
679 COSTS_N_INSNS (2), /* cost of FABS instruction. */
680 COSTS_N_INSNS (2), /* cost of FCHS instruction. */
681 COSTS_N_INSNS (56), /* cost of FSQRT instruction. */
682
683 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
684 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
685 COSTS_N_INSNS (4), /* cost of MULSS instruction. */
686 COSTS_N_INSNS (4), /* cost of MULSD instruction. */
687 COSTS_N_INSNS (7), /* cost of FMA SS instruction. */
688 COSTS_N_INSNS (7), /* cost of FMA SD instruction. */
689 COSTS_N_INSNS (18), /* cost of DIVSS instruction. */
690 COSTS_N_INSNS (18), /* cost of DIVSD instruction. */
691 COSTS_N_INSNS (31), /* cost of SQRTSS instruction. */
692 COSTS_N_INSNS (31), /* cost of SQRTSD instruction. */
693 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
694 pentiumpro_memcpy,
695 pentiumpro_memset,
696 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
697 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
698 "16", /* Loop alignment. */
699 "16:11:8", /* Jump alignment. */
700 "0:0:8", /* Label alignment. */
701 "16", /* Func alignment. */
702 4, /* Small unroll limit. */
703 2, /* Small unroll factor. */
704 COSTS_N_INSNS (2), /* Branch mispredict scale. */
705 };
706
707 static stringop_algs geode_memcpy[2] = {
708 {libcall, {{256, rep_prefix_4_byte, false}, {-1, libcall, false}}},
709 DUMMY_STRINGOP_ALGS};
710 static stringop_algs geode_memset[2] = {
711 {libcall, {{256, rep_prefix_4_byte, false}, {-1, libcall, false}}},
712 DUMMY_STRINGOP_ALGS};
713 static const
714 struct processor_costs geode_cost = {
715 {
716 /* Start of register allocator costs. integer->integer move cost is 2. */
717 2, /* cost for loading QImode using movzbl */
718 {2, 2, 2}, /* cost of loading integer registers
719 in QImode, HImode and SImode.
720 Relative to reg-reg move (2). */
721 {2, 2, 2}, /* cost of storing integer registers */
722 2, /* cost of reg,reg fld/fst */
723 {2, 2, 2}, /* cost of loading fp registers
724 in SFmode, DFmode and XFmode */
725 {4, 6, 6}, /* cost of storing fp registers
726 in SFmode, DFmode and XFmode */
727 2, /* cost of moving MMX register */
728 {2, 2}, /* cost of loading MMX registers
729 in SImode and DImode */
730 {2, 2}, /* cost of storing MMX registers
731 in SImode and DImode */
732 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
733 {2, 2, 8, 16, 32}, /* cost of loading SSE registers
734 in 32,64,128,256 and 512-bit */
735 {2, 2, 8, 16, 32}, /* cost of storing SSE registers
736 in 32,64,128,256 and 512-bit */
737 6, 6, /* SSE->integer and integer->SSE moves */
738 6, 6, /* mask->integer and integer->mask moves */
739 {2, 2, 2}, /* cost of loading mask register
740 in QImode, HImode, SImode. */
741 {2, 2, 2}, /* cost if storing mask register
742 in QImode, HImode, SImode. */
743 2, /* cost of moving mask register. */
744 /* End of register allocator costs. */
745 },
746
747 COSTS_N_INSNS (1), /* cost of an add instruction */
748 COSTS_N_INSNS (1), /* cost of a lea instruction */
749 COSTS_N_INSNS (2), /* variable shift costs */
750 COSTS_N_INSNS (1), /* constant shift costs */
751 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
752 COSTS_N_INSNS (4), /* HI */
753 COSTS_N_INSNS (7), /* SI */
754 COSTS_N_INSNS (7), /* DI */
755 COSTS_N_INSNS (7)}, /* other */
756 0, /* cost of multiply per each bit set */
757 {COSTS_N_INSNS (15), /* cost of a divide/mod for QI */
758 COSTS_N_INSNS (23), /* HI */
759 COSTS_N_INSNS (39), /* SI */
760 COSTS_N_INSNS (39), /* DI */
761 COSTS_N_INSNS (39)}, /* other */
762 COSTS_N_INSNS (1), /* cost of movsx */
763 COSTS_N_INSNS (1), /* cost of movzx */
764 8, /* "large" insn */
765 4, /* MOVE_RATIO */
766 4, /* CLEAR_RATIO */
767 {2, 2, 2}, /* cost of loading integer registers
768 in QImode, HImode and SImode.
769 Relative to reg-reg move (2). */
770 {2, 2, 2}, /* cost of storing integer registers */
771 {2, 2, 8, 16, 32}, /* cost of loading SSE register
772 in 32bit, 64bit, 128bit, 256bit and 512bit */
773 {2, 2, 8, 16, 32}, /* cost of storing SSE register
774 in 32bit, 64bit, 128bit, 256bit and 512bit */
775 {2, 2, 8, 16, 32}, /* cost of unaligned loads. */
776 {2, 2, 8, 16, 32}, /* cost of unaligned stores. */
777 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
778 6, /* cost of moving SSE register to integer. */
779 2, 2, /* Gather load static, per_elt. */
780 2, 2, /* Gather store static, per_elt. */
781 64, /* size of l1 cache. */
782 128, /* size of l2 cache. */
783 32, /* size of prefetch block */
784 1, /* number of parallel prefetches */
785 1, /* Branch cost */
786 COSTS_N_INSNS (6), /* cost of FADD and FSUB insns. */
787 COSTS_N_INSNS (11), /* cost of FMUL instruction. */
788 COSTS_N_INSNS (47), /* cost of FDIV instruction. */
789 COSTS_N_INSNS (1), /* cost of FABS instruction. */
790 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
791 COSTS_N_INSNS (54), /* cost of FSQRT instruction. */
792
793 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
794 COSTS_N_INSNS (6), /* cost of ADDSS/SD SUBSS/SD insns. */
795 COSTS_N_INSNS (11), /* cost of MULSS instruction. */
796 COSTS_N_INSNS (11), /* cost of MULSD instruction. */
797 COSTS_N_INSNS (17), /* cost of FMA SS instruction. */
798 COSTS_N_INSNS (17), /* cost of FMA SD instruction. */
799 COSTS_N_INSNS (47), /* cost of DIVSS instruction. */
800 COSTS_N_INSNS (47), /* cost of DIVSD instruction. */
801 COSTS_N_INSNS (54), /* cost of SQRTSS instruction. */
802 COSTS_N_INSNS (54), /* cost of SQRTSD instruction. */
803 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
804 geode_memcpy,
805 geode_memset,
806 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
807 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
808 NULL, /* Loop alignment. */
809 NULL, /* Jump alignment. */
810 NULL, /* Label alignment. */
811 NULL, /* Func alignment. */
812 4, /* Small unroll limit. */
813 2, /* Small unroll factor. */
814 COSTS_N_INSNS (2), /* Branch mispredict scale. */
815 };
816
817 static stringop_algs k6_memcpy[2] = {
818 {libcall, {{256, rep_prefix_4_byte, false}, {-1, libcall, false}}},
819 DUMMY_STRINGOP_ALGS};
820 static stringop_algs k6_memset[2] = {
821 {libcall, {{256, rep_prefix_4_byte, false}, {-1, libcall, false}}},
822 DUMMY_STRINGOP_ALGS};
823 static const
824 struct processor_costs k6_cost = {
825 {
826 /* Start of register allocator costs. integer->integer move cost is 2. */
827 3, /* cost for loading QImode using movzbl */
828 {4, 5, 4}, /* cost of loading integer registers
829 in QImode, HImode and SImode.
830 Relative to reg-reg move (2). */
831 {2, 3, 2}, /* cost of storing integer registers */
832 4, /* cost of reg,reg fld/fst */
833 {6, 6, 6}, /* cost of loading fp registers
834 in SFmode, DFmode and XFmode */
835 {4, 4, 4}, /* cost of storing fp registers
836 in SFmode, DFmode and XFmode */
837 2, /* cost of moving MMX register */
838 {2, 2}, /* cost of loading MMX registers
839 in SImode and DImode */
840 {2, 2}, /* cost of storing MMX registers
841 in SImode and DImode */
842 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
843 {2, 2, 8, 16, 32}, /* cost of loading SSE registers
844 in 32,64,128,256 and 512-bit */
845 {2, 2, 8, 16, 32}, /* cost of storing SSE registers
846 in 32,64,128,256 and 512-bit */
847 6, 6, /* SSE->integer and integer->SSE moves */
848 6, 6, /* mask->integer and integer->mask moves */
849 {4, 5, 4}, /* cost of loading mask register
850 in QImode, HImode, SImode. */
851 {2, 3, 2}, /* cost if storing mask register
852 in QImode, HImode, SImode. */
853 2, /* cost of moving mask register. */
854 /* End of register allocator costs. */
855 },
856
857 COSTS_N_INSNS (1), /* cost of an add instruction */
858 COSTS_N_INSNS (2), /* cost of a lea instruction */
859 COSTS_N_INSNS (1), /* variable shift costs */
860 COSTS_N_INSNS (1), /* constant shift costs */
861 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
862 COSTS_N_INSNS (3), /* HI */
863 COSTS_N_INSNS (3), /* SI */
864 COSTS_N_INSNS (3), /* DI */
865 COSTS_N_INSNS (3)}, /* other */
866 0, /* cost of multiply per each bit set */
867 {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */
868 COSTS_N_INSNS (18), /* HI */
869 COSTS_N_INSNS (18), /* SI */
870 COSTS_N_INSNS (18), /* DI */
871 COSTS_N_INSNS (18)}, /* other */
872 COSTS_N_INSNS (2), /* cost of movsx */
873 COSTS_N_INSNS (2), /* cost of movzx */
874 8, /* "large" insn */
875 4, /* MOVE_RATIO */
876 4, /* CLEAR_RATIO */
877 {4, 5, 4}, /* cost of loading integer registers
878 in QImode, HImode and SImode.
879 Relative to reg-reg move (2). */
880 {2, 3, 2}, /* cost of storing integer registers */
881 {2, 2, 8, 16, 32}, /* cost of loading SSE register
882 in 32bit, 64bit, 128bit, 256bit and 512bit */
883 {2, 2, 8, 16, 32}, /* cost of storing SSE register
884 in 32bit, 64bit, 128bit, 256bit and 512bit */
885 {2, 2, 8, 16, 32}, /* cost of unaligned loads. */
886 {2, 2, 8, 16, 32}, /* cost of unaligned stores. */
887 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
888 6, /* cost of moving SSE register to integer. */
889 2, 2, /* Gather load static, per_elt. */
890 2, 2, /* Gather store static, per_elt. */
891 32, /* size of l1 cache. */
892 32, /* size of l2 cache. Some models
893 have integrated l2 cache, but
894 optimizing for k6 is not important
895 enough to worry about that. */
896 32, /* size of prefetch block */
897 1, /* number of parallel prefetches */
898 1, /* Branch cost */
899 COSTS_N_INSNS (2), /* cost of FADD and FSUB insns. */
900 COSTS_N_INSNS (2), /* cost of FMUL instruction. */
901 COSTS_N_INSNS (56), /* cost of FDIV instruction. */
902 COSTS_N_INSNS (2), /* cost of FABS instruction. */
903 COSTS_N_INSNS (2), /* cost of FCHS instruction. */
904 COSTS_N_INSNS (56), /* cost of FSQRT instruction. */
905
906 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
907 COSTS_N_INSNS (2), /* cost of ADDSS/SD SUBSS/SD insns. */
908 COSTS_N_INSNS (2), /* cost of MULSS instruction. */
909 COSTS_N_INSNS (2), /* cost of MULSD instruction. */
910 COSTS_N_INSNS (4), /* cost of FMA SS instruction. */
911 COSTS_N_INSNS (4), /* cost of FMA SD instruction. */
912 COSTS_N_INSNS (56), /* cost of DIVSS instruction. */
913 COSTS_N_INSNS (56), /* cost of DIVSD instruction. */
914 COSTS_N_INSNS (56), /* cost of SQRTSS instruction. */
915 COSTS_N_INSNS (56), /* cost of SQRTSD instruction. */
916 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
917 k6_memcpy,
918 k6_memset,
919 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
920 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
921 "32:8:8", /* Loop alignment. */
922 "32:8:8", /* Jump alignment. */
923 "0:0:8", /* Label alignment. */
924 "32", /* Func alignment. */
925 4, /* Small unroll limit. */
926 2, /* Small unroll factor. */
927 COSTS_N_INSNS (2), /* Branch mispredict scale. */
928 };
929
930 /* For some reason, Athlon deals better with REP prefix (relative to loops)
931 compared to K8. Alignment becomes important after 8 bytes for memcpy and
932 128 bytes for memset. */
933 static stringop_algs athlon_memcpy[2] = {
934 {libcall, {{2048, rep_prefix_4_byte, false}, {-1, libcall, false}}},
935 DUMMY_STRINGOP_ALGS};
936 static stringop_algs athlon_memset[2] = {
937 {libcall, {{2048, rep_prefix_4_byte, false}, {-1, libcall, false}}},
938 DUMMY_STRINGOP_ALGS};
939 static const
940 struct processor_costs athlon_cost = {
941 {
942 /* Start of register allocator costs. integer->integer move cost is 2. */
943 4, /* cost for loading QImode using movzbl */
944 {3, 4, 3}, /* cost of loading integer registers
945 in QImode, HImode and SImode.
946 Relative to reg-reg move (2). */
947 {3, 4, 3}, /* cost of storing integer registers */
948 4, /* cost of reg,reg fld/fst */
949 {4, 4, 12}, /* cost of loading fp registers
950 in SFmode, DFmode and XFmode */
951 {6, 6, 8}, /* cost of storing fp registers
952 in SFmode, DFmode and XFmode */
953 2, /* cost of moving MMX register */
954 {4, 4}, /* cost of loading MMX registers
955 in SImode and DImode */
956 {4, 4}, /* cost of storing MMX registers
957 in SImode and DImode */
958 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
959 {4, 4, 12, 12, 24}, /* cost of loading SSE registers
960 in 32,64,128,256 and 512-bit */
961 {4, 4, 10, 10, 20}, /* cost of storing SSE registers
962 in 32,64,128,256 and 512-bit */
963 5, 5, /* SSE->integer and integer->SSE moves */
964 5, 5, /* mask->integer and integer->mask moves */
965 {3, 4, 3}, /* cost of loading mask register
966 in QImode, HImode, SImode. */
967 {3, 4, 3}, /* cost if storing mask register
968 in QImode, HImode, SImode. */
969 2, /* cost of moving mask register. */
970 /* End of register allocator costs. */
971 },
972
973 COSTS_N_INSNS (1), /* cost of an add instruction */
974 COSTS_N_INSNS (2), /* cost of a lea instruction */
975 COSTS_N_INSNS (1), /* variable shift costs */
976 COSTS_N_INSNS (1), /* constant shift costs */
977 {COSTS_N_INSNS (5), /* cost of starting multiply for QI */
978 COSTS_N_INSNS (5), /* HI */
979 COSTS_N_INSNS (5), /* SI */
980 COSTS_N_INSNS (5), /* DI */
981 COSTS_N_INSNS (5)}, /* other */
982 0, /* cost of multiply per each bit set */
983 {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */
984 COSTS_N_INSNS (26), /* HI */
985 COSTS_N_INSNS (42), /* SI */
986 COSTS_N_INSNS (74), /* DI */
987 COSTS_N_INSNS (74)}, /* other */
988 COSTS_N_INSNS (1), /* cost of movsx */
989 COSTS_N_INSNS (1), /* cost of movzx */
990 8, /* "large" insn */
991 9, /* MOVE_RATIO */
992 6, /* CLEAR_RATIO */
993 {3, 4, 3}, /* cost of loading integer registers
994 in QImode, HImode and SImode.
995 Relative to reg-reg move (2). */
996 {3, 4, 3}, /* cost of storing integer registers */
997 {4, 4, 12, 12, 24}, /* cost of loading SSE register
998 in 32bit, 64bit, 128bit, 256bit and 512bit */
999 {4, 4, 10, 10, 20}, /* cost of storing SSE register
1000 in 32bit, 64bit, 128bit, 256bit and 512bit */
1001 {4, 4, 12, 12, 24}, /* cost of unaligned loads. */
1002 {4, 4, 10, 10, 20}, /* cost of unaligned stores. */
1003 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
1004 5, /* cost of moving SSE register to integer. */
1005 4, 4, /* Gather load static, per_elt. */
1006 4, 4, /* Gather store static, per_elt. */
1007 64, /* size of l1 cache. */
1008 256, /* size of l2 cache. */
1009 64, /* size of prefetch block */
1010 6, /* number of parallel prefetches */
1011 5, /* Branch cost */
1012 COSTS_N_INSNS (4), /* cost of FADD and FSUB insns. */
1013 COSTS_N_INSNS (4), /* cost of FMUL instruction. */
1014 COSTS_N_INSNS (24), /* cost of FDIV instruction. */
1015 COSTS_N_INSNS (2), /* cost of FABS instruction. */
1016 COSTS_N_INSNS (2), /* cost of FCHS instruction. */
1017 COSTS_N_INSNS (35), /* cost of FSQRT instruction. */
1018
1019 COSTS_N_INSNS (2), /* cost of cheap SSE instruction. */
1020 COSTS_N_INSNS (4), /* cost of ADDSS/SD SUBSS/SD insns. */
1021 COSTS_N_INSNS (4), /* cost of MULSS instruction. */
1022 COSTS_N_INSNS (4), /* cost of MULSD instruction. */
1023 COSTS_N_INSNS (8), /* cost of FMA SS instruction. */
1024 COSTS_N_INSNS (8), /* cost of FMA SD instruction. */
1025 /* 11-16 */
1026 COSTS_N_INSNS (16), /* cost of DIVSS instruction. */
1027 COSTS_N_INSNS (24), /* cost of DIVSD instruction. */
1028 COSTS_N_INSNS (19), /* cost of SQRTSS instruction. */
1029 COSTS_N_INSNS (19), /* cost of SQRTSD instruction. */
1030 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
1031 athlon_memcpy,
1032 athlon_memset,
1033 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
1034 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
1035 "16:8:8", /* Loop alignment. */
1036 "16:8:8", /* Jump alignment. */
1037 "0:0:8", /* Label alignment. */
1038 "16", /* Func alignment. */
1039 4, /* Small unroll limit. */
1040 2, /* Small unroll factor. */
1041 COSTS_N_INSNS (2), /* Branch mispredict scale. */
1042 };
1043
1044 /* K8 has optimized REP instruction for medium sized blocks, but for very
1045 small blocks it is better to use loop. For large blocks, libcall can
1046 do nontemporary accesses and beat inline considerably. */
1047 static stringop_algs k8_memcpy[2] = {
1048 {libcall, {{6, loop, false}, {14, unrolled_loop, false},
1049 {-1, rep_prefix_4_byte, false}}},
1050 {libcall, {{16, loop, false}, {8192, rep_prefix_8_byte, false},
1051 {-1, libcall, false}}}};
1052 static stringop_algs k8_memset[2] = {
1053 {libcall, {{8, loop, false}, {24, unrolled_loop, false},
1054 {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}},
1055 {libcall, {{48, unrolled_loop, false},
1056 {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}};
1057 static const
1058 struct processor_costs k8_cost = {
1059 {
1060 /* Start of register allocator costs. integer->integer move cost is 2. */
1061 4, /* cost for loading QImode using movzbl */
1062 {3, 4, 3}, /* cost of loading integer registers
1063 in QImode, HImode and SImode.
1064 Relative to reg-reg move (2). */
1065 {3, 4, 3}, /* cost of storing integer registers */
1066 4, /* cost of reg,reg fld/fst */
1067 {4, 4, 12}, /* cost of loading fp registers
1068 in SFmode, DFmode and XFmode */
1069 {6, 6, 8}, /* cost of storing fp registers
1070 in SFmode, DFmode and XFmode */
1071 2, /* cost of moving MMX register */
1072 {3, 3}, /* cost of loading MMX registers
1073 in SImode and DImode */
1074 {4, 4}, /* cost of storing MMX registers
1075 in SImode and DImode */
1076 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
1077 {4, 3, 12, 12, 24}, /* cost of loading SSE registers
1078 in 32,64,128,256 and 512-bit */
1079 {4, 4, 10, 10, 20}, /* cost of storing SSE registers
1080 in 32,64,128,256 and 512-bit */
1081 5, 5, /* SSE->integer and integer->SSE moves */
1082 5, 5, /* mask->integer and integer->mask moves */
1083 {3, 4, 3}, /* cost of loading mask register
1084 in QImode, HImode, SImode. */
1085 {3, 4, 3}, /* cost if storing mask register
1086 in QImode, HImode, SImode. */
1087 2, /* cost of moving mask register. */
1088 /* End of register allocator costs. */
1089 },
1090
1091 COSTS_N_INSNS (1), /* cost of an add instruction */
1092 COSTS_N_INSNS (2), /* cost of a lea instruction */
1093 COSTS_N_INSNS (1), /* variable shift costs */
1094 COSTS_N_INSNS (1), /* constant shift costs */
1095 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
1096 COSTS_N_INSNS (4), /* HI */
1097 COSTS_N_INSNS (3), /* SI */
1098 COSTS_N_INSNS (4), /* DI */
1099 COSTS_N_INSNS (5)}, /* other */
1100 0, /* cost of multiply per each bit set */
1101 {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */
1102 COSTS_N_INSNS (26), /* HI */
1103 COSTS_N_INSNS (42), /* SI */
1104 COSTS_N_INSNS (74), /* DI */
1105 COSTS_N_INSNS (74)}, /* other */
1106 COSTS_N_INSNS (1), /* cost of movsx */
1107 COSTS_N_INSNS (1), /* cost of movzx */
1108 8, /* "large" insn */
1109 9, /* MOVE_RATIO */
1110 6, /* CLEAR_RATIO */
1111 {3, 4, 3}, /* cost of loading integer registers
1112 in QImode, HImode and SImode.
1113 Relative to reg-reg move (2). */
1114 {3, 4, 3}, /* cost of storing integer registers */
1115 {4, 3, 12, 12, 24}, /* cost of loading SSE register
1116 in 32bit, 64bit, 128bit, 256bit and 512bit */
1117 {4, 4, 10, 10, 20}, /* cost of storing SSE register
1118 in 32bit, 64bit, 128bit, 256bit and 512bit */
1119 {4, 3, 12, 12, 24}, /* cost of unaligned loads. */
1120 {4, 4, 10, 10, 20}, /* cost of unaligned stores. */
1121 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
1122 5, /* cost of moving SSE register to integer. */
1123 4, 4, /* Gather load static, per_elt. */
1124 4, 4, /* Gather store static, per_elt. */
1125 64, /* size of l1 cache. */
1126 512, /* size of l2 cache. */
1127 64, /* size of prefetch block */
1128 /* New AMD processors never drop prefetches; if they cannot be performed
1129 immediately, they are queued. We set number of simultaneous prefetches
1130 to a large constant to reflect this (it probably is not a good idea not
1131 to limit number of prefetches at all, as their execution also takes some
1132 time). */
1133 100, /* number of parallel prefetches */
1134 3, /* Branch cost */
1135 COSTS_N_INSNS (4), /* cost of FADD and FSUB insns. */
1136 COSTS_N_INSNS (4), /* cost of FMUL instruction. */
1137 COSTS_N_INSNS (19), /* cost of FDIV instruction. */
1138 COSTS_N_INSNS (2), /* cost of FABS instruction. */
1139 COSTS_N_INSNS (2), /* cost of FCHS instruction. */
1140 COSTS_N_INSNS (35), /* cost of FSQRT instruction. */
1141
1142 COSTS_N_INSNS (2), /* cost of cheap SSE instruction. */
1143 COSTS_N_INSNS (4), /* cost of ADDSS/SD SUBSS/SD insns. */
1144 COSTS_N_INSNS (4), /* cost of MULSS instruction. */
1145 COSTS_N_INSNS (4), /* cost of MULSD instruction. */
1146 COSTS_N_INSNS (8), /* cost of FMA SS instruction. */
1147 COSTS_N_INSNS (8), /* cost of FMA SD instruction. */
1148 /* 11-16 */
1149 COSTS_N_INSNS (16), /* cost of DIVSS instruction. */
1150 COSTS_N_INSNS (20), /* cost of DIVSD instruction. */
1151 COSTS_N_INSNS (19), /* cost of SQRTSS instruction. */
1152 COSTS_N_INSNS (27), /* cost of SQRTSD instruction. */
1153 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
1154 k8_memcpy,
1155 k8_memset,
1156 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
1157 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
1158 "16:8:8", /* Loop alignment. */
1159 "16:8:8", /* Jump alignment. */
1160 "0:0:8", /* Label alignment. */
1161 "16", /* Func alignment. */
1162 4, /* Small unroll limit. */
1163 2, /* Small unroll factor. */
1164 COSTS_N_INSNS (2), /* Branch mispredict scale. */
1165 };
1166
1167 /* AMDFAM10 has optimized REP instruction for medium sized blocks, but for
1168 very small blocks it is better to use loop. For large blocks, libcall can
1169 do nontemporary accesses and beat inline considerably. */
1170 static stringop_algs amdfam10_memcpy[2] = {
1171 {libcall, {{6, loop, false}, {14, unrolled_loop, false},
1172 {-1, rep_prefix_4_byte, false}}},
1173 {libcall, {{16, loop, false}, {8192, rep_prefix_8_byte, false},
1174 {-1, libcall, false}}}};
1175 static stringop_algs amdfam10_memset[2] = {
1176 {libcall, {{8, loop, false}, {24, unrolled_loop, false},
1177 {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}},
1178 {libcall, {{48, unrolled_loop, false}, {8192, rep_prefix_8_byte, false},
1179 {-1, libcall, false}}}};
1180 struct processor_costs amdfam10_cost = {
1181 {
1182 /* Start of register allocator costs. integer->integer move cost is 2. */
1183 4, /* cost for loading QImode using movzbl */
1184 {3, 4, 3}, /* cost of loading integer registers
1185 in QImode, HImode and SImode.
1186 Relative to reg-reg move (2). */
1187 {3, 4, 3}, /* cost of storing integer registers */
1188 4, /* cost of reg,reg fld/fst */
1189 {4, 4, 12}, /* cost of loading fp registers
1190 in SFmode, DFmode and XFmode */
1191 {6, 6, 8}, /* cost of storing fp registers
1192 in SFmode, DFmode and XFmode */
1193 2, /* cost of moving MMX register */
1194 {3, 3}, /* cost of loading MMX registers
1195 in SImode and DImode */
1196 {4, 4}, /* cost of storing MMX registers
1197 in SImode and DImode */
1198 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
1199 {4, 4, 3, 6, 12}, /* cost of loading SSE registers
1200 in 32,64,128,256 and 512-bit */
1201 {4, 4, 5, 10, 20}, /* cost of storing SSE registers
1202 in 32,64,128,256 and 512-bit */
1203 3, 3, /* SSE->integer and integer->SSE moves */
1204 3, 3, /* mask->integer and integer->mask moves */
1205 {3, 4, 3}, /* cost of loading mask register
1206 in QImode, HImode, SImode. */
1207 {3, 4, 3}, /* cost if storing mask register
1208 in QImode, HImode, SImode. */
1209 2, /* cost of moving mask register. */
1210
1211 /* On K8:
1212 MOVD reg64, xmmreg Double FSTORE 4
1213 MOVD reg32, xmmreg Double FSTORE 4
1214 On AMDFAM10:
1215 MOVD reg64, xmmreg Double FADD 3
1216 1/1 1/1
1217 MOVD reg32, xmmreg Double FADD 3
1218 1/1 1/1 */
1219 /* End of register allocator costs. */
1220 },
1221
1222 COSTS_N_INSNS (1), /* cost of an add instruction */
1223 COSTS_N_INSNS (2), /* cost of a lea instruction */
1224 COSTS_N_INSNS (1), /* variable shift costs */
1225 COSTS_N_INSNS (1), /* constant shift costs */
1226 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
1227 COSTS_N_INSNS (4), /* HI */
1228 COSTS_N_INSNS (3), /* SI */
1229 COSTS_N_INSNS (4), /* DI */
1230 COSTS_N_INSNS (5)}, /* other */
1231 0, /* cost of multiply per each bit set */
1232 {COSTS_N_INSNS (19), /* cost of a divide/mod for QI */
1233 COSTS_N_INSNS (35), /* HI */
1234 COSTS_N_INSNS (51), /* SI */
1235 COSTS_N_INSNS (83), /* DI */
1236 COSTS_N_INSNS (83)}, /* other */
1237 COSTS_N_INSNS (1), /* cost of movsx */
1238 COSTS_N_INSNS (1), /* cost of movzx */
1239 8, /* "large" insn */
1240 9, /* MOVE_RATIO */
1241 6, /* CLEAR_RATIO */
1242 {3, 4, 3}, /* cost of loading integer registers
1243 in QImode, HImode and SImode.
1244 Relative to reg-reg move (2). */
1245 {3, 4, 3}, /* cost of storing integer registers */
1246 {4, 4, 3, 6, 12}, /* cost of loading SSE register
1247 in 32bit, 64bit, 128bit, 256bit and 512bit */
1248 {4, 4, 5, 10, 20}, /* cost of storing SSE register
1249 in 32bit, 64bit, 128bit, 256bit and 512bit */
1250 {4, 4, 3, 7, 12}, /* cost of unaligned loads. */
1251 {4, 4, 5, 10, 20}, /* cost of unaligned stores. */
1252 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
1253 3, /* cost of moving SSE register to integer. */
1254 4, 4, /* Gather load static, per_elt. */
1255 4, 4, /* Gather store static, per_elt. */
1256 64, /* size of l1 cache. */
1257 512, /* size of l2 cache. */
1258 64, /* size of prefetch block */
1259 /* New AMD processors never drop prefetches; if they cannot be performed
1260 immediately, they are queued. We set number of simultaneous prefetches
1261 to a large constant to reflect this (it probably is not a good idea not
1262 to limit number of prefetches at all, as their execution also takes some
1263 time). */
1264 100, /* number of parallel prefetches */
1265 2, /* Branch cost */
1266 COSTS_N_INSNS (4), /* cost of FADD and FSUB insns. */
1267 COSTS_N_INSNS (4), /* cost of FMUL instruction. */
1268 COSTS_N_INSNS (19), /* cost of FDIV instruction. */
1269 COSTS_N_INSNS (2), /* cost of FABS instruction. */
1270 COSTS_N_INSNS (2), /* cost of FCHS instruction. */
1271 COSTS_N_INSNS (35), /* cost of FSQRT instruction. */
1272
1273 COSTS_N_INSNS (2), /* cost of cheap SSE instruction. */
1274 COSTS_N_INSNS (4), /* cost of ADDSS/SD SUBSS/SD insns. */
1275 COSTS_N_INSNS (4), /* cost of MULSS instruction. */
1276 COSTS_N_INSNS (4), /* cost of MULSD instruction. */
1277 COSTS_N_INSNS (8), /* cost of FMA SS instruction. */
1278 COSTS_N_INSNS (8), /* cost of FMA SD instruction. */
1279 /* 11-16 */
1280 COSTS_N_INSNS (16), /* cost of DIVSS instruction. */
1281 COSTS_N_INSNS (20), /* cost of DIVSD instruction. */
1282 COSTS_N_INSNS (19), /* cost of SQRTSS instruction. */
1283 COSTS_N_INSNS (27), /* cost of SQRTSD instruction. */
1284 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
1285 amdfam10_memcpy,
1286 amdfam10_memset,
1287 COSTS_N_INSNS (2), /* cond_taken_branch_cost. */
1288 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
1289 "32:25:8", /* Loop alignment. */
1290 "32:8:8", /* Jump alignment. */
1291 "0:0:8", /* Label alignment. */
1292 "32", /* Func alignment. */
1293 4, /* Small unroll limit. */
1294 2, /* Small unroll factor. */
1295 COSTS_N_INSNS (2), /* Branch mispredict scale. */
1296 };
1297
1298 /* BDVER has optimized REP instruction for medium sized blocks, but for
1299 very small blocks it is better to use loop. For large blocks, libcall
1300 can do nontemporary accesses and beat inline considerably. */
1301 static stringop_algs bdver_memcpy[2] = {
1302 {libcall, {{6, loop, false}, {14, unrolled_loop, false},
1303 {-1, rep_prefix_4_byte, false}}},
1304 {libcall, {{16, loop, false}, {8192, rep_prefix_8_byte, false},
1305 {-1, libcall, false}}}};
1306 static stringop_algs bdver_memset[2] = {
1307 {libcall, {{8, loop, false}, {24, unrolled_loop, false},
1308 {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}},
1309 {libcall, {{48, unrolled_loop, false}, {8192, rep_prefix_8_byte, false},
1310 {-1, libcall, false}}}};
1311
1312 const struct processor_costs bdver_cost = {
1313 {
1314 /* Start of register allocator costs. integer->integer move cost is 2. */
1315 8, /* cost for loading QImode using movzbl */
1316 {8, 8, 8}, /* cost of loading integer registers
1317 in QImode, HImode and SImode.
1318 Relative to reg-reg move (2). */
1319 {8, 8, 8}, /* cost of storing integer registers */
1320 4, /* cost of reg,reg fld/fst */
1321 {12, 12, 28}, /* cost of loading fp registers
1322 in SFmode, DFmode and XFmode */
1323 {10, 10, 18}, /* cost of storing fp registers
1324 in SFmode, DFmode and XFmode */
1325 4, /* cost of moving MMX register */
1326 {12, 12}, /* cost of loading MMX registers
1327 in SImode and DImode */
1328 {10, 10}, /* cost of storing MMX registers
1329 in SImode and DImode */
1330 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
1331 {12, 12, 10, 40, 60}, /* cost of loading SSE registers
1332 in 32,64,128,256 and 512-bit */
1333 {10, 10, 10, 40, 60}, /* cost of storing SSE registers
1334 in 32,64,128,256 and 512-bit */
1335 16, 20, /* SSE->integer and integer->SSE moves */
1336 16, 20, /* mask->integer and integer->mask moves */
1337 {8, 8, 8}, /* cost of loading mask register
1338 in QImode, HImode, SImode. */
1339 {8, 8, 8}, /* cost if storing mask register
1340 in QImode, HImode, SImode. */
1341 2, /* cost of moving mask register. */
1342 /* End of register allocator costs. */
1343 },
1344
1345 COSTS_N_INSNS (1), /* cost of an add instruction */
1346 COSTS_N_INSNS (1), /* cost of a lea instruction */
1347 COSTS_N_INSNS (1), /* variable shift costs */
1348 COSTS_N_INSNS (1), /* constant shift costs */
1349 {COSTS_N_INSNS (4), /* cost of starting multiply for QI */
1350 COSTS_N_INSNS (4), /* HI */
1351 COSTS_N_INSNS (4), /* SI */
1352 COSTS_N_INSNS (6), /* DI */
1353 COSTS_N_INSNS (6)}, /* other */
1354 0, /* cost of multiply per each bit set */
1355 {COSTS_N_INSNS (19), /* cost of a divide/mod for QI */
1356 COSTS_N_INSNS (35), /* HI */
1357 COSTS_N_INSNS (51), /* SI */
1358 COSTS_N_INSNS (83), /* DI */
1359 COSTS_N_INSNS (83)}, /* other */
1360 COSTS_N_INSNS (1), /* cost of movsx */
1361 COSTS_N_INSNS (1), /* cost of movzx */
1362 8, /* "large" insn */
1363 9, /* MOVE_RATIO */
1364 6, /* CLEAR_RATIO */
1365 {8, 8, 8}, /* cost of loading integer registers
1366 in QImode, HImode and SImode.
1367 Relative to reg-reg move (2). */
1368 {8, 8, 8}, /* cost of storing integer registers */
1369 {12, 12, 10, 40, 60}, /* cost of loading SSE register
1370 in 32bit, 64bit, 128bit, 256bit and 512bit */
1371 {10, 10, 10, 40, 60}, /* cost of storing SSE register
1372 in 32bit, 64bit, 128bit, 256bit and 512bit */
1373 {12, 12, 10, 40, 60}, /* cost of unaligned loads. */
1374 {10, 10, 10, 40, 60}, /* cost of unaligned stores. */
1375 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
1376 16, /* cost of moving SSE register to integer. */
1377 12, 12, /* Gather load static, per_elt. */
1378 10, 10, /* Gather store static, per_elt. */
1379 16, /* size of l1 cache. */
1380 2048, /* size of l2 cache. */
1381 64, /* size of prefetch block */
1382 /* New AMD processors never drop prefetches; if they cannot be performed
1383 immediately, they are queued. We set number of simultaneous prefetches
1384 to a large constant to reflect this (it probably is not a good idea not
1385 to limit number of prefetches at all, as their execution also takes some
1386 time). */
1387 100, /* number of parallel prefetches */
1388 2, /* Branch cost */
1389 COSTS_N_INSNS (6), /* cost of FADD and FSUB insns. */
1390 COSTS_N_INSNS (6), /* cost of FMUL instruction. */
1391 COSTS_N_INSNS (42), /* cost of FDIV instruction. */
1392 COSTS_N_INSNS (2), /* cost of FABS instruction. */
1393 COSTS_N_INSNS (2), /* cost of FCHS instruction. */
1394 COSTS_N_INSNS (52), /* cost of FSQRT instruction. */
1395
1396 COSTS_N_INSNS (2), /* cost of cheap SSE instruction. */
1397 COSTS_N_INSNS (6), /* cost of ADDSS/SD SUBSS/SD insns. */
1398 COSTS_N_INSNS (6), /* cost of MULSS instruction. */
1399 COSTS_N_INSNS (6), /* cost of MULSD instruction. */
1400 COSTS_N_INSNS (6), /* cost of FMA SS instruction. */
1401 COSTS_N_INSNS (6), /* cost of FMA SD instruction. */
1402 /* 9-24 */
1403 COSTS_N_INSNS (24), /* cost of DIVSS instruction. */
1404 /* 9-27 */
1405 COSTS_N_INSNS (27), /* cost of DIVSD instruction. */
1406 COSTS_N_INSNS (15), /* cost of SQRTSS instruction. */
1407 COSTS_N_INSNS (26), /* cost of SQRTSD instruction. */
1408 1, 2, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
1409 bdver_memcpy,
1410 bdver_memset,
1411 COSTS_N_INSNS (4), /* cond_taken_branch_cost. */
1412 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
1413 "16:11:8", /* Loop alignment. */
1414 "16:8:8", /* Jump alignment. */
1415 "0:0:8", /* Label alignment. */
1416 "11", /* Func alignment. */
1417 4, /* Small unroll limit. */
1418 2, /* Small unroll factor. */
1419 COSTS_N_INSNS (2), /* Branch mispredict scale. */
1420 };
1421
1422
1423 /* ZNVER1 has optimized REP instruction for medium sized blocks, but for
1424 very small blocks it is better to use loop. For large blocks, libcall
1425 can do nontemporary accesses and beat inline considerably. */
1426 static stringop_algs znver1_memcpy[2] = {
1427 /* 32-bit tuning. */
1428 {libcall, {{6, loop, false},
1429 {14, unrolled_loop, false},
1430 {-1, libcall, false}}},
1431 /* 64-bit tuning. */
1432 {libcall, {{16, loop, false},
1433 {128, rep_prefix_8_byte, false},
1434 {-1, libcall, false}}}};
1435 static stringop_algs znver1_memset[2] = {
1436 /* 32-bit tuning. */
1437 {libcall, {{8, loop, false},
1438 {24, unrolled_loop, false},
1439 {128, rep_prefix_4_byte, false},
1440 {-1, libcall, false}}},
1441 /* 64-bit tuning. */
1442 {libcall, {{48, unrolled_loop, false},
1443 {128, rep_prefix_8_byte, false},
1444 {-1, libcall, false}}}};
1445 struct processor_costs znver1_cost = {
1446 {
1447 /* Start of register allocator costs. integer->integer move cost is 2. */
1448
1449 /* reg-reg moves are done by renaming and thus they are even cheaper than
1450 1 cycle. Becuase reg-reg move cost is 2 and the following tables correspond
1451 to doubles of latencies, we do not model this correctly. It does not
1452 seem to make practical difference to bump prices up even more. */
1453 6, /* cost for loading QImode using
1454 movzbl. */
1455 {6, 6, 6}, /* cost of loading integer registers
1456 in QImode, HImode and SImode.
1457 Relative to reg-reg move (2). */
1458 {8, 8, 8}, /* cost of storing integer
1459 registers. */
1460 2, /* cost of reg,reg fld/fst. */
1461 {6, 6, 16}, /* cost of loading fp registers
1462 in SFmode, DFmode and XFmode. */
1463 {8, 8, 16}, /* cost of storing fp registers
1464 in SFmode, DFmode and XFmode. */
1465 2, /* cost of moving MMX register. */
1466 {6, 6}, /* cost of loading MMX registers
1467 in SImode and DImode. */
1468 {8, 8}, /* cost of storing MMX registers
1469 in SImode and DImode. */
1470 2, 3, 6, /* cost of moving XMM,YMM,ZMM register. */
1471 {6, 6, 6, 12, 24}, /* cost of loading SSE registers
1472 in 32,64,128,256 and 512-bit. */
1473 {8, 8, 8, 16, 32}, /* cost of storing SSE registers
1474 in 32,64,128,256 and 512-bit. */
1475 6, 6, /* SSE->integer and integer->SSE moves. */
1476 8, 8, /* mask->integer and integer->mask moves */
1477 {6, 6, 6}, /* cost of loading mask register
1478 in QImode, HImode, SImode. */
1479 {8, 8, 8}, /* cost if storing mask register
1480 in QImode, HImode, SImode. */
1481 2, /* cost of moving mask register. */
1482 /* End of register allocator costs. */
1483 },
1484
1485 COSTS_N_INSNS (1), /* cost of an add instruction. */
1486 COSTS_N_INSNS (1), /* cost of a lea instruction. */
1487 COSTS_N_INSNS (1), /* variable shift costs. */
1488 COSTS_N_INSNS (1), /* constant shift costs. */
1489 {COSTS_N_INSNS (3), /* cost of starting multiply for QI. */
1490 COSTS_N_INSNS (3), /* HI. */
1491 COSTS_N_INSNS (3), /* SI. */
1492 COSTS_N_INSNS (3), /* DI. */
1493 COSTS_N_INSNS (3)}, /* other. */
1494 0, /* cost of multiply per each bit
1495 set. */
1496 /* Depending on parameters, idiv can get faster on ryzen. This is upper
1497 bound. */
1498 {COSTS_N_INSNS (16), /* cost of a divide/mod for QI. */
1499 COSTS_N_INSNS (22), /* HI. */
1500 COSTS_N_INSNS (30), /* SI. */
1501 COSTS_N_INSNS (45), /* DI. */
1502 COSTS_N_INSNS (45)}, /* other. */
1503 COSTS_N_INSNS (1), /* cost of movsx. */
1504 COSTS_N_INSNS (1), /* cost of movzx. */
1505 8, /* "large" insn. */
1506 9, /* MOVE_RATIO. */
1507 6, /* CLEAR_RATIO */
1508 {6, 6, 6}, /* cost of loading integer registers
1509 in QImode, HImode and SImode.
1510 Relative to reg-reg move (2). */
1511 {8, 8, 8}, /* cost of storing integer
1512 registers. */
1513 {6, 6, 6, 12, 24}, /* cost of loading SSE register
1514 in 32bit, 64bit, 128bit, 256bit and 512bit */
1515 {8, 8, 8, 16, 32}, /* cost of storing SSE register
1516 in 32bit, 64bit, 128bit, 256bit and 512bit */
1517 {6, 6, 6, 12, 24}, /* cost of unaligned loads. */
1518 {8, 8, 8, 16, 32}, /* cost of unaligned stores. */
1519 2, 3, 6, /* cost of moving XMM,YMM,ZMM register. */
1520 6, /* cost of moving SSE register to integer. */
1521 /* VGATHERDPD is 23 uops and throughput is 9, VGATHERDPD is 35 uops,
1522 throughput 12. Approx 9 uops do not depend on vector size and every load
1523 is 7 uops. */
1524 18, 8, /* Gather load static, per_elt. */
1525 18, 10, /* Gather store static, per_elt. */
1526 32, /* size of l1 cache. */
1527 512, /* size of l2 cache. */
1528 64, /* size of prefetch block. */
1529 /* New AMD processors never drop prefetches; if they cannot be performed
1530 immediately, they are queued. We set number of simultaneous prefetches
1531 to a large constant to reflect this (it probably is not a good idea not
1532 to limit number of prefetches at all, as their execution also takes some
1533 time). */
1534 100, /* number of parallel prefetches. */
1535 3, /* Branch cost. */
1536 COSTS_N_INSNS (5), /* cost of FADD and FSUB insns. */
1537 COSTS_N_INSNS (5), /* cost of FMUL instruction. */
1538 /* Latency of fdiv is 8-15. */
1539 COSTS_N_INSNS (15), /* cost of FDIV instruction. */
1540 COSTS_N_INSNS (1), /* cost of FABS instruction. */
1541 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
1542 /* Latency of fsqrt is 4-10. */
1543 COSTS_N_INSNS (10), /* cost of FSQRT instruction. */
1544
1545 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
1546 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
1547 COSTS_N_INSNS (3), /* cost of MULSS instruction. */
1548 COSTS_N_INSNS (4), /* cost of MULSD instruction. */
1549 COSTS_N_INSNS (5), /* cost of FMA SS instruction. */
1550 COSTS_N_INSNS (5), /* cost of FMA SD instruction. */
1551 COSTS_N_INSNS (10), /* cost of DIVSS instruction. */
1552 /* 9-13 */
1553 COSTS_N_INSNS (13), /* cost of DIVSD instruction. */
1554 COSTS_N_INSNS (10), /* cost of SQRTSS instruction. */
1555 COSTS_N_INSNS (15), /* cost of SQRTSD instruction. */
1556 /* Zen can execute 4 integer operations per cycle. FP operations take 3 cycles
1557 and it can execute 2 integer additions and 2 multiplications thus
1558 reassociation may make sense up to with of 6. SPEC2k6 bencharks suggests
1559 that 4 works better than 6 probably due to register pressure.
1560
1561 Integer vector operations are taken by FP unit and execute 3 vector
1562 plus/minus operations per cycle but only one multiply. This is adjusted
1563 in ix86_reassociation_width. */
1564 4, 4, 3, 6, /* reassoc int, fp, vec_int, vec_fp. */
1565 znver1_memcpy,
1566 znver1_memset,
1567 COSTS_N_INSNS (4), /* cond_taken_branch_cost. */
1568 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
1569 "16", /* Loop alignment. */
1570 "16", /* Jump alignment. */
1571 "0:0:8", /* Label alignment. */
1572 "16", /* Func alignment. */
1573 4, /* Small unroll limit. */
1574 2, /* Small unroll factor. */
1575 COSTS_N_INSNS (2), /* Branch mispredict scale. */
1576 };
1577
1578 /* ZNVER2 has optimized REP instruction for medium sized blocks, but for
1579 very small blocks it is better to use loop. For large blocks, libcall
1580 can do nontemporary accesses and beat inline considerably. */
1581 static stringop_algs znver2_memcpy[2] = {
1582 /* 32-bit tuning. */
1583 {libcall, {{6, loop, false},
1584 {14, unrolled_loop, false},
1585 {-1, libcall, false}}},
1586 /* 64-bit tuning. */
1587 {libcall, {{16, loop, false},
1588 {64, rep_prefix_4_byte, false},
1589 {-1, libcall, false}}}};
1590 static stringop_algs znver2_memset[2] = {
1591 /* 32-bit tuning. */
1592 {libcall, {{8, loop, false},
1593 {24, unrolled_loop, false},
1594 {128, rep_prefix_4_byte, false},
1595 {-1, libcall, false}}},
1596 /* 64-bit tuning. */
1597 {libcall, {{24, rep_prefix_4_byte, false},
1598 {128, rep_prefix_8_byte, false},
1599 {-1, libcall, false}}}};
1600
1601 struct processor_costs znver2_cost = {
1602 {
1603 /* Start of register allocator costs. integer->integer move cost is 2. */
1604
1605 /* reg-reg moves are done by renaming and thus they are even cheaper than
1606 1 cycle. Because reg-reg move cost is 2 and following tables correspond
1607 to doubles of latencies, we do not model this correctly. It does not
1608 seem to make practical difference to bump prices up even more. */
1609 6, /* cost for loading QImode using
1610 movzbl. */
1611 {6, 6, 6}, /* cost of loading integer registers
1612 in QImode, HImode and SImode.
1613 Relative to reg-reg move (2). */
1614 {8, 8, 8}, /* cost of storing integer
1615 registers. */
1616 2, /* cost of reg,reg fld/fst. */
1617 {6, 6, 16}, /* cost of loading fp registers
1618 in SFmode, DFmode and XFmode. */
1619 {8, 8, 16}, /* cost of storing fp registers
1620 in SFmode, DFmode and XFmode. */
1621 2, /* cost of moving MMX register. */
1622 {6, 6}, /* cost of loading MMX registers
1623 in SImode and DImode. */
1624 {8, 8}, /* cost of storing MMX registers
1625 in SImode and DImode. */
1626 2, 2, 3, /* cost of moving XMM,YMM,ZMM
1627 register. */
1628 {6, 6, 6, 6, 12}, /* cost of loading SSE registers
1629 in 32,64,128,256 and 512-bit. */
1630 {8, 8, 8, 8, 16}, /* cost of storing SSE registers
1631 in 32,64,128,256 and 512-bit. */
1632 6, 6, /* SSE->integer and integer->SSE
1633 moves. */
1634 8, 8, /* mask->integer and integer->mask moves */
1635 {6, 6, 6}, /* cost of loading mask register
1636 in QImode, HImode, SImode. */
1637 {8, 8, 8}, /* cost if storing mask register
1638 in QImode, HImode, SImode. */
1639 2, /* cost of moving mask register. */
1640 /* End of register allocator costs. */
1641 },
1642
1643 COSTS_N_INSNS (1), /* cost of an add instruction. */
1644 COSTS_N_INSNS (1), /* cost of a lea instruction. */
1645 COSTS_N_INSNS (1), /* variable shift costs. */
1646 COSTS_N_INSNS (1), /* constant shift costs. */
1647 {COSTS_N_INSNS (3), /* cost of starting multiply for QI. */
1648 COSTS_N_INSNS (3), /* HI. */
1649 COSTS_N_INSNS (3), /* SI. */
1650 COSTS_N_INSNS (3), /* DI. */
1651 COSTS_N_INSNS (3)}, /* other. */
1652 0, /* cost of multiply per each bit
1653 set. */
1654 /* Depending on parameters, idiv can get faster on ryzen. This is upper
1655 bound. */
1656 {COSTS_N_INSNS (16), /* cost of a divide/mod for QI. */
1657 COSTS_N_INSNS (22), /* HI. */
1658 COSTS_N_INSNS (30), /* SI. */
1659 COSTS_N_INSNS (45), /* DI. */
1660 COSTS_N_INSNS (45)}, /* other. */
1661 COSTS_N_INSNS (1), /* cost of movsx. */
1662 COSTS_N_INSNS (1), /* cost of movzx. */
1663 8, /* "large" insn. */
1664 9, /* MOVE_RATIO. */
1665 6, /* CLEAR_RATIO */
1666 {6, 6, 6}, /* cost of loading integer registers
1667 in QImode, HImode and SImode.
1668 Relative to reg-reg move (2). */
1669 {8, 8, 8}, /* cost of storing integer
1670 registers. */
1671 {6, 6, 6, 6, 12}, /* cost of loading SSE registers
1672 in 32bit, 64bit, 128bit, 256bit and 512bit */
1673 {8, 8, 8, 8, 16}, /* cost of storing SSE register
1674 in 32bit, 64bit, 128bit, 256bit and 512bit */
1675 {6, 6, 6, 6, 12}, /* cost of unaligned loads. */
1676 {8, 8, 8, 8, 16}, /* cost of unaligned stores. */
1677 2, 2, 3, /* cost of moving XMM,YMM,ZMM
1678 register. */
1679 6, /* cost of moving SSE register to integer. */
1680 /* VGATHERDPD is 23 uops and throughput is 9, VGATHERDPD is 35 uops,
1681 throughput 12. Approx 9 uops do not depend on vector size and every load
1682 is 7 uops. */
1683 18, 8, /* Gather load static, per_elt. */
1684 18, 10, /* Gather store static, per_elt. */
1685 32, /* size of l1 cache. */
1686 512, /* size of l2 cache. */
1687 64, /* size of prefetch block. */
1688 /* New AMD processors never drop prefetches; if they cannot be performed
1689 immediately, they are queued. We set number of simultaneous prefetches
1690 to a large constant to reflect this (it probably is not a good idea not
1691 to limit number of prefetches at all, as their execution also takes some
1692 time). */
1693 100, /* number of parallel prefetches. */
1694 3, /* Branch cost. */
1695 COSTS_N_INSNS (5), /* cost of FADD and FSUB insns. */
1696 COSTS_N_INSNS (5), /* cost of FMUL instruction. */
1697 /* Latency of fdiv is 8-15. */
1698 COSTS_N_INSNS (15), /* cost of FDIV instruction. */
1699 COSTS_N_INSNS (1), /* cost of FABS instruction. */
1700 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
1701 /* Latency of fsqrt is 4-10. */
1702 COSTS_N_INSNS (10), /* cost of FSQRT instruction. */
1703
1704 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
1705 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
1706 COSTS_N_INSNS (3), /* cost of MULSS instruction. */
1707 COSTS_N_INSNS (3), /* cost of MULSD instruction. */
1708 COSTS_N_INSNS (5), /* cost of FMA SS instruction. */
1709 COSTS_N_INSNS (5), /* cost of FMA SD instruction. */
1710 COSTS_N_INSNS (10), /* cost of DIVSS instruction. */
1711 /* 9-13. */
1712 COSTS_N_INSNS (13), /* cost of DIVSD instruction. */
1713 COSTS_N_INSNS (10), /* cost of SQRTSS instruction. */
1714 COSTS_N_INSNS (15), /* cost of SQRTSD instruction. */
1715 /* Zen can execute 4 integer operations per cycle. FP operations
1716 take 3 cycles and it can execute 2 integer additions and 2
1717 multiplications thus reassociation may make sense up to with of 6.
1718 SPEC2k6 bencharks suggests
1719 that 4 works better than 6 probably due to register pressure.
1720
1721 Integer vector operations are taken by FP unit and execute 3 vector
1722 plus/minus operations per cycle but only one multiply. This is adjusted
1723 in ix86_reassociation_width. */
1724 4, 4, 3, 6, /* reassoc int, fp, vec_int, vec_fp. */
1725 znver2_memcpy,
1726 znver2_memset,
1727 COSTS_N_INSNS (4), /* cond_taken_branch_cost. */
1728 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
1729 "16", /* Loop alignment. */
1730 "16", /* Jump alignment. */
1731 "0:0:8", /* Label alignment. */
1732 "16", /* Func alignment. */
1733 4, /* Small unroll limit. */
1734 2, /* Small unroll factor. */
1735 COSTS_N_INSNS (2), /* Branch mispredict scale. */
1736 };
1737
1738 struct processor_costs znver3_cost = {
1739 {
1740 /* Start of register allocator costs. integer->integer move cost is 2. */
1741
1742 /* reg-reg moves are done by renaming and thus they are even cheaper than
1743 1 cycle. Because reg-reg move cost is 2 and following tables correspond
1744 to doubles of latencies, we do not model this correctly. It does not
1745 seem to make practical difference to bump prices up even more. */
1746 6, /* cost for loading QImode using
1747 movzbl. */
1748 {6, 6, 6}, /* cost of loading integer registers
1749 in QImode, HImode and SImode.
1750 Relative to reg-reg move (2). */
1751 {8, 8, 8}, /* cost of storing integer
1752 registers. */
1753 2, /* cost of reg,reg fld/fst. */
1754 {6, 6, 16}, /* cost of loading fp registers
1755 in SFmode, DFmode and XFmode. */
1756 {8, 8, 16}, /* cost of storing fp registers
1757 in SFmode, DFmode and XFmode. */
1758 2, /* cost of moving MMX register. */
1759 {6, 6}, /* cost of loading MMX registers
1760 in SImode and DImode. */
1761 {8, 8}, /* cost of storing MMX registers
1762 in SImode and DImode. */
1763 2, 2, 3, /* cost of moving XMM,YMM,ZMM
1764 register. */
1765 {6, 6, 6, 6, 12}, /* cost of loading SSE registers
1766 in 32,64,128,256 and 512-bit. */
1767 {8, 8, 8, 8, 16}, /* cost of storing SSE registers
1768 in 32,64,128,256 and 512-bit. */
1769 6, 6, /* SSE->integer and integer->SSE
1770 moves. */
1771 8, 8, /* mask->integer and integer->mask moves */
1772 {6, 6, 6}, /* cost of loading mask register
1773 in QImode, HImode, SImode. */
1774 {8, 8, 8}, /* cost if storing mask register
1775 in QImode, HImode, SImode. */
1776 2, /* cost of moving mask register. */
1777 /* End of register allocator costs. */
1778 },
1779
1780 COSTS_N_INSNS (1), /* cost of an add instruction. */
1781 COSTS_N_INSNS (1), /* cost of a lea instruction. */
1782 COSTS_N_INSNS (1), /* variable shift costs. */
1783 COSTS_N_INSNS (1), /* constant shift costs. */
1784 {COSTS_N_INSNS (3), /* cost of starting multiply for QI. */
1785 COSTS_N_INSNS (3), /* HI. */
1786 COSTS_N_INSNS (3), /* SI. */
1787 COSTS_N_INSNS (3), /* DI. */
1788 COSTS_N_INSNS (3)}, /* other. */
1789 0, /* cost of multiply per each bit
1790 set. */
1791 {COSTS_N_INSNS (9), /* cost of a divide/mod for QI. */
1792 COSTS_N_INSNS (10), /* HI. */
1793 COSTS_N_INSNS (12), /* SI. */
1794 COSTS_N_INSNS (17), /* DI. */
1795 COSTS_N_INSNS (17)}, /* other. */
1796 COSTS_N_INSNS (1), /* cost of movsx. */
1797 COSTS_N_INSNS (1), /* cost of movzx. */
1798 8, /* "large" insn. */
1799 9, /* MOVE_RATIO. */
1800 6, /* CLEAR_RATIO */
1801 {6, 6, 6}, /* cost of loading integer registers
1802 in QImode, HImode and SImode.
1803 Relative to reg-reg move (2). */
1804 {8, 8, 8}, /* cost of storing integer
1805 registers. */
1806 {6, 6, 6, 6, 12}, /* cost of loading SSE registers
1807 in 32bit, 64bit, 128bit, 256bit and 512bit */
1808 {8, 8, 8, 8, 16}, /* cost of storing SSE register
1809 in 32bit, 64bit, 128bit, 256bit and 512bit */
1810 {6, 6, 6, 6, 12}, /* cost of unaligned loads. */
1811 {8, 8, 8, 8, 16}, /* cost of unaligned stores. */
1812 2, 2, 3, /* cost of moving XMM,YMM,ZMM
1813 register. */
1814 6, /* cost of moving SSE register to integer. */
1815 /* VGATHERDPD is 15 uops and throughput is 4, VGATHERDPS is 23 uops,
1816 throughput 9. Approx 7 uops do not depend on vector size and every load
1817 is 4 uops. */
1818 14, 8, /* Gather load static, per_elt. */
1819 14, 10, /* Gather store static, per_elt. */
1820 32, /* size of l1 cache. */
1821 512, /* size of l2 cache. */
1822 64, /* size of prefetch block. */
1823 /* New AMD processors never drop prefetches; if they cannot be performed
1824 immediately, they are queued. We set number of simultaneous prefetches
1825 to a large constant to reflect this (it probably is not a good idea not
1826 to limit number of prefetches at all, as their execution also takes some
1827 time). */
1828 100, /* number of parallel prefetches. */
1829 3, /* Branch cost. */
1830 COSTS_N_INSNS (5), /* cost of FADD and FSUB insns. */
1831 COSTS_N_INSNS (5), /* cost of FMUL instruction. */
1832 /* Latency of fdiv is 8-15. */
1833 COSTS_N_INSNS (15), /* cost of FDIV instruction. */
1834 COSTS_N_INSNS (1), /* cost of FABS instruction. */
1835 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
1836 /* Latency of fsqrt is 4-10. */
1837 COSTS_N_INSNS (10), /* cost of FSQRT instruction. */
1838
1839 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
1840 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
1841 COSTS_N_INSNS (3), /* cost of MULSS instruction. */
1842 COSTS_N_INSNS (3), /* cost of MULSD instruction. */
1843 COSTS_N_INSNS (5), /* cost of FMA SS instruction. */
1844 COSTS_N_INSNS (5), /* cost of FMA SD instruction. */
1845 COSTS_N_INSNS (10), /* cost of DIVSS instruction. */
1846 /* 9-13. */
1847 COSTS_N_INSNS (13), /* cost of DIVSD instruction. */
1848 COSTS_N_INSNS (10), /* cost of SQRTSS instruction. */
1849 COSTS_N_INSNS (15), /* cost of SQRTSD instruction. */
1850 /* Zen can execute 4 integer operations per cycle. FP operations
1851 take 3 cycles and it can execute 2 integer additions and 2
1852 multiplications thus reassociation may make sense up to with of 6.
1853 SPEC2k6 bencharks suggests
1854 that 4 works better than 6 probably due to register pressure.
1855
1856 Integer vector operations are taken by FP unit and execute 3 vector
1857 plus/minus operations per cycle but only one multiply. This is adjusted
1858 in ix86_reassociation_width. */
1859 4, 4, 3, 6, /* reassoc int, fp, vec_int, vec_fp. */
1860 znver2_memcpy,
1861 znver2_memset,
1862 COSTS_N_INSNS (4), /* cond_taken_branch_cost. */
1863 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
1864 "16", /* Loop alignment. */
1865 "16", /* Jump alignment. */
1866 "0:0:8", /* Label alignment. */
1867 "16", /* Func alignment. */
1868 4, /* Small unroll limit. */
1869 2, /* Small unroll factor. */
1870 COSTS_N_INSNS (2), /* Branch mispredict scale. */
1871 };
1872
1873 /* This table currently replicates znver3_cost table. */
1874 struct processor_costs znver4_cost = {
1875 {
1876 /* Start of register allocator costs. integer->integer move cost is 2. */
1877
1878 /* reg-reg moves are done by renaming and thus they are even cheaper than
1879 1 cycle. Because reg-reg move cost is 2 and following tables correspond
1880 to doubles of latencies, we do not model this correctly. It does not
1881 seem to make practical difference to bump prices up even more. */
1882 6, /* cost for loading QImode using
1883 movzbl. */
1884 {6, 6, 6}, /* cost of loading integer registers
1885 in QImode, HImode and SImode.
1886 Relative to reg-reg move (2). */
1887 {8, 8, 8}, /* cost of storing integer
1888 registers. */
1889 2, /* cost of reg,reg fld/fst. */
1890 {14, 14, 17}, /* cost of loading fp registers
1891 in SFmode, DFmode and XFmode. */
1892 {12, 12, 16}, /* cost of storing fp registers
1893 in SFmode, DFmode and XFmode. */
1894 2, /* cost of moving MMX register. */
1895 {6, 6}, /* cost of loading MMX registers
1896 in SImode and DImode. */
1897 {8, 8}, /* cost of storing MMX registers
1898 in SImode and DImode. */
1899 2, 2, 3, /* cost of moving XMM,YMM,ZMM
1900 register. */
1901 {6, 6, 10, 10, 12}, /* cost of loading SSE registers
1902 in 32,64,128,256 and 512-bit. */
1903 {8, 8, 8, 12, 12}, /* cost of storing SSE registers
1904 in 32,64,128,256 and 512-bit. */
1905 6, 8, /* SSE->integer and integer->SSE
1906 moves. */
1907 8, 8, /* mask->integer and integer->mask moves */
1908 {6, 6, 6}, /* cost of loading mask register
1909 in QImode, HImode, SImode. */
1910 {8, 8, 8}, /* cost if storing mask register
1911 in QImode, HImode, SImode. */
1912 2, /* cost of moving mask register. */
1913 /* End of register allocator costs. */
1914 },
1915
1916 COSTS_N_INSNS (1), /* cost of an add instruction. */
1917 /* TODO: Lea with 3 components has cost 2. */
1918 COSTS_N_INSNS (1), /* cost of a lea instruction. */
1919 COSTS_N_INSNS (1), /* variable shift costs. */
1920 COSTS_N_INSNS (1), /* constant shift costs. */
1921 {COSTS_N_INSNS (3), /* cost of starting multiply for QI. */
1922 COSTS_N_INSNS (3), /* HI. */
1923 COSTS_N_INSNS (3), /* SI. */
1924 COSTS_N_INSNS (3), /* DI. */
1925 COSTS_N_INSNS (3)}, /* other. */
1926 0, /* cost of multiply per each bit
1927 set. */
1928 {COSTS_N_INSNS (12), /* cost of a divide/mod for QI. */
1929 COSTS_N_INSNS (13), /* HI. */
1930 COSTS_N_INSNS (13), /* SI. */
1931 COSTS_N_INSNS (18), /* DI. */
1932 COSTS_N_INSNS (18)}, /* other. */
1933 COSTS_N_INSNS (1), /* cost of movsx. */
1934 COSTS_N_INSNS (1), /* cost of movzx. */
1935 8, /* "large" insn. */
1936 9, /* MOVE_RATIO. */
1937 6, /* CLEAR_RATIO */
1938 {6, 6, 6}, /* cost of loading integer registers
1939 in QImode, HImode and SImode.
1940 Relative to reg-reg move (2). */
1941 {8, 8, 8}, /* cost of storing integer
1942 registers. */
1943 {6, 6, 10, 10, 12}, /* cost of loading SSE registers
1944 in 32bit, 64bit, 128bit, 256bit and 512bit */
1945 {8, 8, 8, 12, 12}, /* cost of storing SSE register
1946 in 32bit, 64bit, 128bit, 256bit and 512bit */
1947 {6, 6, 10, 10, 12}, /* cost of unaligned loads. */
1948 {8, 8, 8, 12, 12}, /* cost of unaligned stores. */
1949 2, 2, 2, /* cost of moving XMM,YMM,ZMM
1950 register. */
1951 6, /* cost of moving SSE register to integer. */
1952 /* VGATHERDPD is 17 uops and throughput is 4, VGATHERDPS is 24 uops,
1953 throughput 5. Approx 7 uops do not depend on vector size and every load
1954 is 5 uops. */
1955 14, 10, /* Gather load static, per_elt. */
1956 14, 20, /* Gather store static, per_elt. */
1957 32, /* size of l1 cache. */
1958 1024, /* size of l2 cache. */
1959 64, /* size of prefetch block. */
1960 /* New AMD processors never drop prefetches; if they cannot be performed
1961 immediately, they are queued. We set number of simultaneous prefetches
1962 to a large constant to reflect this (it probably is not a good idea not
1963 to limit number of prefetches at all, as their execution also takes some
1964 time). */
1965 100, /* number of parallel prefetches. */
1966 3, /* Branch cost. */
1967 COSTS_N_INSNS (7), /* cost of FADD and FSUB insns. */
1968 COSTS_N_INSNS (7), /* cost of FMUL instruction. */
1969 /* Latency of fdiv is 8-15. */
1970 COSTS_N_INSNS (15), /* cost of FDIV instruction. */
1971 COSTS_N_INSNS (1), /* cost of FABS instruction. */
1972 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
1973 /* Latency of fsqrt is 4-10. */
1974 COSTS_N_INSNS (25), /* cost of FSQRT instruction. */
1975
1976 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
1977 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
1978 COSTS_N_INSNS (3), /* cost of MULSS instruction. */
1979 COSTS_N_INSNS (3), /* cost of MULSD instruction. */
1980 COSTS_N_INSNS (4), /* cost of FMA SS instruction. */
1981 COSTS_N_INSNS (4), /* cost of FMA SD instruction. */
1982 COSTS_N_INSNS (13), /* cost of DIVSS instruction. */
1983 /* 9-13. */
1984 COSTS_N_INSNS (13), /* cost of DIVSD instruction. */
1985 COSTS_N_INSNS (15), /* cost of SQRTSS instruction. */
1986 COSTS_N_INSNS (21), /* cost of SQRTSD instruction. */
1987 /* Zen can execute 4 integer operations per cycle. FP operations
1988 take 3 cycles and it can execute 2 integer additions and 2
1989 multiplications thus reassociation may make sense up to with of 6.
1990 SPEC2k6 bencharks suggests
1991 that 4 works better than 6 probably due to register pressure.
1992
1993 Integer vector operations are taken by FP unit and execute 3 vector
1994 plus/minus operations per cycle but only one multiply. This is adjusted
1995 in ix86_reassociation_width. */
1996 4, 4, 3, 6, /* reassoc int, fp, vec_int, vec_fp. */
1997 znver2_memcpy,
1998 znver2_memset,
1999 COSTS_N_INSNS (4), /* cond_taken_branch_cost. */
2000 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
2001 "16", /* Loop alignment. */
2002 "16", /* Jump alignment. */
2003 "0:0:8", /* Label alignment. */
2004 "16", /* Func alignment. */
2005 4, /* Small unroll limit. */
2006 2, /* Small unroll factor. */
2007 COSTS_N_INSNS (2), /* Branch mispredict scale. */
2008 };
2009
2010 /* This table currently replicates znver4_cost table. */
2011 struct processor_costs znver5_cost = {
2012 {
2013 /* Start of register allocator costs. integer->integer move cost is 2. */
2014
2015 /* reg-reg moves are done by renaming and thus they are even cheaper than
2016 1 cycle. Because reg-reg move cost is 2 and following tables correspond
2017 to doubles of latencies, we do not model this correctly. It does not
2018 seem to make practical difference to bump prices up even more. */
2019 6, /* cost for loading QImode using
2020 movzbl. */
2021 {6, 6, 6}, /* cost of loading integer registers
2022 in QImode, HImode and SImode.
2023 Relative to reg-reg move (2). */
2024 {8, 8, 8}, /* cost of storing integer
2025 registers. */
2026 2, /* cost of reg,reg fld/fst. */
2027 {14, 14, 17}, /* cost of loading fp registers
2028 in SFmode, DFmode and XFmode. */
2029 {12, 12, 16}, /* cost of storing fp registers
2030 in SFmode, DFmode and XFmode. */
2031 2, /* cost of moving MMX register. */
2032 {6, 6}, /* cost of loading MMX registers
2033 in SImode and DImode. */
2034 {8, 8}, /* cost of storing MMX registers
2035 in SImode and DImode. */
2036 2, 2, 3, /* cost of moving XMM,YMM,ZMM
2037 register. */
2038 {6, 6, 10, 10, 12}, /* cost of loading SSE registers
2039 in 32,64,128,256 and 512-bit. */
2040 {8, 8, 8, 12, 12}, /* cost of storing SSE registers
2041 in 32,64,128,256 and 512-bit. */
2042 6, 8, /* SSE->integer and integer->SSE
2043 moves. */
2044 8, 8, /* mask->integer and integer->mask moves */
2045 {6, 6, 6}, /* cost of loading mask register
2046 in QImode, HImode, SImode. */
2047 {8, 8, 8}, /* cost if storing mask register
2048 in QImode, HImode, SImode. */
2049 2, /* cost of moving mask register. */
2050 /* End of register allocator costs. */
2051 },
2052
2053 COSTS_N_INSNS (1), /* cost of an add instruction. */
2054 /* TODO: Lea with 3 components has cost 2. */
2055 COSTS_N_INSNS (1), /* cost of a lea instruction. */
2056 COSTS_N_INSNS (1), /* variable shift costs. */
2057 COSTS_N_INSNS (1), /* constant shift costs. */
2058 /* mul has latency 3, executes in 3 integer units. */
2059 {COSTS_N_INSNS (3), /* cost of starting multiply for QI. */
2060 COSTS_N_INSNS (3), /* HI. */
2061 COSTS_N_INSNS (3), /* SI. */
2062 COSTS_N_INSNS (3), /* DI. */
2063 COSTS_N_INSNS (3)}, /* other. */
2064 0, /* cost of multiply per each bit
2065 set. */
2066 /* integer divide has latency of 8 cycles
2067 plus 1 for every 9 bits of quotient. */
2068 {COSTS_N_INSNS (10), /* cost of a divide/mod for QI. */
2069 COSTS_N_INSNS (11), /* HI. */
2070 COSTS_N_INSNS (13), /* SI. */
2071 COSTS_N_INSNS (16), /* DI. */
2072 COSTS_N_INSNS (16)}, /* other. */
2073 COSTS_N_INSNS (1), /* cost of movsx. */
2074 COSTS_N_INSNS (1), /* cost of movzx. */
2075 15, /* "large" insn. */
2076 9, /* MOVE_RATIO. */
2077 6, /* CLEAR_RATIO */
2078 {6, 6, 6}, /* cost of loading integer registers
2079 in QImode, HImode and SImode.
2080 Relative to reg-reg move (2). */
2081 {8, 8, 8}, /* cost of storing integer
2082 registers. */
2083 {6, 6, 10, 10, 12}, /* cost of loading SSE registers
2084 in 32bit, 64bit, 128bit, 256bit and 512bit */
2085 {8, 8, 8, 12, 12}, /* cost of storing SSE register
2086 in 32bit, 64bit, 128bit, 256bit and 512bit */
2087 {6, 6, 10, 10, 12}, /* cost of unaligned loads. */
2088 {8, 8, 8, 12, 12}, /* cost of unaligned stores. */
2089 2, 2, 2, /* cost of moving XMM,YMM,ZMM
2090 register. */
2091 6, /* cost of moving SSE register to integer. */
2092
2093 /* TODO: gather and scatter instructions are currently disabled in
2094 x86-tune.def. In some cases they are however a win, see PR116582
2095 We however need good cost model for them. */
2096 14, 10, /* Gather load static, per_elt. */
2097 14, 20, /* Gather store static, per_elt. */
2098 48, /* size of l1 cache. */
2099 1024, /* size of l2 cache. */
2100 64, /* size of prefetch block. */
2101 /* New AMD processors never drop prefetches; if they cannot be performed
2102 immediately, they are queued. We set number of simultaneous prefetches
2103 to a large constant to reflect this (it probably is not a good idea not
2104 to limit number of prefetches at all, as their execution also takes some
2105 time). */
2106 100, /* number of parallel prefetches. */
2107 3, /* Branch cost. */
2108 /* TODO x87 latencies are still based on znver4.
2109 Probably not very important these days. */
2110 COSTS_N_INSNS (7), /* cost of FADD and FSUB insns. */
2111 COSTS_N_INSNS (7), /* cost of FMUL instruction. */
2112 /* Latency of fdiv is 8-15. */
2113 COSTS_N_INSNS (15), /* cost of FDIV instruction. */
2114 COSTS_N_INSNS (1), /* cost of FABS instruction. */
2115 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
2116 /* Latency of fsqrt is 4-10. */
2117 COSTS_N_INSNS (25), /* cost of FSQRT instruction. */
2118
2119 /* SSE instructions have typical throughput 4 and latency 1. */
2120 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
2121 /* ADDSS has throughput 2 and latency 2
2122 (in some cases when source is another addition). */
2123 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
2124 /* MULSS has throughput 2 and latency 3. */
2125 COSTS_N_INSNS (3), /* cost of MULSS instruction. */
2126 COSTS_N_INSNS (3), /* cost of MULSD instruction. */
2127 /* FMA had throughput 2 and latency 4. */
2128 COSTS_N_INSNS (4), /* cost of FMA SS instruction. */
2129 COSTS_N_INSNS (4), /* cost of FMA SD instruction. */
2130 /* DIVSS has throughtput 0.4 and latency 10. */
2131 COSTS_N_INSNS (10), /* cost of DIVSS instruction. */
2132 /* DIVSD has throughtput 0.25 and latency 13. */
2133 COSTS_N_INSNS (13), /* cost of DIVSD instruction. */
2134 /* DIVSD has throughtput 0.22 and latency 14. */
2135 COSTS_N_INSNS (14), /* cost of SQRTSS instruction. */
2136 /* DIVSD has throughtput 0.13 and latency 20. */
2137 COSTS_N_INSNS (20), /* cost of SQRTSD instruction. */
2138 /* Zen5 can execute:
2139 - integer ops: 6 per cycle, at most 3 multiplications.
2140 latency 1 for additions, 3 for multiplications (pipelined)
2141
2142 Setting width of 9 for multiplication is probably excessive
2143 for register pressure.
2144 - fp ops: 2 additions per cycle, latency 2-3
2145 2 multiplicaitons per cycle, latency 3
2146 - vector intger ops: 4 additions, latency 1
2147 2 multiplications, latency 4
2148 We increase width to 6 for multiplications
2149 in ix86_reassociation_width. */
2150 6, 6, 4, 6, /* reassoc int, fp, vec_int, vec_fp. */
2151 znver2_memcpy,
2152 znver2_memset,
2153 COSTS_N_INSNS (4), /* cond_taken_branch_cost. */
2154 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
2155 "16", /* Loop alignment. */
2156 "16", /* Jump alignment. */
2157 "0:0:8", /* Label alignment. */
2158 "16", /* Func alignment. */
2159 4, /* Small unroll limit. */
2160 2, /* Small unroll factor. */
2161 COSTS_N_INSNS (2), /* Branch mispredict scale. */
2162 };
2163
2164 /* skylake_cost should produce code tuned for Skylake familly of CPUs. */
2165 static stringop_algs skylake_memcpy[2] = {
2166 {libcall,
2167 {{256, rep_prefix_1_byte, true},
2168 {256, loop, false},
2169 {-1, libcall, false}}},
2170 {libcall,
2171 {{256, rep_prefix_1_byte, true},
2172 {256, loop, false},
2173 {-1, libcall, false}}}};
2174
2175 static stringop_algs skylake_memset[2] = {
2176 {libcall,
2177 {{256, rep_prefix_1_byte, true},
2178 {256, loop, false},
2179 {-1, libcall, false}}},
2180 {libcall,
2181 {{256, rep_prefix_1_byte, true},
2182 {256, loop, false},
2183 {-1, libcall, false}}}};
2184
2185 static const
2186 struct processor_costs skylake_cost = {
2187 {
2188 /* Start of register allocator costs. integer->integer move cost is 2. */
2189 6, /* cost for loading QImode using movzbl */
2190 {4, 4, 4}, /* cost of loading integer registers
2191 in QImode, HImode and SImode.
2192 Relative to reg-reg move (2). */
2193 {6, 6, 6}, /* cost of storing integer registers */
2194 2, /* cost of reg,reg fld/fst */
2195 {6, 6, 8}, /* cost of loading fp registers
2196 in SFmode, DFmode and XFmode */
2197 {6, 6, 10}, /* cost of storing fp registers
2198 in SFmode, DFmode and XFmode */
2199 2, /* cost of moving MMX register */
2200 {6, 6}, /* cost of loading MMX registers
2201 in SImode and DImode */
2202 {6, 6}, /* cost of storing MMX registers
2203 in SImode and DImode */
2204 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */
2205 {6, 6, 6, 10, 20}, /* cost of loading SSE registers
2206 in 32,64,128,256 and 512-bit */
2207 {8, 8, 8, 12, 24}, /* cost of storing SSE registers
2208 in 32,64,128,256 and 512-bit */
2209 6, 6, /* SSE->integer and integer->SSE moves */
2210 6, 6, /* mask->integer and integer->mask moves */
2211 {8, 8, 8}, /* cost of loading mask register
2212 in QImode, HImode, SImode. */
2213 {6, 6, 6}, /* cost if storing mask register
2214 in QImode, HImode, SImode. */
2215 3, /* cost of moving mask register. */
2216 /* End of register allocator costs. */
2217 },
2218
2219 COSTS_N_INSNS (1), /* cost of an add instruction */
2220 COSTS_N_INSNS (1)+1, /* cost of a lea instruction */
2221 COSTS_N_INSNS (1), /* variable shift costs */
2222 COSTS_N_INSNS (1), /* constant shift costs */
2223 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
2224 COSTS_N_INSNS (3), /* HI */
2225 COSTS_N_INSNS (3), /* SI */
2226 COSTS_N_INSNS (3), /* DI */
2227 COSTS_N_INSNS (3)}, /* other */
2228 0, /* cost of multiply per each bit set */
2229 /* Expanding div/mod currently doesn't consider parallelism. So the cost
2230 model is not realistic. We compensate by increasing the latencies a bit. */
2231 {COSTS_N_INSNS (11), /* cost of a divide/mod for QI */
2232 COSTS_N_INSNS (11), /* HI */
2233 COSTS_N_INSNS (14), /* SI */
2234 COSTS_N_INSNS (76), /* DI */
2235 COSTS_N_INSNS (76)}, /* other */
2236 COSTS_N_INSNS (1), /* cost of movsx */
2237 COSTS_N_INSNS (0), /* cost of movzx */
2238 8, /* "large" insn */
2239 17, /* MOVE_RATIO */
2240 17, /* CLEAR_RATIO */
2241 {6, 6, 6}, /* cost of loading integer registers
2242 in QImode, HImode and SImode.
2243 Relative to reg-reg move (2). */
2244 {8, 8, 8}, /* cost of storing integer registers */
2245 {8, 8, 8, 8, 16}, /* cost of loading SSE register
2246 in 32bit, 64bit, 128bit, 256bit and 512bit */
2247 {8, 8, 8, 8, 16}, /* cost of storing SSE register
2248 in 32bit, 64bit, 128bit, 256bit and 512bit */
2249 {8, 8, 8, 8, 16}, /* cost of unaligned loads. */
2250 {8, 8, 8, 8, 16}, /* cost of unaligned stores. */
2251 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */
2252 6, /* cost of moving SSE register to integer. */
2253 20, 8, /* Gather load static, per_elt. */
2254 22, 10, /* Gather store static, per_elt. */
2255 64, /* size of l1 cache. */
2256 512, /* size of l2 cache. */
2257 64, /* size of prefetch block */
2258 6, /* number of parallel prefetches */
2259 3, /* Branch cost */
2260 COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */
2261 COSTS_N_INSNS (4), /* cost of FMUL instruction. */
2262 COSTS_N_INSNS (20), /* cost of FDIV instruction. */
2263 COSTS_N_INSNS (1), /* cost of FABS instruction. */
2264 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
2265 COSTS_N_INSNS (20), /* cost of FSQRT instruction. */
2266
2267 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
2268 COSTS_N_INSNS (4), /* cost of ADDSS/SD SUBSS/SD insns. */
2269 COSTS_N_INSNS (4), /* cost of MULSS instruction. */
2270 COSTS_N_INSNS (4), /* cost of MULSD instruction. */
2271 COSTS_N_INSNS (4), /* cost of FMA SS instruction. */
2272 COSTS_N_INSNS (4), /* cost of FMA SD instruction. */
2273 COSTS_N_INSNS (11), /* cost of DIVSS instruction. */
2274 COSTS_N_INSNS (14), /* cost of DIVSD instruction. */
2275 COSTS_N_INSNS (12), /* cost of SQRTSS instruction. */
2276 COSTS_N_INSNS (18), /* cost of SQRTSD instruction. */
2277 1, 4, 2, 2, /* reassoc int, fp, vec_int, vec_fp. */
2278 skylake_memcpy,
2279 skylake_memset,
2280 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
2281 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
2282 "16:11:8", /* Loop alignment. */
2283 "16:11:8", /* Jump alignment. */
2284 "0:0:8", /* Label alignment. */
2285 "16", /* Func alignment. */
2286 4, /* Small unroll limit. */
2287 2, /* Small unroll factor. */
2288 COSTS_N_INSNS (2), /* Branch mispredict scale. */
2289 };
2290
2291 /* icelake_cost should produce code tuned for Icelake family of CPUs.
2292 NB: rep_prefix_1_byte is used only for known size. */
2293
2294 static stringop_algs icelake_memcpy[2] = {
2295 {libcall,
2296 {{256, rep_prefix_1_byte, true},
2297 {256, loop, false},
2298 {-1, libcall, false}}},
2299 {libcall,
2300 {{256, rep_prefix_1_byte, true},
2301 {256, loop, false},
2302 {-1, libcall, false}}}};
2303
2304 static stringop_algs icelake_memset[2] = {
2305 {libcall,
2306 {{256, rep_prefix_1_byte, true},
2307 {256, loop, false},
2308 {-1, libcall, false}}},
2309 {libcall,
2310 {{256, rep_prefix_1_byte, true},
2311 {256, loop, false},
2312 {-1, libcall, false}}}};
2313
2314 static const
2315 struct processor_costs icelake_cost = {
2316 {
2317 /* Start of register allocator costs. integer->integer move cost is 2. */
2318 6, /* cost for loading QImode using movzbl */
2319 {4, 4, 4}, /* cost of loading integer registers
2320 in QImode, HImode and SImode.
2321 Relative to reg-reg move (2). */
2322 {6, 6, 6}, /* cost of storing integer registers */
2323 2, /* cost of reg,reg fld/fst */
2324 {6, 6, 8}, /* cost of loading fp registers
2325 in SFmode, DFmode and XFmode */
2326 {6, 6, 10}, /* cost of storing fp registers
2327 in SFmode, DFmode and XFmode */
2328 2, /* cost of moving MMX register */
2329 {6, 6}, /* cost of loading MMX registers
2330 in SImode and DImode */
2331 {6, 6}, /* cost of storing MMX registers
2332 in SImode and DImode */
2333 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */
2334 {6, 6, 6, 10, 20}, /* cost of loading SSE registers
2335 in 32,64,128,256 and 512-bit */
2336 {8, 8, 8, 12, 24}, /* cost of storing SSE registers
2337 in 32,64,128,256 and 512-bit */
2338 6, 6, /* SSE->integer and integer->SSE moves */
2339 6, 6, /* mask->integer and integer->mask moves */
2340 {8, 8, 8}, /* cost of loading mask register
2341 in QImode, HImode, SImode. */
2342 {6, 6, 6}, /* cost if storing mask register
2343 in QImode, HImode, SImode. */
2344 3, /* cost of moving mask register. */
2345 /* End of register allocator costs. */
2346 },
2347
2348 COSTS_N_INSNS (1), /* cost of an add instruction */
2349 COSTS_N_INSNS (1)+1, /* cost of a lea instruction */
2350 COSTS_N_INSNS (1), /* variable shift costs */
2351 COSTS_N_INSNS (1), /* constant shift costs */
2352 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
2353 COSTS_N_INSNS (3), /* HI */
2354 COSTS_N_INSNS (3), /* SI */
2355 COSTS_N_INSNS (3), /* DI */
2356 COSTS_N_INSNS (3)}, /* other */
2357 0, /* cost of multiply per each bit set */
2358 /* Expanding div/mod currently doesn't consider parallelism. So the cost
2359 model is not realistic. We compensate by increasing the latencies a bit. */
2360 {COSTS_N_INSNS (11), /* cost of a divide/mod for QI */
2361 COSTS_N_INSNS (11), /* HI */
2362 COSTS_N_INSNS (14), /* SI */
2363 COSTS_N_INSNS (76), /* DI */
2364 COSTS_N_INSNS (76)}, /* other */
2365 COSTS_N_INSNS (1), /* cost of movsx */
2366 COSTS_N_INSNS (0), /* cost of movzx */
2367 8, /* "large" insn */
2368 17, /* MOVE_RATIO */
2369 17, /* CLEAR_RATIO */
2370 {6, 6, 6}, /* cost of loading integer registers
2371 in QImode, HImode and SImode.
2372 Relative to reg-reg move (2). */
2373 {8, 8, 8}, /* cost of storing integer registers */
2374 {8, 8, 8, 8, 16}, /* cost of loading SSE register
2375 in 32bit, 64bit, 128bit, 256bit and 512bit */
2376 {8, 8, 8, 8, 16}, /* cost of storing SSE register
2377 in 32bit, 64bit, 128bit, 256bit and 512bit */
2378 {8, 8, 8, 8, 16}, /* cost of unaligned loads. */
2379 {8, 8, 8, 8, 16}, /* cost of unaligned stores. */
2380 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */
2381 6, /* cost of moving SSE register to integer. */
2382 20, 8, /* Gather load static, per_elt. */
2383 22, 10, /* Gather store static, per_elt. */
2384 64, /* size of l1 cache. */
2385 512, /* size of l2 cache. */
2386 64, /* size of prefetch block */
2387 6, /* number of parallel prefetches */
2388 3, /* Branch cost */
2389 COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */
2390 COSTS_N_INSNS (4), /* cost of FMUL instruction. */
2391 COSTS_N_INSNS (20), /* cost of FDIV instruction. */
2392 COSTS_N_INSNS (1), /* cost of FABS instruction. */
2393 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
2394 COSTS_N_INSNS (20), /* cost of FSQRT instruction. */
2395
2396 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
2397 COSTS_N_INSNS (4), /* cost of ADDSS/SD SUBSS/SD insns. */
2398 COSTS_N_INSNS (4), /* cost of MULSS instruction. */
2399 COSTS_N_INSNS (4), /* cost of MULSD instruction. */
2400 COSTS_N_INSNS (4), /* cost of FMA SS instruction. */
2401 COSTS_N_INSNS (4), /* cost of FMA SD instruction. */
2402 COSTS_N_INSNS (11), /* cost of DIVSS instruction. */
2403 COSTS_N_INSNS (14), /* cost of DIVSD instruction. */
2404 COSTS_N_INSNS (12), /* cost of SQRTSS instruction. */
2405 COSTS_N_INSNS (18), /* cost of SQRTSD instruction. */
2406 1, 4, 2, 2, /* reassoc int, fp, vec_int, vec_fp. */
2407 icelake_memcpy,
2408 icelake_memset,
2409 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
2410 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
2411 "16:11:8", /* Loop alignment. */
2412 "16:11:8", /* Jump alignment. */
2413 "0:0:8", /* Label alignment. */
2414 "16", /* Func alignment. */
2415 4, /* Small unroll limit. */
2416 2, /* Small unroll factor. */
2417 COSTS_N_INSNS (2) + 3, /* Branch mispredict scale. */
2418 };
2419
2420 /* alderlake_cost should produce code tuned for alderlake family of CPUs. */
2421 static stringop_algs alderlake_memcpy[2] = {
2422 {libcall,
2423 {{256, rep_prefix_1_byte, true},
2424 {256, loop, false},
2425 {-1, libcall, false}}},
2426 {libcall,
2427 {{256, rep_prefix_1_byte, true},
2428 {256, loop, false},
2429 {-1, libcall, false}}}};
2430 static stringop_algs alderlake_memset[2] = {
2431 {libcall,
2432 {{256, rep_prefix_1_byte, true},
2433 {256, loop, false},
2434 {-1, libcall, false}}},
2435 {libcall,
2436 {{256, rep_prefix_1_byte, true},
2437 {256, loop, false},
2438 {-1, libcall, false}}}};
2439 static const
2440 struct processor_costs alderlake_cost = {
2441 {
2442 /* Start of register allocator costs. integer->integer move cost is 2. */
2443 6, /* cost for loading QImode using movzbl */
2444 {6, 6, 6}, /* cost of loading integer registers
2445 in QImode, HImode and SImode.
2446 Relative to reg-reg move (2). */
2447 {6, 6, 6}, /* cost of storing integer registers */
2448 4, /* cost of reg,reg fld/fst */
2449 {6, 6, 12}, /* cost of loading fp registers
2450 in SFmode, DFmode and XFmode */
2451 {6, 6, 12}, /* cost of storing fp registers
2452 in SFmode, DFmode and XFmode */
2453 2, /* cost of moving MMX register */
2454 {6, 6}, /* cost of loading MMX registers
2455 in SImode and DImode */
2456 {6, 6}, /* cost of storing MMX registers
2457 in SImode and DImode */
2458 2, 3, 4, /* cost of moving XMM,YMM,ZMM register */
2459 {6, 6, 6, 10, 15}, /* cost of loading SSE registers
2460 in 32,64,128,256 and 512-bit */
2461 {6, 6, 6, 10, 15}, /* cost of storing SSE registers
2462 in 32,64,128,256 and 512-bit */
2463 6, 6, /* SSE->integer and integer->SSE moves */
2464 6, 6, /* mask->integer and integer->mask moves */
2465 {6, 6, 6}, /* cost of loading mask register
2466 in QImode, HImode, SImode. */
2467 {6, 6, 6}, /* cost if storing mask register
2468 in QImode, HImode, SImode. */
2469 2, /* cost of moving mask register. */
2470 /* End of register allocator costs. */
2471 },
2472
2473 COSTS_N_INSNS (1), /* cost of an add instruction */
2474 COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */
2475 COSTS_N_INSNS (1), /* variable shift costs */
2476 COSTS_N_INSNS (1), /* constant shift costs */
2477 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
2478 COSTS_N_INSNS (3), /* HI */
2479 COSTS_N_INSNS (3), /* SI */
2480 COSTS_N_INSNS (3), /* DI */
2481 COSTS_N_INSNS (4)}, /* other */
2482 0, /* cost of multiply per each bit set */
2483 {COSTS_N_INSNS (16), /* cost of a divide/mod for QI */
2484 COSTS_N_INSNS (22), /* HI */
2485 COSTS_N_INSNS (30), /* SI */
2486 COSTS_N_INSNS (74), /* DI */
2487 COSTS_N_INSNS (74)}, /* other */
2488 COSTS_N_INSNS (1), /* cost of movsx */
2489 COSTS_N_INSNS (1), /* cost of movzx */
2490 8, /* "large" insn */
2491 17, /* MOVE_RATIO */
2492 17, /* CLEAR_RATIO */
2493 {6, 6, 6}, /* cost of loading integer registers
2494 in QImode, HImode and SImode.
2495 Relative to reg-reg move (2). */
2496 {8, 8, 8}, /* cost of storing integer registers */
2497 {8, 8, 8, 10, 15}, /* cost of loading SSE register
2498 in 32bit, 64bit, 128bit, 256bit and 512bit */
2499 {8, 8, 8, 10, 15}, /* cost of storing SSE register
2500 in 32bit, 64bit, 128bit, 256bit and 512bit */
2501 {8, 8, 8, 10, 15}, /* cost of unaligned loads. */
2502 {8, 8, 8, 10, 15}, /* cost of unaligned storess. */
2503 2, 3, 4, /* cost of moving XMM,YMM,ZMM register */
2504 6, /* cost of moving SSE register to integer. */
2505 18, 6, /* Gather load static, per_elt. */
2506 18, 6, /* Gather store static, per_elt. */
2507 32, /* size of l1 cache. */
2508 512, /* size of l2 cache. */
2509 64, /* size of prefetch block */
2510 6, /* number of parallel prefetches */
2511 3, /* Branch cost */
2512 COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */
2513 COSTS_N_INSNS (5), /* cost of FMUL instruction. */
2514 COSTS_N_INSNS (17), /* cost of FDIV instruction. */
2515 COSTS_N_INSNS (1), /* cost of FABS instruction. */
2516 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
2517 COSTS_N_INSNS (14), /* cost of FSQRT instruction. */
2518
2519 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
2520 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
2521 COSTS_N_INSNS (4), /* cost of MULSS instruction. */
2522 COSTS_N_INSNS (5), /* cost of MULSD instruction. */
2523 COSTS_N_INSNS (5), /* cost of FMA SS instruction. */
2524 COSTS_N_INSNS (5), /* cost of FMA SD instruction. */
2525 COSTS_N_INSNS (13), /* cost of DIVSS instruction. */
2526 COSTS_N_INSNS (17), /* cost of DIVSD instruction. */
2527 COSTS_N_INSNS (14), /* cost of SQRTSS instruction. */
2528 COSTS_N_INSNS (18), /* cost of SQRTSD instruction. */
2529 1, 4, 3, 3, /* reassoc int, fp, vec_int, vec_fp. */
2530 alderlake_memcpy,
2531 alderlake_memset,
2532 COSTS_N_INSNS (4), /* cond_taken_branch_cost. */
2533 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
2534 "16:11:8", /* Loop alignment. */
2535 "16:11:8", /* Jump alignment. */
2536 "0:0:8", /* Label alignment. */
2537 "16", /* Func alignment. */
2538 4, /* Small unroll limit. */
2539 2, /* Small unroll factor. */
2540 COSTS_N_INSNS (2) + 3, /* Branch mispredict scale. */
2541 };
2542
2543 /* BTVER1 has optimized REP instruction for medium sized blocks, but for
2544 very small blocks it is better to use loop. For large blocks, libcall can
2545 do nontemporary accesses and beat inline considerably. */
2546 static stringop_algs btver1_memcpy[2] = {
2547 {libcall, {{6, loop, false}, {14, unrolled_loop, false},
2548 {-1, rep_prefix_4_byte, false}}},
2549 {libcall, {{16, loop, false}, {8192, rep_prefix_8_byte, false},
2550 {-1, libcall, false}}}};
2551 static stringop_algs btver1_memset[2] = {
2552 {libcall, {{8, loop, false}, {24, unrolled_loop, false},
2553 {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}},
2554 {libcall, {{48, unrolled_loop, false}, {8192, rep_prefix_8_byte, false},
2555 {-1, libcall, false}}}};
2556 const struct processor_costs btver1_cost = {
2557 {
2558 /* Start of register allocator costs. integer->integer move cost is 2. */
2559 8, /* cost for loading QImode using movzbl */
2560 {6, 8, 6}, /* cost of loading integer registers
2561 in QImode, HImode and SImode.
2562 Relative to reg-reg move (2). */
2563 {6, 8, 6}, /* cost of storing integer registers */
2564 4, /* cost of reg,reg fld/fst */
2565 {12, 12, 28}, /* cost of loading fp registers
2566 in SFmode, DFmode and XFmode */
2567 {12, 12, 38}, /* cost of storing fp registers
2568 in SFmode, DFmode and XFmode */
2569 4, /* cost of moving MMX register */
2570 {10, 10}, /* cost of loading MMX registers
2571 in SImode and DImode */
2572 {12, 12}, /* cost of storing MMX registers
2573 in SImode and DImode */
2574 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
2575 {10, 10, 12, 48, 96}, /* cost of loading SSE registers
2576 in 32,64,128,256 and 512-bit */
2577 {10, 10, 12, 48, 96}, /* cost of storing SSE registers
2578 in 32,64,128,256 and 512-bit */
2579 14, 14, /* SSE->integer and integer->SSE moves */
2580 14, 14, /* mask->integer and integer->mask moves */
2581 {6, 8, 6}, /* cost of loading mask register
2582 in QImode, HImode, SImode. */
2583 {6, 8, 6}, /* cost if storing mask register
2584 in QImode, HImode, SImode. */
2585 2, /* cost of moving mask register. */
2586 /* End of register allocator costs. */
2587 },
2588
2589 COSTS_N_INSNS (1), /* cost of an add instruction */
2590 COSTS_N_INSNS (2), /* cost of a lea instruction */
2591 COSTS_N_INSNS (1), /* variable shift costs */
2592 COSTS_N_INSNS (1), /* constant shift costs */
2593 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
2594 COSTS_N_INSNS (4), /* HI */
2595 COSTS_N_INSNS (3), /* SI */
2596 COSTS_N_INSNS (4), /* DI */
2597 COSTS_N_INSNS (5)}, /* other */
2598 0, /* cost of multiply per each bit set */
2599 {COSTS_N_INSNS (19), /* cost of a divide/mod for QI */
2600 COSTS_N_INSNS (35), /* HI */
2601 COSTS_N_INSNS (51), /* SI */
2602 COSTS_N_INSNS (83), /* DI */
2603 COSTS_N_INSNS (83)}, /* other */
2604 COSTS_N_INSNS (1), /* cost of movsx */
2605 COSTS_N_INSNS (1), /* cost of movzx */
2606 8, /* "large" insn */
2607 9, /* MOVE_RATIO */
2608 6, /* CLEAR_RATIO */
2609 {6, 8, 6}, /* cost of loading integer registers
2610 in QImode, HImode and SImode.
2611 Relative to reg-reg move (2). */
2612 {6, 8, 6}, /* cost of storing integer registers */
2613 {10, 10, 12, 48, 96}, /* cost of loading SSE register
2614 in 32bit, 64bit, 128bit, 256bit and 512bit */
2615 {10, 10, 12, 48, 96}, /* cost of storing SSE register
2616 in 32bit, 64bit, 128bit, 256bit and 512bit */
2617 {10, 10, 12, 48, 96}, /* cost of unaligned loads. */
2618 {10, 10, 12, 48, 96}, /* cost of unaligned stores. */
2619 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
2620 14, /* cost of moving SSE register to integer. */
2621 10, 10, /* Gather load static, per_elt. */
2622 10, 10, /* Gather store static, per_elt. */
2623 32, /* size of l1 cache. */
2624 512, /* size of l2 cache. */
2625 64, /* size of prefetch block */
2626 100, /* number of parallel prefetches */
2627 2, /* Branch cost */
2628 COSTS_N_INSNS (4), /* cost of FADD and FSUB insns. */
2629 COSTS_N_INSNS (4), /* cost of FMUL instruction. */
2630 COSTS_N_INSNS (19), /* cost of FDIV instruction. */
2631 COSTS_N_INSNS (2), /* cost of FABS instruction. */
2632 COSTS_N_INSNS (2), /* cost of FCHS instruction. */
2633 COSTS_N_INSNS (35), /* cost of FSQRT instruction. */
2634
2635 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
2636 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
2637 COSTS_N_INSNS (2), /* cost of MULSS instruction. */
2638 COSTS_N_INSNS (4), /* cost of MULSD instruction. */
2639 COSTS_N_INSNS (5), /* cost of FMA SS instruction. */
2640 COSTS_N_INSNS (5), /* cost of FMA SD instruction. */
2641 COSTS_N_INSNS (13), /* cost of DIVSS instruction. */
2642 COSTS_N_INSNS (17), /* cost of DIVSD instruction. */
2643 COSTS_N_INSNS (14), /* cost of SQRTSS instruction. */
2644 COSTS_N_INSNS (48), /* cost of SQRTSD instruction. */
2645 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
2646 btver1_memcpy,
2647 btver1_memset,
2648 COSTS_N_INSNS (2), /* cond_taken_branch_cost. */
2649 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
2650 "16:11:8", /* Loop alignment. */
2651 "16:8:8", /* Jump alignment. */
2652 "0:0:8", /* Label alignment. */
2653 "11", /* Func alignment. */
2654 4, /* Small unroll limit. */
2655 2, /* Small unroll factor. */
2656 COSTS_N_INSNS (2), /* Branch mispredict scale. */
2657 };
2658
2659 static stringop_algs btver2_memcpy[2] = {
2660 {libcall, {{6, loop, false}, {14, unrolled_loop, false},
2661 {-1, rep_prefix_4_byte, false}}},
2662 {libcall, {{16, loop, false}, {8192, rep_prefix_8_byte, false},
2663 {-1, libcall, false}}}};
2664 static stringop_algs btver2_memset[2] = {
2665 {libcall, {{8, loop, false}, {24, unrolled_loop, false},
2666 {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}},
2667 {libcall, {{48, unrolled_loop, false}, {8192, rep_prefix_8_byte, false},
2668 {-1, libcall, false}}}};
2669 const struct processor_costs btver2_cost = {
2670 {
2671 /* Start of register allocator costs. integer->integer move cost is 2. */
2672 8, /* cost for loading QImode using movzbl */
2673 {8, 8, 6}, /* cost of loading integer registers
2674 in QImode, HImode and SImode.
2675 Relative to reg-reg move (2). */
2676 {8, 8, 6}, /* cost of storing integer registers */
2677 4, /* cost of reg,reg fld/fst */
2678 {12, 12, 28}, /* cost of loading fp registers
2679 in SFmode, DFmode and XFmode */
2680 {12, 12, 38}, /* cost of storing fp registers
2681 in SFmode, DFmode and XFmode */
2682 4, /* cost of moving MMX register */
2683 {10, 10}, /* cost of loading MMX registers
2684 in SImode and DImode */
2685 {12, 12}, /* cost of storing MMX registers
2686 in SImode and DImode */
2687 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
2688 {10, 10, 12, 48, 96}, /* cost of loading SSE registers
2689 in 32,64,128,256 and 512-bit */
2690 {10, 10, 12, 48, 96}, /* cost of storing SSE registers
2691 in 32,64,128,256 and 512-bit */
2692 14, 14, /* SSE->integer and integer->SSE moves */
2693 14, 14, /* mask->integer and integer->mask moves */
2694 {8, 8, 6}, /* cost of loading mask register
2695 in QImode, HImode, SImode. */
2696 {8, 8, 6}, /* cost if storing mask register
2697 in QImode, HImode, SImode. */
2698 2, /* cost of moving mask register. */
2699 /* End of register allocator costs. */
2700 },
2701
2702 COSTS_N_INSNS (1), /* cost of an add instruction */
2703 COSTS_N_INSNS (2), /* cost of a lea instruction */
2704 COSTS_N_INSNS (1), /* variable shift costs */
2705 COSTS_N_INSNS (1), /* constant shift costs */
2706 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
2707 COSTS_N_INSNS (4), /* HI */
2708 COSTS_N_INSNS (3), /* SI */
2709 COSTS_N_INSNS (4), /* DI */
2710 COSTS_N_INSNS (5)}, /* other */
2711 0, /* cost of multiply per each bit set */
2712 {COSTS_N_INSNS (19), /* cost of a divide/mod for QI */
2713 COSTS_N_INSNS (35), /* HI */
2714 COSTS_N_INSNS (51), /* SI */
2715 COSTS_N_INSNS (83), /* DI */
2716 COSTS_N_INSNS (83)}, /* other */
2717 COSTS_N_INSNS (1), /* cost of movsx */
2718 COSTS_N_INSNS (1), /* cost of movzx */
2719 8, /* "large" insn */
2720 9, /* MOVE_RATIO */
2721 6, /* CLEAR_RATIO */
2722 {8, 8, 6}, /* cost of loading integer registers
2723 in QImode, HImode and SImode.
2724 Relative to reg-reg move (2). */
2725 {8, 8, 6}, /* cost of storing integer registers */
2726 {10, 10, 12, 48, 96}, /* cost of loading SSE register
2727 in 32bit, 64bit, 128bit, 256bit and 512bit */
2728 {10, 10, 12, 48, 96}, /* cost of storing SSE register
2729 in 32bit, 64bit, 128bit, 256bit and 512bit */
2730 {10, 10, 12, 48, 96}, /* cost of unaligned loads. */
2731 {10, 10, 12, 48, 96}, /* cost of unaligned stores. */
2732 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
2733 14, /* cost of moving SSE register to integer. */
2734 10, 10, /* Gather load static, per_elt. */
2735 10, 10, /* Gather store static, per_elt. */
2736 32, /* size of l1 cache. */
2737 2048, /* size of l2 cache. */
2738 64, /* size of prefetch block */
2739 100, /* number of parallel prefetches */
2740 2, /* Branch cost */
2741 COSTS_N_INSNS (4), /* cost of FADD and FSUB insns. */
2742 COSTS_N_INSNS (4), /* cost of FMUL instruction. */
2743 COSTS_N_INSNS (19), /* cost of FDIV instruction. */
2744 COSTS_N_INSNS (2), /* cost of FABS instruction. */
2745 COSTS_N_INSNS (2), /* cost of FCHS instruction. */
2746 COSTS_N_INSNS (35), /* cost of FSQRT instruction. */
2747
2748 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
2749 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
2750 COSTS_N_INSNS (2), /* cost of MULSS instruction. */
2751 COSTS_N_INSNS (4), /* cost of MULSD instruction. */
2752 COSTS_N_INSNS (5), /* cost of FMA SS instruction. */
2753 COSTS_N_INSNS (5), /* cost of FMA SD instruction. */
2754 COSTS_N_INSNS (13), /* cost of DIVSS instruction. */
2755 COSTS_N_INSNS (19), /* cost of DIVSD instruction. */
2756 COSTS_N_INSNS (16), /* cost of SQRTSS instruction. */
2757 COSTS_N_INSNS (21), /* cost of SQRTSD instruction. */
2758 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
2759 btver2_memcpy,
2760 btver2_memset,
2761 COSTS_N_INSNS (2), /* cond_taken_branch_cost. */
2762 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
2763 "16:11:8", /* Loop alignment. */
2764 "16:8:8", /* Jump alignment. */
2765 "0:0:8", /* Label alignment. */
2766 "11", /* Func alignment. */
2767 4, /* Small unroll limit. */
2768 2, /* Small unroll factor. */
2769 COSTS_N_INSNS (2), /* Branch mispredict scale. */
2770 };
2771
2772 static stringop_algs pentium4_memcpy[2] = {
2773 {libcall, {{12, loop_1_byte, false}, {-1, rep_prefix_4_byte, false}}},
2774 DUMMY_STRINGOP_ALGS};
2775 static stringop_algs pentium4_memset[2] = {
2776 {libcall, {{6, loop_1_byte, false}, {48, loop, false},
2777 {20480, rep_prefix_4_byte, false}, {-1, libcall, false}}},
2778 DUMMY_STRINGOP_ALGS};
2779
2780 static const
2781 struct processor_costs pentium4_cost = {
2782 {
2783 /* Start of register allocator costs. integer->integer move cost is 2. */
2784 5, /* cost for loading QImode using movzbl */
2785 {4, 5, 4}, /* cost of loading integer registers
2786 in QImode, HImode and SImode.
2787 Relative to reg-reg move (2). */
2788 {2, 3, 2}, /* cost of storing integer registers */
2789 12, /* cost of reg,reg fld/fst */
2790 {14, 14, 14}, /* cost of loading fp registers
2791 in SFmode, DFmode and XFmode */
2792 {14, 14, 14}, /* cost of storing fp registers
2793 in SFmode, DFmode and XFmode */
2794 12, /* cost of moving MMX register */
2795 {16, 16}, /* cost of loading MMX registers
2796 in SImode and DImode */
2797 {16, 16}, /* cost of storing MMX registers
2798 in SImode and DImode */
2799 12, 24, 48, /* cost of moving XMM,YMM,ZMM register */
2800 {16, 16, 16, 32, 64}, /* cost of loading SSE registers
2801 in 32,64,128,256 and 512-bit */
2802 {16, 16, 16, 32, 64}, /* cost of storing SSE registers
2803 in 32,64,128,256 and 512-bit */
2804 20, 12, /* SSE->integer and integer->SSE moves */
2805 20, 12, /* mask->integer and integer->mask moves */
2806 {4, 5, 4}, /* cost of loading mask register
2807 in QImode, HImode, SImode. */
2808 {2, 3, 2}, /* cost if storing mask register
2809 in QImode, HImode, SImode. */
2810 2, /* cost of moving mask register. */
2811 /* End of register allocator costs. */
2812 },
2813
2814 COSTS_N_INSNS (1), /* cost of an add instruction */
2815 COSTS_N_INSNS (3), /* cost of a lea instruction */
2816 COSTS_N_INSNS (4), /* variable shift costs */
2817 COSTS_N_INSNS (4), /* constant shift costs */
2818 {COSTS_N_INSNS (15), /* cost of starting multiply for QI */
2819 COSTS_N_INSNS (15), /* HI */
2820 COSTS_N_INSNS (15), /* SI */
2821 COSTS_N_INSNS (15), /* DI */
2822 COSTS_N_INSNS (15)}, /* other */
2823 0, /* cost of multiply per each bit set */
2824 {COSTS_N_INSNS (56), /* cost of a divide/mod for QI */
2825 COSTS_N_INSNS (56), /* HI */
2826 COSTS_N_INSNS (56), /* SI */
2827 COSTS_N_INSNS (56), /* DI */
2828 COSTS_N_INSNS (56)}, /* other */
2829 COSTS_N_INSNS (1), /* cost of movsx */
2830 COSTS_N_INSNS (1), /* cost of movzx */
2831 16, /* "large" insn */
2832 6, /* MOVE_RATIO */
2833 6, /* CLEAR_RATIO */
2834 {4, 5, 4}, /* cost of loading integer registers
2835 in QImode, HImode and SImode.
2836 Relative to reg-reg move (2). */
2837 {2, 3, 2}, /* cost of storing integer registers */
2838 {16, 16, 16, 32, 64}, /* cost of loading SSE register
2839 in 32bit, 64bit, 128bit, 256bit and 512bit */
2840 {16, 16, 16, 32, 64}, /* cost of storing SSE register
2841 in 32bit, 64bit, 128bit, 256bit and 512bit */
2842 {32, 32, 32, 64, 128}, /* cost of unaligned loads. */
2843 {32, 32, 32, 64, 128}, /* cost of unaligned stores. */
2844 12, 24, 48, /* cost of moving XMM,YMM,ZMM register */
2845 20, /* cost of moving SSE register to integer. */
2846 16, 16, /* Gather load static, per_elt. */
2847 16, 16, /* Gather store static, per_elt. */
2848 8, /* size of l1 cache. */
2849 256, /* size of l2 cache. */
2850 64, /* size of prefetch block */
2851 6, /* number of parallel prefetches */
2852 2, /* Branch cost */
2853 COSTS_N_INSNS (5), /* cost of FADD and FSUB insns. */
2854 COSTS_N_INSNS (7), /* cost of FMUL instruction. */
2855 COSTS_N_INSNS (43), /* cost of FDIV instruction. */
2856 COSTS_N_INSNS (2), /* cost of FABS instruction. */
2857 COSTS_N_INSNS (2), /* cost of FCHS instruction. */
2858 COSTS_N_INSNS (43), /* cost of FSQRT instruction. */
2859
2860 COSTS_N_INSNS (2), /* cost of cheap SSE instruction. */
2861 COSTS_N_INSNS (4), /* cost of ADDSS/SD SUBSS/SD insns. */
2862 COSTS_N_INSNS (6), /* cost of MULSS instruction. */
2863 COSTS_N_INSNS (6), /* cost of MULSD instruction. */
2864 COSTS_N_INSNS (6), /* cost of FMA SS instruction. */
2865 COSTS_N_INSNS (6), /* cost of FMA SD instruction. */
2866 COSTS_N_INSNS (23), /* cost of DIVSS instruction. */
2867 COSTS_N_INSNS (38), /* cost of DIVSD instruction. */
2868 COSTS_N_INSNS (23), /* cost of SQRTSS instruction. */
2869 COSTS_N_INSNS (38), /* cost of SQRTSD instruction. */
2870 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
2871 pentium4_memcpy,
2872 pentium4_memset,
2873 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
2874 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
2875 NULL, /* Loop alignment. */
2876 NULL, /* Jump alignment. */
2877 NULL, /* Label alignment. */
2878 NULL, /* Func alignment. */
2879 4, /* Small unroll limit. */
2880 2, /* Small unroll factor. */
2881 COSTS_N_INSNS (2), /* Branch mispredict scale. */
2882 };
2883
2884 static stringop_algs nocona_memcpy[2] = {
2885 {libcall, {{12, loop_1_byte, false}, {-1, rep_prefix_4_byte, false}}},
2886 {libcall, {{32, loop, false}, {20000, rep_prefix_8_byte, false},
2887 {100000, unrolled_loop, false}, {-1, libcall, false}}}};
2888
2889 static stringop_algs nocona_memset[2] = {
2890 {libcall, {{6, loop_1_byte, false}, {48, loop, false},
2891 {20480, rep_prefix_4_byte, false}, {-1, libcall, false}}},
2892 {libcall, {{24, loop, false}, {64, unrolled_loop, false},
2893 {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}};
2894
2895 static const
2896 struct processor_costs nocona_cost = {
2897 {
2898 /* Start of register allocator costs. integer->integer move cost is 2. */
2899 4, /* cost for loading QImode using movzbl */
2900 {4, 4, 4}, /* cost of loading integer registers
2901 in QImode, HImode and SImode.
2902 Relative to reg-reg move (2). */
2903 {4, 4, 4}, /* cost of storing integer registers */
2904 12, /* cost of reg,reg fld/fst */
2905 {14, 14, 14}, /* cost of loading fp registers
2906 in SFmode, DFmode and XFmode */
2907 {14, 14, 14}, /* cost of storing fp registers
2908 in SFmode, DFmode and XFmode */
2909 14, /* cost of moving MMX register */
2910 {12, 12}, /* cost of loading MMX registers
2911 in SImode and DImode */
2912 {12, 12}, /* cost of storing MMX registers
2913 in SImode and DImode */
2914 6, 12, 24, /* cost of moving XMM,YMM,ZMM register */
2915 {12, 12, 12, 24, 48}, /* cost of loading SSE registers
2916 in 32,64,128,256 and 512-bit */
2917 {12, 12, 12, 24, 48}, /* cost of storing SSE registers
2918 in 32,64,128,256 and 512-bit */
2919 20, 12, /* SSE->integer and integer->SSE moves */
2920 20, 12, /* mask->integer and integer->mask moves */
2921 {4, 4, 4}, /* cost of loading mask register
2922 in QImode, HImode, SImode. */
2923 {4, 4, 4}, /* cost if storing mask register
2924 in QImode, HImode, SImode. */
2925 2, /* cost of moving mask register. */
2926 /* End of register allocator costs. */
2927 },
2928
2929 COSTS_N_INSNS (1), /* cost of an add instruction */
2930 COSTS_N_INSNS (1), /* cost of a lea instruction */
2931 COSTS_N_INSNS (1), /* variable shift costs */
2932 COSTS_N_INSNS (1), /* constant shift costs */
2933 {COSTS_N_INSNS (10), /* cost of starting multiply for QI */
2934 COSTS_N_INSNS (10), /* HI */
2935 COSTS_N_INSNS (10), /* SI */
2936 COSTS_N_INSNS (10), /* DI */
2937 COSTS_N_INSNS (10)}, /* other */
2938 0, /* cost of multiply per each bit set */
2939 {COSTS_N_INSNS (66), /* cost of a divide/mod for QI */
2940 COSTS_N_INSNS (66), /* HI */
2941 COSTS_N_INSNS (66), /* SI */
2942 COSTS_N_INSNS (66), /* DI */
2943 COSTS_N_INSNS (66)}, /* other */
2944 COSTS_N_INSNS (1), /* cost of movsx */
2945 COSTS_N_INSNS (1), /* cost of movzx */
2946 16, /* "large" insn */
2947 17, /* MOVE_RATIO */
2948 6, /* CLEAR_RATIO */
2949 {4, 4, 4}, /* cost of loading integer registers
2950 in QImode, HImode and SImode.
2951 Relative to reg-reg move (2). */
2952 {4, 4, 4}, /* cost of storing integer registers */
2953 {12, 12, 12, 24, 48}, /* cost of loading SSE register
2954 in 32bit, 64bit, 128bit, 256bit and 512bit */
2955 {12, 12, 12, 24, 48}, /* cost of storing SSE register
2956 in 32bit, 64bit, 128bit, 256bit and 512bit */
2957 {24, 24, 24, 48, 96}, /* cost of unaligned loads. */
2958 {24, 24, 24, 48, 96}, /* cost of unaligned stores. */
2959 6, 12, 24, /* cost of moving XMM,YMM,ZMM register */
2960 20, /* cost of moving SSE register to integer. */
2961 12, 12, /* Gather load static, per_elt. */
2962 12, 12, /* Gather store static, per_elt. */
2963 8, /* size of l1 cache. */
2964 1024, /* size of l2 cache. */
2965 64, /* size of prefetch block */
2966 8, /* number of parallel prefetches */
2967 1, /* Branch cost */
2968 COSTS_N_INSNS (6), /* cost of FADD and FSUB insns. */
2969 COSTS_N_INSNS (8), /* cost of FMUL instruction. */
2970 COSTS_N_INSNS (40), /* cost of FDIV instruction. */
2971 COSTS_N_INSNS (3), /* cost of FABS instruction. */
2972 COSTS_N_INSNS (3), /* cost of FCHS instruction. */
2973 COSTS_N_INSNS (44), /* cost of FSQRT instruction. */
2974
2975 COSTS_N_INSNS (2), /* cost of cheap SSE instruction. */
2976 COSTS_N_INSNS (5), /* cost of ADDSS/SD SUBSS/SD insns. */
2977 COSTS_N_INSNS (7), /* cost of MULSS instruction. */
2978 COSTS_N_INSNS (7), /* cost of MULSD instruction. */
2979 COSTS_N_INSNS (7), /* cost of FMA SS instruction. */
2980 COSTS_N_INSNS (7), /* cost of FMA SD instruction. */
2981 COSTS_N_INSNS (32), /* cost of DIVSS instruction. */
2982 COSTS_N_INSNS (40), /* cost of DIVSD instruction. */
2983 COSTS_N_INSNS (32), /* cost of SQRTSS instruction. */
2984 COSTS_N_INSNS (41), /* cost of SQRTSD instruction. */
2985 1, 1, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
2986 nocona_memcpy,
2987 nocona_memset,
2988 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
2989 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
2990 NULL, /* Loop alignment. */
2991 NULL, /* Jump alignment. */
2992 NULL, /* Label alignment. */
2993 NULL, /* Func alignment. */
2994 4, /* Small unroll limit. */
2995 2, /* Small unroll factor. */
2996 COSTS_N_INSNS (2), /* Branch mispredict scale. */
2997 };
2998
2999 static stringop_algs atom_memcpy[2] = {
3000 {libcall, {{11, loop, false}, {-1, rep_prefix_4_byte, false}}},
3001 {libcall, {{32, loop, false}, {64, rep_prefix_4_byte, false},
3002 {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}};
3003 static stringop_algs atom_memset[2] = {
3004 {libcall, {{8, loop, false}, {15, unrolled_loop, false},
3005 {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}},
3006 {libcall, {{24, loop, false}, {32, unrolled_loop, false},
3007 {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}};
3008 static const
3009 struct processor_costs atom_cost = {
3010 {
3011 /* Start of register allocator costs. integer->integer move cost is 2. */
3012 6, /* cost for loading QImode using movzbl */
3013 {6, 6, 6}, /* cost of loading integer registers
3014 in QImode, HImode and SImode.
3015 Relative to reg-reg move (2). */
3016 {6, 6, 6}, /* cost of storing integer registers */
3017 4, /* cost of reg,reg fld/fst */
3018 {6, 6, 18}, /* cost of loading fp registers
3019 in SFmode, DFmode and XFmode */
3020 {14, 14, 24}, /* cost of storing fp registers
3021 in SFmode, DFmode and XFmode */
3022 2, /* cost of moving MMX register */
3023 {8, 8}, /* cost of loading MMX registers
3024 in SImode and DImode */
3025 {10, 10}, /* cost of storing MMX registers
3026 in SImode and DImode */
3027 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
3028 {8, 8, 8, 16, 32}, /* cost of loading SSE registers
3029 in 32,64,128,256 and 512-bit */
3030 {8, 8, 8, 16, 32}, /* cost of storing SSE registers
3031 in 32,64,128,256 and 512-bit */
3032 8, 6, /* SSE->integer and integer->SSE moves */
3033 8, 6, /* mask->integer and integer->mask moves */
3034 {6, 6, 6}, /* cost of loading mask register
3035 in QImode, HImode, SImode. */
3036 {6, 6, 6}, /* cost if storing mask register
3037 in QImode, HImode, SImode. */
3038 2, /* cost of moving mask register. */
3039 /* End of register allocator costs. */
3040 },
3041
3042 COSTS_N_INSNS (1), /* cost of an add instruction */
3043 COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */
3044 COSTS_N_INSNS (1), /* variable shift costs */
3045 COSTS_N_INSNS (1), /* constant shift costs */
3046 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
3047 COSTS_N_INSNS (4), /* HI */
3048 COSTS_N_INSNS (3), /* SI */
3049 COSTS_N_INSNS (4), /* DI */
3050 COSTS_N_INSNS (2)}, /* other */
3051 0, /* cost of multiply per each bit set */
3052 {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */
3053 COSTS_N_INSNS (26), /* HI */
3054 COSTS_N_INSNS (42), /* SI */
3055 COSTS_N_INSNS (74), /* DI */
3056 COSTS_N_INSNS (74)}, /* other */
3057 COSTS_N_INSNS (1), /* cost of movsx */
3058 COSTS_N_INSNS (1), /* cost of movzx */
3059 8, /* "large" insn */
3060 17, /* MOVE_RATIO */
3061 6, /* CLEAR_RATIO */
3062 {6, 6, 6}, /* cost of loading integer registers
3063 in QImode, HImode and SImode.
3064 Relative to reg-reg move (2). */
3065 {6, 6, 6}, /* cost of storing integer registers */
3066 {8, 8, 8, 16, 32}, /* cost of loading SSE register
3067 in 32bit, 64bit, 128bit, 256bit and 512bit */
3068 {8, 8, 8, 16, 32}, /* cost of storing SSE register
3069 in 32bit, 64bit, 128bit, 256bit and 512bit */
3070 {16, 16, 16, 32, 64}, /* cost of unaligned loads. */
3071 {16, 16, 16, 32, 64}, /* cost of unaligned stores. */
3072 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
3073 8, /* cost of moving SSE register to integer. */
3074 8, 8, /* Gather load static, per_elt. */
3075 8, 8, /* Gather store static, per_elt. */
3076 32, /* size of l1 cache. */
3077 256, /* size of l2 cache. */
3078 64, /* size of prefetch block */
3079 6, /* number of parallel prefetches */
3080 3, /* Branch cost */
3081 COSTS_N_INSNS (8), /* cost of FADD and FSUB insns. */
3082 COSTS_N_INSNS (8), /* cost of FMUL instruction. */
3083 COSTS_N_INSNS (20), /* cost of FDIV instruction. */
3084 COSTS_N_INSNS (8), /* cost of FABS instruction. */
3085 COSTS_N_INSNS (8), /* cost of FCHS instruction. */
3086 COSTS_N_INSNS (40), /* cost of FSQRT instruction. */
3087
3088 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
3089 COSTS_N_INSNS (5), /* cost of ADDSS/SD SUBSS/SD insns. */
3090 COSTS_N_INSNS (4), /* cost of MULSS instruction. */
3091 COSTS_N_INSNS (5), /* cost of MULSD instruction. */
3092 COSTS_N_INSNS (6), /* cost of FMA SS instruction. */
3093 COSTS_N_INSNS (6), /* cost of FMA SD instruction. */
3094 COSTS_N_INSNS (31), /* cost of DIVSS instruction. */
3095 COSTS_N_INSNS (60), /* cost of DIVSD instruction. */
3096 COSTS_N_INSNS (31), /* cost of SQRTSS instruction. */
3097 COSTS_N_INSNS (63), /* cost of SQRTSD instruction. */
3098 2, 2, 2, 2, /* reassoc int, fp, vec_int, vec_fp. */
3099 atom_memcpy,
3100 atom_memset,
3101 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
3102 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
3103 "16", /* Loop alignment. */
3104 "16:8:8", /* Jump alignment. */
3105 "0:0:8", /* Label alignment. */
3106 "16", /* Func alignment. */
3107 4, /* Small unroll limit. */
3108 2, /* Small unroll factor. */
3109 COSTS_N_INSNS (2), /* Branch mispredict scale. */
3110 };
3111
3112 static stringop_algs slm_memcpy[2] = {
3113 {libcall, {{11, loop, false}, {-1, rep_prefix_4_byte, false}}},
3114 {libcall, {{32, loop, false}, {64, rep_prefix_4_byte, false},
3115 {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}};
3116 static stringop_algs slm_memset[2] = {
3117 {libcall, {{8, loop, false}, {15, unrolled_loop, false},
3118 {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}},
3119 {libcall, {{24, loop, false}, {32, unrolled_loop, false},
3120 {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}};
3121 static const
3122 struct processor_costs slm_cost = {
3123 {
3124 /* Start of register allocator costs. integer->integer move cost is 2. */
3125 8, /* cost for loading QImode using movzbl */
3126 {8, 8, 8}, /* cost of loading integer registers
3127 in QImode, HImode and SImode.
3128 Relative to reg-reg move (2). */
3129 {6, 6, 6}, /* cost of storing integer registers */
3130 2, /* cost of reg,reg fld/fst */
3131 {8, 8, 18}, /* cost of loading fp registers
3132 in SFmode, DFmode and XFmode */
3133 {6, 6, 18}, /* cost of storing fp registers
3134 in SFmode, DFmode and XFmode */
3135 2, /* cost of moving MMX register */
3136 {8, 8}, /* cost of loading MMX registers
3137 in SImode and DImode */
3138 {6, 6}, /* cost of storing MMX registers
3139 in SImode and DImode */
3140 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
3141 {8, 8, 8, 16, 32}, /* cost of loading SSE registers
3142 in 32,64,128,256 and 512-bit */
3143 {8, 8, 8, 16, 32}, /* cost of storing SSE registers
3144 in 32,64,128,256 and 512-bit */
3145 8, 6, /* SSE->integer and integer->SSE moves */
3146 8, 6, /* mask->integer and integer->mask moves */
3147 {8, 8, 8}, /* cost of loading mask register
3148 in QImode, HImode, SImode. */
3149 {6, 6, 6}, /* cost if storing mask register
3150 in QImode, HImode, SImode. */
3151 2, /* cost of moving mask register. */
3152 /* End of register allocator costs. */
3153 },
3154
3155 COSTS_N_INSNS (1), /* cost of an add instruction */
3156 COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */
3157 COSTS_N_INSNS (1), /* variable shift costs */
3158 COSTS_N_INSNS (1), /* constant shift costs */
3159 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
3160 COSTS_N_INSNS (3), /* HI */
3161 COSTS_N_INSNS (3), /* SI */
3162 COSTS_N_INSNS (4), /* DI */
3163 COSTS_N_INSNS (2)}, /* other */
3164 0, /* cost of multiply per each bit set */
3165 {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */
3166 COSTS_N_INSNS (26), /* HI */
3167 COSTS_N_INSNS (42), /* SI */
3168 COSTS_N_INSNS (74), /* DI */
3169 COSTS_N_INSNS (74)}, /* other */
3170 COSTS_N_INSNS (1), /* cost of movsx */
3171 COSTS_N_INSNS (1), /* cost of movzx */
3172 8, /* "large" insn */
3173 17, /* MOVE_RATIO */
3174 6, /* CLEAR_RATIO */
3175 {8, 8, 8}, /* cost of loading integer registers
3176 in QImode, HImode and SImode.
3177 Relative to reg-reg move (2). */
3178 {6, 6, 6}, /* cost of storing integer registers */
3179 {8, 8, 8, 16, 32}, /* cost of loading SSE register
3180 in 32bit, 64bit, 128bit, 256bit and 512bit */
3181 {8, 8, 8, 16, 32}, /* cost of storing SSE register
3182 in SImode, DImode and TImode. */
3183 {16, 16, 16, 32, 64}, /* cost of unaligned loads. */
3184 {16, 16, 16, 32, 64}, /* cost of unaligned stores. */
3185 2, 4, 8, /* cost of moving XMM,YMM,ZMM register */
3186 8, /* cost of moving SSE register to integer. */
3187 8, 8, /* Gather load static, per_elt. */
3188 8, 8, /* Gather store static, per_elt. */
3189 32, /* size of l1 cache. */
3190 256, /* size of l2 cache. */
3191 64, /* size of prefetch block */
3192 6, /* number of parallel prefetches */
3193 3, /* Branch cost */
3194 COSTS_N_INSNS (8), /* cost of FADD and FSUB insns. */
3195 COSTS_N_INSNS (8), /* cost of FMUL instruction. */
3196 COSTS_N_INSNS (20), /* cost of FDIV instruction. */
3197 COSTS_N_INSNS (8), /* cost of FABS instruction. */
3198 COSTS_N_INSNS (8), /* cost of FCHS instruction. */
3199 COSTS_N_INSNS (40), /* cost of FSQRT instruction. */
3200
3201 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
3202 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
3203 COSTS_N_INSNS (4), /* cost of MULSS instruction. */
3204 COSTS_N_INSNS (5), /* cost of MULSD instruction. */
3205 COSTS_N_INSNS (6), /* cost of FMA SS instruction. */
3206 COSTS_N_INSNS (6), /* cost of FMA SD instruction. */
3207 COSTS_N_INSNS (39), /* cost of DIVSS instruction. */
3208 COSTS_N_INSNS (69), /* cost of DIVSD instruction. */
3209 COSTS_N_INSNS (20), /* cost of SQRTSS instruction. */
3210 COSTS_N_INSNS (35), /* cost of SQRTSD instruction. */
3211 1, 2, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
3212 slm_memcpy,
3213 slm_memset,
3214 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
3215 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
3216 "16", /* Loop alignment. */
3217 "16:8:8", /* Jump alignment. */
3218 "0:0:8", /* Label alignment. */
3219 "16", /* Func alignment. */
3220 4, /* Small unroll limit. */
3221 2, /* Small unroll factor. */
3222 COSTS_N_INSNS (2), /* Branch mispredict scale. */
3223 };
3224
3225 static stringop_algs tremont_memcpy[2] = {
3226 {libcall,
3227 {{256, rep_prefix_1_byte, true},
3228 {256, loop, false},
3229 {-1, libcall, false}}},
3230 {libcall,
3231 {{256, rep_prefix_1_byte, true},
3232 {256, loop, false},
3233 {-1, libcall, false}}}};
3234 static stringop_algs tremont_memset[2] = {
3235 {libcall,
3236 {{256, rep_prefix_1_byte, true},
3237 {256, loop, false},
3238 {-1, libcall, false}}},
3239 {libcall,
3240 {{256, rep_prefix_1_byte, true},
3241 {256, loop, false},
3242 {-1, libcall, false}}}};
3243 static const
3244 struct processor_costs tremont_cost = {
3245 {
3246 /* Start of register allocator costs. integer->integer move cost is 2. */
3247 6, /* cost for loading QImode using movzbl */
3248 {6, 6, 6}, /* cost of loading integer registers
3249 in QImode, HImode and SImode.
3250 Relative to reg-reg move (2). */
3251 {6, 6, 6}, /* cost of storing integer registers */
3252 4, /* cost of reg,reg fld/fst */
3253 {6, 6, 12}, /* cost of loading fp registers
3254 in SFmode, DFmode and XFmode */
3255 {6, 6, 12}, /* cost of storing fp registers
3256 in SFmode, DFmode and XFmode */
3257 2, /* cost of moving MMX register */
3258 {6, 6}, /* cost of loading MMX registers
3259 in SImode and DImode */
3260 {6, 6}, /* cost of storing MMX registers
3261 in SImode and DImode */
3262 2, 3, 4, /* cost of moving XMM,YMM,ZMM register */
3263 {6, 6, 6, 10, 15}, /* cost of loading SSE registers
3264 in 32,64,128,256 and 512-bit */
3265 {6, 6, 6, 10, 15}, /* cost of storing SSE registers
3266 in 32,64,128,256 and 512-bit */
3267 6, 6, /* SSE->integer and integer->SSE moves */
3268 6, 6, /* mask->integer and integer->mask moves */
3269 {6, 6, 6}, /* cost of loading mask register
3270 in QImode, HImode, SImode. */
3271 {6, 6, 6}, /* cost if storing mask register
3272 in QImode, HImode, SImode. */
3273 2, /* cost of moving mask register. */
3274 /* End of register allocator costs. */
3275 },
3276
3277 COSTS_N_INSNS (1), /* cost of an add instruction */
3278 /* Setting cost to 2 makes our current implementation of synth_mult result in
3279 use of unnecessary temporary registers causing regression on several
3280 SPECfp benchmarks. */
3281 COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */
3282 COSTS_N_INSNS (1), /* variable shift costs */
3283 COSTS_N_INSNS (1), /* constant shift costs */
3284 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
3285 COSTS_N_INSNS (3), /* HI */
3286 COSTS_N_INSNS (3), /* SI */
3287 COSTS_N_INSNS (3), /* DI */
3288 COSTS_N_INSNS (4)}, /* other */
3289 0, /* cost of multiply per each bit set */
3290 {COSTS_N_INSNS (16), /* cost of a divide/mod for QI */
3291 COSTS_N_INSNS (22), /* HI */
3292 COSTS_N_INSNS (30), /* SI */
3293 COSTS_N_INSNS (74), /* DI */
3294 COSTS_N_INSNS (74)}, /* other */
3295 COSTS_N_INSNS (1), /* cost of movsx */
3296 COSTS_N_INSNS (1), /* cost of movzx */
3297 8, /* "large" insn */
3298 17, /* MOVE_RATIO */
3299 17, /* CLEAR_RATIO */
3300 {6, 6, 6}, /* cost of loading integer registers
3301 in QImode, HImode and SImode.
3302 Relative to reg-reg move (2). */
3303 {6, 6, 6}, /* cost of storing integer registers */
3304 {6, 6, 6, 10, 15}, /* cost of loading SSE register
3305 in 32bit, 64bit, 128bit, 256bit and 512bit */
3306 {6, 6, 6, 10, 15}, /* cost of storing SSE register
3307 in 32bit, 64bit, 128bit, 256bit and 512bit */
3308 {6, 6, 6, 10, 15}, /* cost of unaligned loads. */
3309 {6, 6, 6, 10, 15}, /* cost of unaligned storess. */
3310 2, 3, 4, /* cost of moving XMM,YMM,ZMM register */
3311 6, /* cost of moving SSE register to integer. */
3312 18, 6, /* Gather load static, per_elt. */
3313 18, 6, /* Gather store static, per_elt. */
3314 32, /* size of l1 cache. */
3315 512, /* size of l2 cache. */
3316 64, /* size of prefetch block */
3317 6, /* number of parallel prefetches */
3318 /* Benchmarks shows large regressions on K8 sixtrack benchmark when this
3319 value is increased to perhaps more appropriate value of 5. */
3320 3, /* Branch cost */
3321 COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */
3322 COSTS_N_INSNS (5), /* cost of FMUL instruction. */
3323 COSTS_N_INSNS (17), /* cost of FDIV instruction. */
3324 COSTS_N_INSNS (1), /* cost of FABS instruction. */
3325 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
3326 COSTS_N_INSNS (14), /* cost of FSQRT instruction. */
3327
3328 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
3329 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
3330 COSTS_N_INSNS (4), /* cost of MULSS instruction. */
3331 COSTS_N_INSNS (5), /* cost of MULSD instruction. */
3332 COSTS_N_INSNS (5), /* cost of FMA SS instruction. */
3333 COSTS_N_INSNS (5), /* cost of FMA SD instruction. */
3334 COSTS_N_INSNS (13), /* cost of DIVSS instruction. */
3335 COSTS_N_INSNS (17), /* cost of DIVSD instruction. */
3336 COSTS_N_INSNS (14), /* cost of SQRTSS instruction. */
3337 COSTS_N_INSNS (18), /* cost of SQRTSD instruction. */
3338 1, 4, 3, 3, /* reassoc int, fp, vec_int, vec_fp. */
3339 tremont_memcpy,
3340 tremont_memset,
3341 COSTS_N_INSNS (4), /* cond_taken_branch_cost. */
3342 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
3343 "16:11:8", /* Loop alignment. */
3344 "16:11:8", /* Jump alignment. */
3345 "0:0:8", /* Label alignment. */
3346 "16", /* Func alignment. */
3347 4, /* Small unroll limit. */
3348 2, /* Small unroll factor. */
3349 COSTS_N_INSNS (2), /* Branch mispredict scale. */
3350 };
3351
3352 static stringop_algs intel_memcpy[2] = {
3353 {libcall, {{11, loop, false}, {-1, rep_prefix_4_byte, false}}},
3354 {libcall, {{32, loop, false}, {64, rep_prefix_4_byte, false},
3355 {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}};
3356 static stringop_algs intel_memset[2] = {
3357 {libcall, {{8, loop, false}, {15, unrolled_loop, false},
3358 {2048, rep_prefix_4_byte, false}, {-1, libcall, false}}},
3359 {libcall, {{24, loop, false}, {32, unrolled_loop, false},
3360 {8192, rep_prefix_8_byte, false}, {-1, libcall, false}}}};
3361 static const
3362 struct processor_costs intel_cost = {
3363 {
3364 /* Start of register allocator costs. integer->integer move cost is 2. */
3365 6, /* cost for loading QImode using movzbl */
3366 {4, 4, 4}, /* cost of loading integer registers
3367 in QImode, HImode and SImode.
3368 Relative to reg-reg move (2). */
3369 {6, 6, 6}, /* cost of storing integer registers */
3370 2, /* cost of reg,reg fld/fst */
3371 {6, 6, 8}, /* cost of loading fp registers
3372 in SFmode, DFmode and XFmode */
3373 {6, 6, 10}, /* cost of storing fp registers
3374 in SFmode, DFmode and XFmode */
3375 2, /* cost of moving MMX register */
3376 {6, 6}, /* cost of loading MMX registers
3377 in SImode and DImode */
3378 {6, 6}, /* cost of storing MMX registers
3379 in SImode and DImode */
3380 2, 2, 2, /* cost of moving XMM,YMM,ZMM register */
3381 {6, 6, 6, 6, 6}, /* cost of loading SSE registers
3382 in 32,64,128,256 and 512-bit */
3383 {6, 6, 6, 6, 6}, /* cost of storing SSE registers
3384 in 32,64,128,256 and 512-bit */
3385 4, 4, /* SSE->integer and integer->SSE moves */
3386 4, 4, /* mask->integer and integer->mask moves */
3387 {4, 4, 4}, /* cost of loading mask register
3388 in QImode, HImode, SImode. */
3389 {6, 6, 6}, /* cost if storing mask register
3390 in QImode, HImode, SImode. */
3391 2, /* cost of moving mask register. */
3392 /* End of register allocator costs. */
3393 },
3394
3395 COSTS_N_INSNS (1), /* cost of an add instruction */
3396 COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */
3397 COSTS_N_INSNS (1), /* variable shift costs */
3398 COSTS_N_INSNS (1), /* constant shift costs */
3399 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
3400 COSTS_N_INSNS (3), /* HI */
3401 COSTS_N_INSNS (3), /* SI */
3402 COSTS_N_INSNS (4), /* DI */
3403 COSTS_N_INSNS (2)}, /* other */
3404 0, /* cost of multiply per each bit set */
3405 {COSTS_N_INSNS (18), /* cost of a divide/mod for QI */
3406 COSTS_N_INSNS (26), /* HI */
3407 COSTS_N_INSNS (42), /* SI */
3408 COSTS_N_INSNS (74), /* DI */
3409 COSTS_N_INSNS (74)}, /* other */
3410 COSTS_N_INSNS (1), /* cost of movsx */
3411 COSTS_N_INSNS (1), /* cost of movzx */
3412 8, /* "large" insn */
3413 17, /* MOVE_RATIO */
3414 6, /* CLEAR_RATIO */
3415 {4, 4, 4}, /* cost of loading integer registers
3416 in QImode, HImode and SImode.
3417 Relative to reg-reg move (2). */
3418 {6, 6, 6}, /* cost of storing integer registers */
3419 {6, 6, 6, 6, 6}, /* cost of loading SSE register
3420 in 32bit, 64bit, 128bit, 256bit and 512bit */
3421 {6, 6, 6, 6, 6}, /* cost of storing SSE register
3422 in 32bit, 64bit, 128bit, 256bit and 512bit */
3423 {10, 10, 10, 10, 10}, /* cost of unaligned loads. */
3424 {10, 10, 10, 10, 10}, /* cost of unaligned loads. */
3425 2, 2, 2, /* cost of moving XMM,YMM,ZMM register */
3426 4, /* cost of moving SSE register to integer. */
3427 6, 6, /* Gather load static, per_elt. */
3428 6, 6, /* Gather store static, per_elt. */
3429 32, /* size of l1 cache. */
3430 256, /* size of l2 cache. */
3431 64, /* size of prefetch block */
3432 6, /* number of parallel prefetches */
3433 3, /* Branch cost */
3434 COSTS_N_INSNS (8), /* cost of FADD and FSUB insns. */
3435 COSTS_N_INSNS (8), /* cost of FMUL instruction. */
3436 COSTS_N_INSNS (20), /* cost of FDIV instruction. */
3437 COSTS_N_INSNS (8), /* cost of FABS instruction. */
3438 COSTS_N_INSNS (8), /* cost of FCHS instruction. */
3439 COSTS_N_INSNS (40), /* cost of FSQRT instruction. */
3440
3441 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
3442 COSTS_N_INSNS (8), /* cost of ADDSS/SD SUBSS/SD insns. */
3443 COSTS_N_INSNS (8), /* cost of MULSS instruction. */
3444 COSTS_N_INSNS (8), /* cost of MULSD instruction. */
3445 COSTS_N_INSNS (6), /* cost of FMA SS instruction. */
3446 COSTS_N_INSNS (6), /* cost of FMA SD instruction. */
3447 COSTS_N_INSNS (20), /* cost of DIVSS instruction. */
3448 COSTS_N_INSNS (20), /* cost of DIVSD instruction. */
3449 COSTS_N_INSNS (40), /* cost of SQRTSS instruction. */
3450 COSTS_N_INSNS (40), /* cost of SQRTSD instruction. */
3451 1, 4, 1, 1, /* reassoc int, fp, vec_int, vec_fp. */
3452 intel_memcpy,
3453 intel_memset,
3454 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
3455 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
3456 "16", /* Loop alignment. */
3457 "16:8:8", /* Jump alignment. */
3458 "0:0:8", /* Label alignment. */
3459 "16", /* Func alignment. */
3460 4, /* Small unroll limit. */
3461 2, /* Small unroll factor. */
3462 COSTS_N_INSNS (2), /* Branch mispredict scale. */
3463 };
3464
3465 /* lujiazui_cost should produce code tuned for ZHAOXIN lujiazui CPU. */
3466 static stringop_algs lujiazui_memcpy[2] = {
3467 {libcall, {{32, loop, false}, {8192, rep_prefix_4_byte, false},
3468 {-1, libcall, false}}},
3469 {libcall, {{12, unrolled_loop, true}, {32, loop, false},
3470 {6144, rep_prefix_8_byte, false},
3471 {-1, libcall, false}}}};
3472 static stringop_algs lujiazui_memset[2] = {
3473 {libcall, {{32, loop, false}, {8192, rep_prefix_4_byte, false},
3474 {-1, libcall, false}}},
3475 {libcall, {{12, loop, true}, {32, loop, false},
3476 {640, rep_prefix_8_byte, false},
3477 {-1, libcall, false}}}};
3478 static const
3479 struct processor_costs lujiazui_cost = {
3480 {
3481 /* Start of register allocator costs. integer->integer move cost is 2. */
3482 6, /* cost for loading QImode using movzbl. */
3483 {6, 6, 6}, /* cost of loading integer registers
3484 in QImode, HImode and SImode.
3485 Relative to reg-reg move (2). */
3486 {6, 6, 6}, /* cost of storing integer registers. */
3487 2, /* cost of reg,reg fld/fst. */
3488 {6, 6, 8}, /* cost of loading fp registers
3489 in SFmode, DFmode and XFmode. */
3490 {6, 6, 8}, /* cost of storing fp registers
3491 in SFmode, DFmode and XFmode. */
3492 2, /* cost of moving MMX register. */
3493 {6, 6}, /* cost of loading MMX registers
3494 in SImode and DImode. */
3495 {6, 6}, /* cost of storing MMX registers
3496 in SImode and DImode. */
3497 2, 3, 4, /* cost of moving XMM,YMM,ZMM register. */
3498 {6, 6, 6, 10, 15}, /* cost of loading SSE registers
3499 in 32,64,128,256 and 512-bit. */
3500 {6, 6, 6, 10, 15}, /* cost of storing SSE registers
3501 in 32,64,128,256 and 512-bit. */
3502 6, 6, /* SSE->integer and integer->SSE moves. */
3503 6, 6, /* mask->integer and integer->mask moves. */
3504 {6, 6, 6}, /* cost of loading mask register
3505 in QImode, HImode, SImode. */
3506 {6, 6, 6}, /* cost if storing mask register
3507 in QImode, HImode, SImode. */
3508 2, /* cost of moving mask register. */
3509 /* End of register allocator costs. */
3510 },
3511
3512 COSTS_N_INSNS (1), /* cost of an add instruction. */
3513 COSTS_N_INSNS (1) + 1, /* cost of a lea instruction. */
3514 COSTS_N_INSNS (1), /* variable shift costs. */
3515 COSTS_N_INSNS (1), /* constant shift costs. */
3516 {COSTS_N_INSNS (2), /* cost of starting multiply for QI. */
3517 COSTS_N_INSNS (3), /* HI. */
3518 COSTS_N_INSNS (3), /* SI. */
3519 COSTS_N_INSNS (12), /* DI. */
3520 COSTS_N_INSNS (14)}, /* other. */
3521 0, /* cost of multiply per each bit set. */
3522 {COSTS_N_INSNS (22), /* cost of a divide/mod for QI. */
3523 COSTS_N_INSNS (24), /* HI. */
3524 COSTS_N_INSNS (24), /* SI. */
3525 COSTS_N_INSNS (150), /* DI. */
3526 COSTS_N_INSNS (152)}, /* other. */
3527 COSTS_N_INSNS (1), /* cost of movsx. */
3528 COSTS_N_INSNS (1), /* cost of movzx. */
3529 8, /* "large" insn. */
3530 17, /* MOVE_RATIO. */
3531 6, /* CLEAR_RATIO. */
3532 {6, 6, 6}, /* cost of loading integer registers
3533 in QImode, HImode and SImode.
3534 Relative to reg-reg move (2). */
3535 {6, 6, 6}, /* cost of storing integer registers. */
3536 {6, 6, 6, 10, 15}, /* cost of loading SSE register
3537 in 32bit, 64bit, 128bit, 256bit and 512bit. */
3538 {6, 6, 6, 10, 15}, /* cost of storing SSE register
3539 in 32bit, 64bit, 128bit, 256bit and 512bit. */
3540 {6, 6, 6, 10, 15}, /* cost of unaligned loads. */
3541 {6, 6, 6, 10, 15}, /* cost of unaligned storess. */
3542 2, 3, 4, /* cost of moving XMM,YMM,ZMM register. */
3543 6, /* cost of moving SSE register to integer. */
3544 18, 6, /* Gather load static, per_elt. */
3545 18, 6, /* Gather store static, per_elt. */
3546 32, /* size of l1 cache. */
3547 4096, /* size of l2 cache. */
3548 64, /* size of prefetch block. */
3549 /* Lujiazui processor never drop prefetches, like AMD processors. */
3550 100, /* number of parallel prefetches. */
3551 3, /* Branch cost. */
3552 COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */
3553 COSTS_N_INSNS (4), /* cost of FMUL instruction. */
3554 COSTS_N_INSNS (22), /* cost of FDIV instruction. */
3555 COSTS_N_INSNS (1), /* cost of FABS instruction. */
3556 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
3557 COSTS_N_INSNS (44), /* cost of FSQRT instruction. */
3558
3559 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
3560 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
3561 COSTS_N_INSNS (3), /* cost of MULSS instruction. */
3562 COSTS_N_INSNS (4), /* cost of MULSD instruction. */
3563 COSTS_N_INSNS (6), /* cost of FMA SS instruction. */
3564 COSTS_N_INSNS (6), /* cost of FMA SD instruction. */
3565 COSTS_N_INSNS (13), /* cost of DIVSS instruction. */
3566 COSTS_N_INSNS (17), /* cost of DIVSD instruction. */
3567 COSTS_N_INSNS (32), /* cost of SQRTSS instruction. */
3568 COSTS_N_INSNS (60), /* cost of SQRTSD instruction. */
3569 1, 4, 3, 3, /* reassoc int, fp, vec_int, vec_fp. */
3570 lujiazui_memcpy,
3571 lujiazui_memset,
3572 COSTS_N_INSNS (4), /* cond_taken_branch_cost. */
3573 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
3574 "16:11:8", /* Loop alignment. */
3575 "16:11:8", /* Jump alignment. */
3576 "0:0:8", /* Label alignment. */
3577 "16", /* Func alignment. */
3578 4, /* Small unroll limit. */
3579 2, /* Small unroll factor. */
3580 COSTS_N_INSNS (2), /* Branch mispredict scale. */
3581 };
3582
3583 /* yongfeng_cost should produce code tuned for ZHAOXIN yongfeng CPU. */
3584 static stringop_algs yongfeng_memcpy[2] = {
3585 {libcall, {{6, unrolled_loop, true}, {256, unrolled_loop, false},
3586 {-1, libcall, false}}},
3587 {libcall, {{8, loop, false}, {512, unrolled_loop, false},
3588 {-1, libcall, false}}}};
3589 static stringop_algs yongfeng_memset[2] = {
3590 {libcall, {{6, loop_1_byte, false}, {128, loop, false},
3591 {-1, libcall, false}}},
3592 {libcall, {{2, rep_prefix_4_byte, false}, {64, loop, false},
3593 {1024, vector_loop, false},
3594 {-1, libcall, false}}}};
3595 static const
3596 struct processor_costs yongfeng_cost = {
3597 {
3598 /* Start of register allocator costs. integer->integer move cost is 2. */
3599 8, /* cost for loading QImode using movzbl. */
3600 {8, 8, 8}, /* cost of loading integer registers
3601 in QImode, HImode and SImode.
3602 Relative to reg-reg move (2). */
3603 {8, 8, 8}, /* cost of storing integer registers. */
3604 2, /* cost of reg,reg fld/fst. */
3605 {8, 8, 8}, /* cost of loading fp registers
3606 in SFmode, DFmode and XFmode. */
3607 {8, 8, 8}, /* cost of storing fp registers
3608 in SFmode, DFmode and XFmode. */
3609 2, /* cost of moving MMX register. */
3610 {8, 8}, /* cost of loading MMX registers
3611 in SImode and DImode. */
3612 {8, 8}, /* cost of storing MMX registers
3613 in SImode and DImode. */
3614 2, 3, 4, /* cost of moving XMM,YMM,ZMM register. */
3615 {8, 8, 8, 10, 15}, /* cost of loading SSE registers
3616 in 32,64,128,256 and 512-bit. */
3617 {8, 8, 8, 10, 15}, /* cost of storing SSE registers
3618 in 32,64,128,256 and 512-bit. */
3619 8, 8, /* SSE->integer and integer->SSE moves. */
3620 8, 8, /* mask->integer and integer->mask moves. */
3621 {8, 8, 8}, /* cost of loading mask register
3622 in QImode, HImode, SImode. */
3623 {8, 8, 8}, /* cost if storing mask register
3624 in QImode, HImode, SImode. */
3625 2, /* cost of moving mask register. */
3626 /* End of register allocator costs. */
3627 },
3628
3629 COSTS_N_INSNS (1), /* cost of an add instruction. */
3630 COSTS_N_INSNS (1), /* cost of a lea instruction. */
3631 COSTS_N_INSNS (1), /* variable shift costs. */
3632 COSTS_N_INSNS (1), /* constant shift costs. */
3633 {COSTS_N_INSNS (2), /* cost of starting multiply for QI. */
3634 COSTS_N_INSNS (3), /* HI. */
3635 COSTS_N_INSNS (2), /* SI. */
3636 COSTS_N_INSNS (2), /* DI. */
3637 COSTS_N_INSNS (3)}, /* other. */
3638 0, /* cost of multiply per each bit set. */
3639 {COSTS_N_INSNS (8), /* cost of a divide/mod for QI. */
3640 COSTS_N_INSNS (9), /* HI. */
3641 COSTS_N_INSNS (8), /* SI. */
3642 COSTS_N_INSNS (41), /* DI. */
3643 COSTS_N_INSNS (41)}, /* other. */
3644 COSTS_N_INSNS (1), /* cost of movsx. */
3645 COSTS_N_INSNS (1), /* cost of movzx. */
3646 8, /* "large" insn. */
3647 17, /* MOVE_RATIO. */
3648 6, /* CLEAR_RATIO. */
3649 {8, 8, 8}, /* cost of loading integer registers
3650 in QImode, HImode and SImode.
3651 Relative to reg-reg move (2). */
3652 {8, 8, 8}, /* cost of storing integer registers. */
3653 {8, 8, 8, 12, 15}, /* cost of loading SSE register
3654 in 32bit, 64bit, 128bit, 256bit and 512bit. */
3655 {8, 8, 8, 12, 15}, /* cost of storing SSE register
3656 in 32bit, 64bit, 128bit, 256bit and 512bit. */
3657 {8, 8, 8, 12, 15}, /* cost of unaligned loads. */
3658 {8, 8, 8, 12, 15}, /* cost of unaligned storess. */
3659 2, 3, 4, /* cost of moving XMM,YMM,ZMM register. */
3660 8, /* cost of moving SSE register to integer. */
3661 18, 6, /* Gather load static, per_elt. */
3662 18, 6, /* Gather store static, per_elt. */
3663 32, /* size of l1 cache. */
3664 256, /* size of l2 cache. */
3665 64, /* size of prefetch block. */
3666 12, /* number of parallel prefetches. */
3667 3, /* Branch cost. */
3668 COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */
3669 COSTS_N_INSNS (3), /* cost of FMUL instruction. */
3670 COSTS_N_INSNS (14), /* cost of FDIV instruction. */
3671 COSTS_N_INSNS (1), /* cost of FABS instruction. */
3672 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
3673 COSTS_N_INSNS (40), /* cost of FSQRT instruction. */
3674
3675 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
3676 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
3677 COSTS_N_INSNS (3), /* cost of MULSS instruction. */
3678 COSTS_N_INSNS (3), /* cost of MULSD instruction. */
3679 COSTS_N_INSNS (5), /* cost of FMA SS instruction. */
3680 COSTS_N_INSNS (5), /* cost of FMA SD instruction. */
3681 COSTS_N_INSNS (10), /* cost of DIVSS instruction. */
3682 COSTS_N_INSNS (14), /* cost of DIVSD instruction. */
3683 COSTS_N_INSNS (20), /* cost of SQRTSS instruction. */
3684 COSTS_N_INSNS (35), /* cost of SQRTSD instruction. */
3685 4, 4, 4, 4, /* reassoc int, fp, vec_int, vec_fp. */
3686 yongfeng_memcpy,
3687 yongfeng_memset,
3688 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
3689 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
3690 "16:11:8", /* Loop alignment. */
3691 "16:11:8", /* Jump alignment. */
3692 "0:0:8", /* Label alignment. */
3693 "16", /* Func alignment. */
3694 4, /* Small unroll limit. */
3695 2, /* Small unroll factor. */
3696 COSTS_N_INSNS (2), /* Branch mispredict scale. */
3697 };
3698
3699 /* shijidadao_cost should produce code tuned for ZHAOXIN shijidadao CPU. */
3700 static stringop_algs shijidadao_memcpy[2] = {
3701 {libcall, {{8, unrolled_loop, true}, {256, unrolled_loop, false},
3702 {-1, libcall, false}}},
3703 {libcall, {{10, loop, true}, {256, unrolled_loop, false},
3704 {-1, libcall, false}}}};
3705 static stringop_algs shijidadao_memset[2] = {
3706 {libcall, {{4, loop, true}, {128, unrolled_loop, false},
3707 {-1, libcall, false}}},
3708 {libcall, {{1, rep_prefix_4_byte, false}, {14, loop, true},
3709 {1024, vector_loop, false},
3710 {-1, libcall, false}}}};
3711 static const
3712 struct processor_costs shijidadao_cost = {
3713 {
3714 /* Start of register allocator costs. integer->integer move cost is 2. */
3715 8, /* cost for loading QImode using movzbl. */
3716 {8, 8, 8}, /* cost of loading integer registers
3717 in QImode, HImode and SImode.
3718 Relative to reg-reg move (2). */
3719 {8, 8, 8}, /* cost of storing integer registers. */
3720 2, /* cost of reg,reg fld/fst. */
3721 {8, 8, 8}, /* cost of loading fp registers
3722 in SFmode, DFmode and XFmode. */
3723 {8, 8, 8}, /* cost of storing fp registers
3724 in SFmode, DFmode and XFmode. */
3725 2, /* cost of moving MMX register. */
3726 {8, 8}, /* cost of loading MMX registers
3727 in SImode and DImode. */
3728 {8, 8}, /* cost of storing MMX registers
3729 in SImode and DImode. */
3730 2, 3, 4, /* cost of moving XMM,YMM,ZMM register. */
3731 {8, 8, 8, 10, 15}, /* cost of loading SSE registers
3732 in 32,64,128,256 and 512-bit. */
3733 {8, 8, 8, 10, 15}, /* cost of storing SSE registers
3734 in 32,64,128,256 and 512-bit. */
3735 8, 8, /* SSE->integer and integer->SSE moves. */
3736 8, 8, /* mask->integer and integer->mask moves. */
3737 {8, 8, 8}, /* cost of loading mask register
3738 in QImode, HImode, SImode. */
3739 {8, 8, 8}, /* cost if storing mask register
3740 in QImode, HImode, SImode. */
3741 2, /* cost of moving mask register. */
3742 /* End of register allocator costs. */
3743 },
3744
3745 COSTS_N_INSNS (1), /* cost of an add instruction. */
3746 COSTS_N_INSNS (1), /* cost of a lea instruction. */
3747 COSTS_N_INSNS (1), /* variable shift costs. */
3748 COSTS_N_INSNS (1), /* constant shift costs. */
3749 {COSTS_N_INSNS (2), /* cost of starting multiply for QI. */
3750 COSTS_N_INSNS (3), /* HI. */
3751 COSTS_N_INSNS (2), /* SI. */
3752 COSTS_N_INSNS (2), /* DI. */
3753 COSTS_N_INSNS (3)}, /* other. */
3754 0, /* cost of multiply per each bit set. */
3755 {COSTS_N_INSNS (9), /* cost of a divide/mod for QI. */
3756 COSTS_N_INSNS (10), /* HI. */
3757 COSTS_N_INSNS (9), /* SI. */
3758 COSTS_N_INSNS (50), /* DI. */
3759 COSTS_N_INSNS (50)}, /* other. */
3760 COSTS_N_INSNS (1), /* cost of movsx. */
3761 COSTS_N_INSNS (1), /* cost of movzx. */
3762 8, /* "large" insn. */
3763 17, /* MOVE_RATIO. */
3764 6, /* CLEAR_RATIO. */
3765 {8, 8, 8}, /* cost of loading integer registers
3766 in QImode, HImode and SImode.
3767 Relative to reg-reg move (2). */
3768 {8, 8, 8}, /* cost of storing integer registers. */
3769 {8, 8, 8, 12, 15}, /* cost of loading SSE register
3770 in 32bit, 64bit, 128bit, 256bit and 512bit. */
3771 {8, 8, 8, 12, 15}, /* cost of storing SSE register
3772 in 32bit, 64bit, 128bit, 256bit and 512bit. */
3773 {8, 8, 8, 12, 15}, /* cost of unaligned loads. */
3774 {8, 8, 8, 12, 15}, /* cost of unaligned storess. */
3775 2, 3, 4, /* cost of moving XMM,YMM,ZMM register. */
3776 8, /* cost of moving SSE register to integer. */
3777 18, 6, /* Gather load static, per_elt. */
3778 18, 6, /* Gather store static, per_elt. */
3779 32, /* size of l1 cache. */
3780 256, /* size of l2 cache. */
3781 64, /* size of prefetch block. */
3782 12, /* number of parallel prefetches. */
3783 3, /* Branch cost. */
3784 COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */
3785 COSTS_N_INSNS (3), /* cost of FMUL instruction. */
3786 COSTS_N_INSNS (13), /* cost of FDIV instruction. */
3787 COSTS_N_INSNS (2), /* cost of FABS instruction. */
3788 COSTS_N_INSNS (2), /* cost of FCHS instruction. */
3789 COSTS_N_INSNS (44), /* cost of FSQRT instruction. */
3790
3791 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
3792 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
3793 COSTS_N_INSNS (3), /* cost of MULSS instruction. */
3794 COSTS_N_INSNS (3), /* cost of MULSD instruction. */
3795 COSTS_N_INSNS (5), /* cost of FMA SS instruction. */
3796 COSTS_N_INSNS (5), /* cost of FMA SD instruction. */
3797 COSTS_N_INSNS (11), /* cost of DIVSS instruction. */
3798 COSTS_N_INSNS (14), /* cost of DIVSD instruction. */
3799 COSTS_N_INSNS (11), /* cost of SQRTSS instruction. */
3800 COSTS_N_INSNS (18), /* cost of SQRTSD instruction. */
3801 4, 4, 4, 4, /* reassoc int, fp, vec_int, vec_fp. */
3802 shijidadao_memcpy,
3803 shijidadao_memset,
3804 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
3805 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
3806 "16:11:8", /* Loop alignment. */
3807 "16:11:8", /* Jump alignment. */
3808 "0:0:8", /* Label alignment. */
3809 "16", /* Func alignment. */
3810 4, /* Small unroll limit. */
3811 2, /* Small unroll factor. */
3812 COSTS_N_INSNS (2), /* Branch mispredict scale. */
3813 };
3814
3815
3816
3817 /* Generic should produce code tuned for Core-i7 (and newer chips)
3818 and btver1 (and newer chips). */
3819
3820 static stringop_algs generic_memcpy[2] = {
3821 {libcall, {{32, loop, false}, {8192, rep_prefix_4_byte, false},
3822 {-1, libcall, false}}},
3823 {libcall, {{32, loop, false}, {8192, rep_prefix_8_byte, false},
3824 {-1, libcall, false}}}};
3825 static stringop_algs generic_memset[2] = {
3826 {libcall, {{32, loop, false}, {8192, rep_prefix_4_byte, false},
3827 {-1, libcall, false}}},
3828 {libcall, {{32, loop, false}, {8192, rep_prefix_8_byte, false},
3829 {-1, libcall, false}}}};
3830 static const
3831 struct processor_costs generic_cost = {
3832 {
3833 /* Start of register allocator costs. integer->integer move cost is 2. */
3834 6, /* cost for loading QImode using movzbl */
3835 {6, 6, 6}, /* cost of loading integer registers
3836 in QImode, HImode and SImode.
3837 Relative to reg-reg move (2). */
3838 {6, 6, 6}, /* cost of storing integer registers */
3839 4, /* cost of reg,reg fld/fst */
3840 {6, 6, 12}, /* cost of loading fp registers
3841 in SFmode, DFmode and XFmode */
3842 {6, 6, 12}, /* cost of storing fp registers
3843 in SFmode, DFmode and XFmode */
3844 2, /* cost of moving MMX register */
3845 {6, 6}, /* cost of loading MMX registers
3846 in SImode and DImode */
3847 {6, 6}, /* cost of storing MMX registers
3848 in SImode and DImode */
3849 2, 3, 4, /* cost of moving XMM,YMM,ZMM register */
3850 {6, 6, 6, 10, 15}, /* cost of loading SSE registers
3851 in 32,64,128,256 and 512-bit */
3852 {6, 6, 6, 10, 15}, /* cost of storing SSE registers
3853 in 32,64,128,256 and 512-bit */
3854 6, 6, /* SSE->integer and integer->SSE moves */
3855 6, 6, /* mask->integer and integer->mask moves */
3856 {6, 6, 6}, /* cost of loading mask register
3857 in QImode, HImode, SImode. */
3858 {6, 6, 6}, /* cost if storing mask register
3859 in QImode, HImode, SImode. */
3860 2, /* cost of moving mask register. */
3861 /* End of register allocator costs. */
3862 },
3863
3864 COSTS_N_INSNS (1), /* cost of an add instruction */
3865 /* Setting cost to 2 makes our current implementation of synth_mult result in
3866 use of unnecessary temporary registers causing regression on several
3867 SPECfp benchmarks. */
3868 COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */
3869 COSTS_N_INSNS (1), /* variable shift costs */
3870 COSTS_N_INSNS (1), /* constant shift costs */
3871 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
3872 COSTS_N_INSNS (3), /* HI */
3873 COSTS_N_INSNS (3), /* SI */
3874 COSTS_N_INSNS (3), /* DI */
3875 COSTS_N_INSNS (4)}, /* other */
3876 0, /* cost of multiply per each bit set */
3877 {COSTS_N_INSNS (16), /* cost of a divide/mod for QI */
3878 COSTS_N_INSNS (22), /* HI */
3879 COSTS_N_INSNS (30), /* SI */
3880 COSTS_N_INSNS (74), /* DI */
3881 COSTS_N_INSNS (74)}, /* other */
3882 COSTS_N_INSNS (1), /* cost of movsx */
3883 COSTS_N_INSNS (1), /* cost of movzx */
3884 8, /* "large" insn */
3885 17, /* MOVE_RATIO */
3886 6, /* CLEAR_RATIO */
3887 {6, 6, 6}, /* cost of loading integer registers
3888 in QImode, HImode and SImode.
3889 Relative to reg-reg move (2). */
3890 {6, 6, 6}, /* cost of storing integer registers */
3891 {6, 6, 6, 10, 15}, /* cost of loading SSE register
3892 in 32bit, 64bit, 128bit, 256bit and 512bit */
3893 {6, 6, 6, 10, 15}, /* cost of storing SSE register
3894 in 32bit, 64bit, 128bit, 256bit and 512bit */
3895 {6, 6, 6, 10, 15}, /* cost of unaligned loads. */
3896 {6, 6, 6, 10, 15}, /* cost of unaligned storess. */
3897 2, 3, 4, /* cost of moving XMM,YMM,ZMM register */
3898 6, /* cost of moving SSE register to integer. */
3899 18, 6, /* Gather load static, per_elt. */
3900 18, 6, /* Gather store static, per_elt. */
3901 32, /* size of l1 cache. */
3902 512, /* size of l2 cache. */
3903 64, /* size of prefetch block */
3904 6, /* number of parallel prefetches */
3905 /* Benchmarks shows large regressions on K8 sixtrack benchmark when this
3906 value is increased to perhaps more appropriate value of 5. */
3907 3, /* Branch cost */
3908 COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */
3909 COSTS_N_INSNS (5), /* cost of FMUL instruction. */
3910 COSTS_N_INSNS (17), /* cost of FDIV instruction. */
3911 COSTS_N_INSNS (1), /* cost of FABS instruction. */
3912 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
3913 COSTS_N_INSNS (14), /* cost of FSQRT instruction. */
3914
3915 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
3916 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
3917 COSTS_N_INSNS (4), /* cost of MULSS instruction. */
3918 COSTS_N_INSNS (5), /* cost of MULSD instruction. */
3919 COSTS_N_INSNS (5), /* cost of FMA SS instruction. */
3920 COSTS_N_INSNS (5), /* cost of FMA SD instruction. */
3921 COSTS_N_INSNS (13), /* cost of DIVSS instruction. */
3922 COSTS_N_INSNS (17), /* cost of DIVSD instruction. */
3923 COSTS_N_INSNS (14), /* cost of SQRTSS instruction. */
3924 COSTS_N_INSNS (18), /* cost of SQRTSD instruction. */
3925 1, 4, 3, 3, /* reassoc int, fp, vec_int, vec_fp. */
3926 generic_memcpy,
3927 generic_memset,
3928 COSTS_N_INSNS (4), /* cond_taken_branch_cost. */
3929 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
3930 "16", /* Loop alignment. */
3931 "16:11:8", /* Jump alignment. */
3932 "0:0:8", /* Label alignment. */
3933 "16", /* Func alignment. */
3934 4, /* Small unroll limit. */
3935 2, /* Small unroll factor. */
3936 COSTS_N_INSNS (2), /* Branch mispredict scale. */
3937 };
3938
3939 /* core_cost should produce code tuned for Core familly of CPUs. */
3940 static stringop_algs core_memcpy[2] = {
3941 {libcall, {{1024, rep_prefix_4_byte, true}, {-1, libcall, false}}},
3942 {libcall, {{24, loop, true}, {128, rep_prefix_8_byte, true},
3943 {-1, libcall, false}}}};
3944 static stringop_algs core_memset[2] = {
3945 {libcall, {{6, loop_1_byte, true},
3946 {24, loop, true},
3947 {8192, rep_prefix_4_byte, true},
3948 {-1, libcall, false}}},
3949 {libcall, {{24, loop, true}, {512, rep_prefix_8_byte, true},
3950 {-1, libcall, false}}}};
3951
3952 static const
3953 struct processor_costs core_cost = {
3954 {
3955 /* Start of register allocator costs. integer->integer move cost is 2. */
3956 6, /* cost for loading QImode using movzbl */
3957 {4, 4, 4}, /* cost of loading integer registers
3958 in QImode, HImode and SImode.
3959 Relative to reg-reg move (2). */
3960 {6, 6, 6}, /* cost of storing integer registers */
3961 2, /* cost of reg,reg fld/fst */
3962 {6, 6, 8}, /* cost of loading fp registers
3963 in SFmode, DFmode and XFmode */
3964 {6, 6, 10}, /* cost of storing fp registers
3965 in SFmode, DFmode and XFmode */
3966 2, /* cost of moving MMX register */
3967 {6, 6}, /* cost of loading MMX registers
3968 in SImode and DImode */
3969 {6, 6}, /* cost of storing MMX registers
3970 in SImode and DImode */
3971 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */
3972 {6, 6, 6, 6, 12}, /* cost of loading SSE registers
3973 in 32,64,128,256 and 512-bit */
3974 {6, 6, 6, 6, 12}, /* cost of storing SSE registers
3975 in 32,64,128,256 and 512-bit */
3976 6, 6, /* SSE->integer and integer->SSE moves */
3977 6, 6, /* mask->integer and integer->mask moves */
3978 {4, 4, 4}, /* cost of loading mask register
3979 in QImode, HImode, SImode. */
3980 {6, 6, 6}, /* cost if storing mask register
3981 in QImode, HImode, SImode. */
3982 2, /* cost of moving mask register. */
3983 /* End of register allocator costs. */
3984 },
3985
3986 COSTS_N_INSNS (1), /* cost of an add instruction */
3987 /* On all chips taken into consideration lea is 2 cycles and more. With
3988 this cost however our current implementation of synth_mult results in
3989 use of unnecessary temporary registers causing regression on several
3990 SPECfp benchmarks. */
3991 COSTS_N_INSNS (1) + 1, /* cost of a lea instruction */
3992 COSTS_N_INSNS (1), /* variable shift costs */
3993 COSTS_N_INSNS (1), /* constant shift costs */
3994 {COSTS_N_INSNS (3), /* cost of starting multiply for QI */
3995 COSTS_N_INSNS (4), /* HI */
3996 COSTS_N_INSNS (3), /* SI */
3997 /* Here we tune for Sandybridge or newer. */
3998 COSTS_N_INSNS (3), /* DI */
3999 COSTS_N_INSNS (3)}, /* other */
4000 0, /* cost of multiply per each bit set */
4001 /* Expanding div/mod currently doesn't consider parallelism. So the cost
4002 model is not realistic. We compensate by increasing the latencies a bit. */
4003 {COSTS_N_INSNS (11), /* cost of a divide/mod for QI */
4004 COSTS_N_INSNS (11), /* HI */
4005 COSTS_N_INSNS (14), /* SI */
4006 COSTS_N_INSNS (81), /* DI */
4007 COSTS_N_INSNS (81)}, /* other */
4008 COSTS_N_INSNS (1), /* cost of movsx */
4009 COSTS_N_INSNS (1), /* cost of movzx */
4010 8, /* "large" insn */
4011 17, /* MOVE_RATIO */
4012 6, /* CLEAR_RATIO */
4013 {4, 4, 4}, /* cost of loading integer registers
4014 in QImode, HImode and SImode.
4015 Relative to reg-reg move (2). */
4016 {6, 6, 6}, /* cost of storing integer registers */
4017 {6, 6, 6, 6, 12}, /* cost of loading SSE register
4018 in 32bit, 64bit, 128bit, 256bit and 512bit */
4019 {6, 6, 6, 6, 12}, /* cost of storing SSE register
4020 in 32bit, 64bit, 128bit, 256bit and 512bit */
4021 {6, 6, 6, 6, 12}, /* cost of unaligned loads. */
4022 {6, 6, 6, 6, 12}, /* cost of unaligned stores. */
4023 2, 2, 4, /* cost of moving XMM,YMM,ZMM register */
4024 2, /* cost of moving SSE register to integer. */
4025 /* VGATHERDPD is 7 uops, rec throughput 5, while VGATHERDPD is 9 uops,
4026 rec. throughput 6.
4027 So 5 uops statically and one uops per load. */
4028 10, 6, /* Gather load static, per_elt. */
4029 10, 6, /* Gather store static, per_elt. */
4030 64, /* size of l1 cache. */
4031 512, /* size of l2 cache. */
4032 64, /* size of prefetch block */
4033 6, /* number of parallel prefetches */
4034 /* FIXME perhaps more appropriate value is 5. */
4035 3, /* Branch cost */
4036 COSTS_N_INSNS (3), /* cost of FADD and FSUB insns. */
4037 COSTS_N_INSNS (5), /* cost of FMUL instruction. */
4038 /* 10-24 */
4039 COSTS_N_INSNS (24), /* cost of FDIV instruction. */
4040 COSTS_N_INSNS (1), /* cost of FABS instruction. */
4041 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
4042 COSTS_N_INSNS (23), /* cost of FSQRT instruction. */
4043
4044 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
4045 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
4046 COSTS_N_INSNS (4), /* cost of MULSS instruction. */
4047 COSTS_N_INSNS (5), /* cost of MULSD instruction. */
4048 COSTS_N_INSNS (5), /* cost of FMA SS instruction. */
4049 COSTS_N_INSNS (5), /* cost of FMA SD instruction. */
4050 COSTS_N_INSNS (18), /* cost of DIVSS instruction. */
4051 COSTS_N_INSNS (32), /* cost of DIVSD instruction. */
4052 COSTS_N_INSNS (30), /* cost of SQRTSS instruction. */
4053 COSTS_N_INSNS (58), /* cost of SQRTSD instruction. */
4054 1, 4, 2, 2, /* reassoc int, fp, vec_int, vec_fp. */
4055 core_memcpy,
4056 core_memset,
4057 COSTS_N_INSNS (3), /* cond_taken_branch_cost. */
4058 COSTS_N_INSNS (1), /* cond_not_taken_branch_cost. */
4059 "16:11:8", /* Loop alignment. */
4060 "16:11:8", /* Jump alignment. */
4061 "0:0:8", /* Label alignment. */
4062 "16", /* Func alignment. */
4063 4, /* Small unroll limit. */
4064 2, /* Small unroll factor. */
4065 COSTS_N_INSNS (2), /* Branch mispredict scale. */
4066 };
4067
4068 /* C86_4G_M4 has optimized REP instruction for medium sized blocks, but for
4069 very small blocks it is better to use loop. For large blocks, libcall
4070 can do nontemporary accesses and beat inline considerably. */
4071 static stringop_algs c86_4g_m4_memcpy[2] = {
4072 /* 32-bit tuning. */
4073 {libcall, {{6, loop, false},
4074 {14, unrolled_loop, false},
4075 {-1, libcall, false}}},
4076 /* 64-bit tuning. */
4077 {libcall, {{16, loop, false},
4078 {128, rep_prefix_8_byte, false},
4079 {-1, libcall, false}}}};
4080 static stringop_algs c86_4g_m4_memset[2] = {
4081 /* 32-bit tuning. */
4082 {libcall, {{8, loop, false},
4083 {24, unrolled_loop, false},
4084 {128, rep_prefix_4_byte, false},
4085 {-1, libcall, false}}},
4086 /* 64-bit tuning. */
4087 {libcall, {{48, unrolled_loop, false},
4088 {128, rep_prefix_8_byte, false},
4089 {-1, libcall, false}}}};
4090 static const
4091 struct processor_costs c86_4g_m4_cost = {
4092 {
4093 /* Start of register allocator costs. integer->integer move cost is 2. */
4094
4095 /* reg-reg moves are done by renaming and thus they are even cheaper than
4096 1 cycle. Because reg-reg move cost is 2 and the following tables
4097 correspond to doubles of latencies, we do not model this correctly.
4098 It does not seem to make practical difference to bump prices up even
4099 more. */
4100 6, /* cost for loading QImode using
4101 movzbl. */
4102 {6, 6, 6}, /* cost of loading integer registers
4103 in QImode, HImode and SImode.
4104 Relative to reg-reg move (2). */
4105 {8, 8, 8}, /* cost of storing integer
4106 registers. */
4107 2, /* cost of reg,reg fld/fst. */
4108 {6, 6, 16}, /* cost of loading fp registers
4109 in SFmode, DFmode and XFmode. */
4110 {8, 8, 16}, /* cost of storing fp registers
4111 in SFmode, DFmode and XFmode. */
4112 2, /* cost of moving MMX register. */
4113 {6, 6}, /* cost of loading MMX registers
4114 in SImode and DImode. */
4115 {8, 8}, /* cost of storing MMX registers
4116 in SImode and DImode. */
4117 2, 3, 6, /* cost of moving XMM,YMM,ZMM register. */
4118 {6, 6, 6, 12, 24}, /* cost of loading SSE registers
4119 in 32,64,128,256 and 512-bit. */
4120 {8, 8, 8, 16, 32}, /* cost of storing SSE registers
4121 in 32,64,128,256 and 512-bit. */
4122 6, 6, /* SSE->integer and integer->SSE moves. */
4123 8, 8, /* mask->integer and integer->mask moves */
4124 {6, 6, 6}, /* cost of loading mask register
4125 in QImode, HImode, SImode. */
4126 {8, 8, 8}, /* cost if storing mask register
4127 in QImode, HImode, SImode. */
4128 2, /* cost of moving mask register. */
4129 /* End of register allocator costs. */
4130 },
4131
4132 COSTS_N_INSNS (1), /* cost of an add instruction. */
4133 COSTS_N_INSNS (1), /* cost of a lea instruction. */
4134 COSTS_N_INSNS (1), /* variable shift costs. */
4135 COSTS_N_INSNS (1), /* constant shift costs. */
4136 {COSTS_N_INSNS (3), /* cost of starting multiply for QI. */
4137 COSTS_N_INSNS (3), /* HI. */
4138 COSTS_N_INSNS (3), /* SI. */
4139 COSTS_N_INSNS (3), /* DI. */
4140 COSTS_N_INSNS (3)}, /* other. */
4141 0, /* cost of multiply per each bit
4142 set. */
4143 /* Depending on parameters, idiv can get faster on HYGON. This is upper
4144 bound. */
4145 {COSTS_N_INSNS (16), /* cost of a divide/mod for QI. */
4146 COSTS_N_INSNS (22), /* HI. */
4147 COSTS_N_INSNS (30), /* SI. */
4148 COSTS_N_INSNS (45), /* DI. */
4149 COSTS_N_INSNS (45)}, /* other. */
4150 COSTS_N_INSNS (1), /* cost of movsx. */
4151 COSTS_N_INSNS (1), /* cost of movzx. */
4152 8, /* "large" insn. */
4153 9, /* MOVE_RATIO. */
4154 6, /* CLEAR_RATIO */
4155 {6, 6, 6}, /* cost of loading integer registers
4156 in QImode, HImode and SImode.
4157 Relative to reg-reg move (2). */
4158 {8, 8, 8}, /* cost of storing integer
4159 registers. */
4160 {6, 6, 6, 12, 24}, /* cost of loading SSE register
4161 in 32bit, 64bit, 128bit, 256bit and 512bit */
4162 {8, 8, 8, 16, 32}, /* cost of storing SSE register
4163 in 32bit, 64bit, 128bit, 256bit and 512bit */
4164 {6, 6, 6, 12, 24}, /* cost of unaligned loads. */
4165 {8, 8, 8, 16, 32}, /* cost of unaligned stores. */
4166 2, 3, 6, /* cost of moving XMM,YMM,ZMM register. */
4167 6, /* cost of moving SSE register to integer. */
4168
4169 18, 8, /* Gather load static, per_elt. */
4170 18, 10, /* Gather store static, per_elt. */
4171 32, /* size of l1 cache. */
4172 512, /* size of l2 cache. */
4173 64, /* size of prefetch block. */
4174 /* C86_4G_M4 processors never drop prefetches; if they cannot be performed
4175 immediately, they are queued. We set number of simultaneous prefetches
4176 to a large constant to reflect this (it probably is not a good idea not
4177 to limit number of prefetches at all, as their execution also takes some
4178 time). */
4179 100, /* number of parallel prefetches. */
4180 3, /* Branch cost. */
4181 COSTS_N_INSNS (5), /* cost of FADD and FSUB insns. */
4182 COSTS_N_INSNS (5), /* cost of FMUL instruction. */
4183
4184 COSTS_N_INSNS (15), /* cost of FDIV instruction. */
4185 COSTS_N_INSNS (1), /* cost of FABS instruction. */
4186 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
4187
4188 COSTS_N_INSNS (10), /* cost of FSQRT instruction. */
4189
4190 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
4191 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
4192 COSTS_N_INSNS (3), /* cost of MULSS instruction. */
4193 COSTS_N_INSNS (4), /* cost of MULSD instruction. */
4194 COSTS_N_INSNS (5), /* cost of FMA SS instruction. */
4195 COSTS_N_INSNS (5), /* cost of FMA SD instruction. */
4196 COSTS_N_INSNS (10), /* cost of DIVSS instruction. */
4197
4198 COSTS_N_INSNS (13), /* cost of DIVSD instruction. */
4199 COSTS_N_INSNS (10), /* cost of SQRTSS instruction. */
4200 COSTS_N_INSNS (15), /* cost of SQRTSD instruction. */
4201
4202 4, 4, 3, 6, /* reassoc int, fp, vec_int, vec_fp. */
4203 c86_4g_m4_memcpy,
4204 c86_4g_m4_memset,
4205 COSTS_N_INSNS (4), /* cond_taken_branch_cost. */
4206 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
4207 "16", /* Loop alignment. */
4208 "16", /* Jump alignment. */
4209 "0:0:8", /* Label alignment. */
4210 "16", /* Func alignment. */
4211 4, /* Small unroll limit. */
4212 2, /* Small unroll factor. */
4213 COSTS_N_INSNS (2), /* Branch mispredict scale. */
4214 };
4215
4216 struct processor_costs c86_4g_m6_cost = c86_4g_m4_cost;
4217
4218 struct processor_costs c86_4g_m7_cost = {
4219 {
4220 /* Start of register allocator costs. integer->integer move cost is 2. */
4221
4222 /* reg-reg moves are done by renaming and thus they are even cheaper than
4223 1 cycle. Because reg-reg move cost is 2 and following tables correspond
4224 to doubles of latencies, we do not model this correctly. It does not
4225 seem to make practical difference to bump prices up even more. */
4226 6, /* cost for loading QImode using
4227 movzbl. */
4228 {6, 6, 6}, /* cost of loading integer registers
4229 in QImode, HImode and SImode.
4230 Relative to reg-reg move (2). */
4231 {8, 8, 8}, /* cost of storing integer
4232 registers. */
4233 2, /* cost of reg,reg fld/fst. */
4234 {14, 14, 17}, /* cost of loading fp registers
4235 in SFmode, DFmode and XFmode. */
4236 {12, 12, 16}, /* cost of storing fp registers
4237 in SFmode, DFmode and XFmode. */
4238 2, /* cost of moving MMX register. */
4239 {6, 6}, /* cost of loading MMX registers
4240 in SImode and DImode. */
4241 {8, 8}, /* cost of storing MMX registers
4242 in SImode and DImode. */
4243 2, 2, 3, /* cost of moving XMM,YMM,ZMM
4244 register. */
4245 {6, 6, 10, 10, 12}, /* cost of loading SSE registers
4246 in 32,64,128,256 and 512-bit. */
4247 {8, 8, 8, 12, 12}, /* cost of storing SSE registers
4248 in 32,64,128,256 and 512-bit. */
4249 6, 8, /* SSE->integer and integer->SSE
4250 moves. */
4251 8, 8, /* mask->integer and integer->mask moves */
4252 {6, 6, 6}, /* cost of loading mask register
4253 in QImode, HImode, SImode. */
4254 {8, 8, 8}, /* cost if storing mask register
4255 in QImode, HImode, SImode. */
4256 2, /* cost of moving mask register. */
4257 /* End of register allocator costs. */
4258 },
4259
4260 COSTS_N_INSNS (1), /* cost of an add instruction. */
4261
4262 COSTS_N_INSNS (1), /* cost of a lea instruction. */
4263 COSTS_N_INSNS (1), /* variable shift costs. */
4264 COSTS_N_INSNS (1), /* constant shift costs. */
4265 {COSTS_N_INSNS (3), /* cost of starting multiply for QI. */
4266 COSTS_N_INSNS (3), /* HI. */
4267 COSTS_N_INSNS (3), /* SI. */
4268 COSTS_N_INSNS (3), /* DI. */
4269 COSTS_N_INSNS (3)}, /* other. */
4270 0, /* cost of multiply per each bit
4271 set. */
4272 {COSTS_N_INSNS (15), /* cost of a divide/mod for QI. */
4273 COSTS_N_INSNS (17), /* HI. */
4274 COSTS_N_INSNS (25), /* SI. */
4275 COSTS_N_INSNS (41), /* DI. */
4276 COSTS_N_INSNS (41)}, /* other. */
4277 COSTS_N_INSNS (1), /* cost of movsx. */
4278 COSTS_N_INSNS (1), /* cost of movzx. */
4279 8, /* "large" insn. */
4280 9, /* MOVE_RATIO. */
4281 6, /* CLEAR_RATIO */
4282 {6, 6, 6}, /* cost of loading integer registers
4283 in QImode, HImode and SImode.
4284 Relative to reg-reg move (2). */
4285 {8, 8, 8}, /* cost of storing integer
4286 registers. */
4287 {6, 6, 10, 10, 12}, /* cost of loading SSE registers
4288 in 32bit, 64bit, 128bit, 256bit and 512bit */
4289 {8, 8, 8, 12, 12}, /* cost of storing SSE register
4290 in 32bit, 64bit, 128bit, 256bit and 512bit */
4291 {6, 6, 10, 10, 12}, /* cost of unaligned loads. */
4292 {8, 8, 8, 12, 12}, /* cost of unaligned stores. */
4293 2, 2, 3, /* cost of moving XMM,YMM,ZMM
4294 register. */
4295 6, /* cost of moving SSE register to integer. */
4296
4297 14, 10, /* Gather load static, per_elt. */
4298 14, 20, /* Gather store static, per_elt. */
4299 32, /* size of l1 cache. */
4300 512, /* size of l2 cache. */
4301 64, /* size of prefetch block. */
4302
4303 100, /* number of parallel prefetches. */
4304 3, /* Branch cost. */
4305 COSTS_N_INSNS (5), /* cost of FADD and FSUB insns. */
4306 COSTS_N_INSNS (5), /* cost of FMUL instruction. */
4307
4308 COSTS_N_INSNS (15), /* cost of FDIV instruction. */
4309 COSTS_N_INSNS (1), /* cost of FABS instruction. */
4310 COSTS_N_INSNS (1), /* cost of FCHS instruction. */
4311
4312 COSTS_N_INSNS (22), /* cost of FSQRT instruction. */
4313
4314 COSTS_N_INSNS (1), /* cost of cheap SSE instruction. */
4315 COSTS_N_INSNS (3), /* cost of ADDSS/SD SUBSS/SD insns. */
4316 COSTS_N_INSNS (3), /* cost of MULSS instruction. */
4317 COSTS_N_INSNS (3), /* cost of MULSD instruction. */
4318 COSTS_N_INSNS (4), /* cost of FMA SS instruction. */
4319 COSTS_N_INSNS (4), /* cost of FMA SD instruction. */
4320 COSTS_N_INSNS (13), /* cost of DIVSS instruction. */
4321
4322 COSTS_N_INSNS (10), /* cost of DIVSD instruction. */
4323 COSTS_N_INSNS (14), /* cost of SQRTSS instruction. */
4324 COSTS_N_INSNS (20), /* cost of SQRTSD instruction. */
4325
4326 4, 4, 3, 6, /* reassoc int, fp, vec_int, vec_fp. */
4327 c86_4g_m4_memcpy,
4328 c86_4g_m4_memset,
4329 COSTS_N_INSNS (4), /* cond_taken_branch_cost. */
4330 COSTS_N_INSNS (2), /* cond_not_taken_branch_cost. */
4331 "16", /* Loop alignment. */
4332 "16", /* Jump alignment. */
4333 "0:0:8", /* Label alignment. */
4334 "16", /* Func alignment. */
4335 4, /* Small unroll limit. */
4336 2, /* Small unroll factor. */
4337 COSTS_N_INSNS (2), /* Branch mispredict scale. */
4338 };