* sysdeps/x86_64/memset.S: Jump from bzero to memset using
[glibc.git] / sysdeps / x86_64 / memset.S
blob2b56a65df3772bfc26255af7641c19bd24f19d65
1 /* memset/bzero -- set memory area to CH/0
2    Optimized version for x86-64.
3    Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
4    This file is part of the GNU C Library.
6    The GNU C Library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
11    The GNU C Library 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 GNU
14    Lesser General Public License for more details.
16    You should have received a copy of the GNU Lesser General Public
17    License along with the GNU C Library; if not, write to the Free
18    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19    02111-1307 USA.  */
21 #include <sysdep.h>
23         .text
24 ENTRY (bzero)
25         mov     %rsi,%rdx       /* Adjust parameter.  */
26         xorl    %esi,%esi       /* Fill with 0s.  */
27         jmp     L(memset_entry)
28 END (bzero)
30 #if defined PIC && !defined NOT_IN_libc
31 ENTRY (__memset_chk)
32         cmpq    %rdx, %rcx
33         jb      HIDDEN_JUMPTARGET (__chk_fail)
34 END (__memset_chk)
35 #endif
37 ENTRY (memset)
38 L(memset_entry):
39         cmp    $0x1,%rdx
40         mov    %rdi,%rax        /* memset returns the dest address.  */
41         jne    L(ck2)
42         mov    %sil,(%rdi)
43         retq   $0x0
44 L(ck2):
45         mov    $0x101010101010101,%r9
46         mov    %rdx,%r8
47         movzbq %sil,%rdx
48         imul   %r9,%rdx
49 L(now_dw_aligned):
50         cmp    $0x90,%r8
51         jg     L(ck_mem_ops_method)
52 L(now_dw_aligned_small):
53         lea    L(setPxQx)(%rip),%r11
54         add    %r8,%rdi
55 #ifndef PIC
56         jmpq   *(%r11,%r8,8)
57 #else
58         movslq (%r11,%r8,4),%rcx
59         lea    (%rcx,%r11,1),%r11
60         jmpq   *%r11
61 #endif
63 L(Got0):
64         retq   $0x0
66         .pushsection .rodata
67         .balign     16
68 #ifndef PIC
69 L(setPxQx):
70         .quad       L(Got0), L(P1Q0), L(P2Q0), L(P3Q0)
71         .quad       L(P4Q0), L(P5Q0), L(P6Q0), L(P7Q0)
72         .quad       L(P0Q1), L(P1Q1), L(P2Q1), L(P3Q1)
73         .quad       L(P4Q1), L(P5Q1), L(P6Q1), L(P7Q1)
74         .quad       L(P0Q2), L(P1Q2), L(P2Q2), L(P3Q2)
75         .quad       L(P4Q2), L(P5Q2), L(P6Q2), L(P7Q2)
76         .quad       L(P0Q3), L(P1Q3), L(P2Q3), L(P3Q3)
77         .quad       L(P4Q3), L(P5Q3), L(P6Q3), L(P7Q3)
78         .quad       L(P0Q4), L(P1Q4), L(P2Q4), L(P3Q4)
79         .quad       L(P4Q4), L(P5Q4), L(P6Q4), L(P7Q4)
80         .quad       L(P0Q5), L(P1Q5), L(P2Q5), L(P3Q5)
81         .quad       L(P4Q5), L(P5Q5), L(P6Q5), L(P7Q5)
82         .quad       L(P0Q6), L(P1Q6), L(P2Q6), L(P3Q6)
83         .quad       L(P4Q6), L(P5Q6), L(P6Q6), L(P7Q6)
84         .quad       L(P0Q7), L(P1Q7), L(P2Q7), L(P3Q7)
85         .quad       L(P4Q7), L(P5Q7), L(P6Q7), L(P7Q7)
86         .quad       L(P0Q8), L(P1Q8), L(P2Q8), L(P3Q8)
87         .quad       L(P4Q8), L(P5Q8), L(P6Q8), L(P7Q8)
88         .quad       L(P0Q9), L(P1Q9), L(P2Q9), L(P3Q9)
89         .quad       L(P4Q9), L(P5Q9), L(P6Q9), L(P7Q9)
90         .quad       L(P0QA), L(P1QA), L(P2QA), L(P3QA)
91         .quad       L(P4QA), L(P5QA), L(P6QA), L(P7QA)
92         .quad       L(P0QB), L(P1QB), L(P2QB), L(P3QB)
93         .quad       L(P4QB), L(P5QB), L(P6QB), L(P7QB)
94         .quad       L(P0QC), L(P1QC), L(P2QC), L(P3QC)
95         .quad       L(P4QC), L(P5QC), L(P6QC), L(P7QC)
96         .quad       L(P0QD), L(P1QD), L(P2QD), L(P3QD)
97         .quad       L(P4QD), L(P5QD), L(P6QD), L(P7QD)
98         .quad       L(P0QE), L(P1QE), L(P2QE), L(P3QE)
99         .quad       L(P4QE), L(P5QE), L(P6QE), L(P7QE)
100         .quad       L(P0QF), L(P1QF), L(P2QF), L(P3QF)
101         .quad       L(P4QF), L(P5QF), L(P6QF), L(P7QF)
102         .quad       L(P0QG), L(P1QG), L(P2QG), L(P3QG)
103         .quad       L(P4QG), L(P5QG), L(P6QG), L(P7QG)
104         .quad       L(P0QH), L(P1QH), L(P2QH), L(P3QH)
105         .quad       L(P4QH), L(P5QH), L(P6QH), L(P7QH)
106         .quad       L(P0QI)
107 # ifdef USE_EXTRA_TABLE
108         .quad       L(P1QI), L(P2QI), L(P3QI), L(P4QI)
109         .quad       L(P5QI), L(P6QI), L(P7QI)
110 # endif
111 #else
112 L(setPxQx):
113         .int       L(Got0)-L(setPxQx)
114         .int       L(P1Q0)-L(setPxQx)
115         .int       L(P2Q0)-L(setPxQx)
116         .int       L(P3Q0)-L(setPxQx)
117         .int       L(P4Q0)-L(setPxQx)
118         .int       L(P5Q0)-L(setPxQx)
119         .int       L(P6Q0)-L(setPxQx)
120         .int       L(P7Q0)-L(setPxQx)
122         .int       L(P0Q1)-L(setPxQx)
123         .int       L(P1Q1)-L(setPxQx)
124         .int       L(P2Q1)-L(setPxQx)
125         .int       L(P3Q1)-L(setPxQx)
126         .int       L(P4Q1)-L(setPxQx)
127         .int       L(P5Q1)-L(setPxQx)
128         .int       L(P6Q1)-L(setPxQx)
129         .int       L(P7Q1)-L(setPxQx)
131         .int       L(P0Q2)-L(setPxQx)
132         .int       L(P1Q2)-L(setPxQx)
133         .int       L(P2Q2)-L(setPxQx)
134         .int       L(P3Q2)-L(setPxQx)
135         .int       L(P4Q2)-L(setPxQx)
136         .int       L(P5Q2)-L(setPxQx)
137         .int       L(P6Q2)-L(setPxQx)
138         .int       L(P7Q2)-L(setPxQx)
140         .int       L(P0Q3)-L(setPxQx)
141         .int       L(P1Q3)-L(setPxQx)
142         .int       L(P2Q3)-L(setPxQx)
143         .int       L(P3Q3)-L(setPxQx)
144         .int       L(P4Q3)-L(setPxQx)
145         .int       L(P5Q3)-L(setPxQx)
146         .int       L(P6Q3)-L(setPxQx)
147         .int       L(P7Q3)-L(setPxQx)
149         .int       L(P0Q4)-L(setPxQx)
150         .int       L(P1Q4)-L(setPxQx)
151         .int       L(P2Q4)-L(setPxQx)
152         .int       L(P3Q4)-L(setPxQx)
153         .int       L(P4Q4)-L(setPxQx)
154         .int       L(P5Q4)-L(setPxQx)
155         .int       L(P6Q4)-L(setPxQx)
156         .int       L(P7Q4)-L(setPxQx)
158         .int       L(P0Q5)-L(setPxQx)
159         .int       L(P1Q5)-L(setPxQx)
160         .int       L(P2Q5)-L(setPxQx)
161         .int       L(P3Q5)-L(setPxQx)
162         .int       L(P4Q5)-L(setPxQx)
163         .int       L(P5Q5)-L(setPxQx)
164         .int       L(P6Q5)-L(setPxQx)
165         .int       L(P7Q5)-L(setPxQx)
167         .int       L(P0Q6)-L(setPxQx)
168         .int       L(P1Q6)-L(setPxQx)
169         .int       L(P2Q6)-L(setPxQx)
170         .int       L(P3Q6)-L(setPxQx)
171         .int       L(P4Q6)-L(setPxQx)
172         .int       L(P5Q6)-L(setPxQx)
173         .int       L(P6Q6)-L(setPxQx)
174         .int       L(P7Q6)-L(setPxQx)
176         .int       L(P0Q7)-L(setPxQx)
177         .int       L(P1Q7)-L(setPxQx)
178         .int       L(P2Q7)-L(setPxQx)
179         .int       L(P3Q7)-L(setPxQx)
180         .int       L(P4Q7)-L(setPxQx)
181         .int       L(P5Q7)-L(setPxQx)
182         .int       L(P6Q7)-L(setPxQx)
183         .int       L(P7Q7)-L(setPxQx)
185         .int       L(P0Q8)-L(setPxQx)
186         .int       L(P1Q8)-L(setPxQx)
187         .int       L(P2Q8)-L(setPxQx)
188         .int       L(P3Q8)-L(setPxQx)
189         .int       L(P4Q8)-L(setPxQx)
190         .int       L(P5Q8)-L(setPxQx)
191         .int       L(P6Q8)-L(setPxQx)
192         .int       L(P7Q8)-L(setPxQx)
194         .int       L(P0Q9)-L(setPxQx)
195         .int       L(P1Q9)-L(setPxQx)
196         .int       L(P2Q9)-L(setPxQx)
197         .int       L(P3Q9)-L(setPxQx)
198         .int       L(P4Q9)-L(setPxQx)
199         .int       L(P5Q9)-L(setPxQx)
200         .int       L(P6Q9)-L(setPxQx)
201         .int       L(P7Q9)-L(setPxQx)
203         .int       L(P0QA)-L(setPxQx)
204         .int       L(P1QA)-L(setPxQx)
205         .int       L(P2QA)-L(setPxQx)
206         .int       L(P3QA)-L(setPxQx)
207         .int       L(P4QA)-L(setPxQx)
208         .int       L(P5QA)-L(setPxQx)
209         .int       L(P6QA)-L(setPxQx)
210         .int       L(P7QA)-L(setPxQx)
212         .int       L(P0QB)-L(setPxQx)
213         .int       L(P1QB)-L(setPxQx)
214         .int       L(P2QB)-L(setPxQx)
215         .int       L(P3QB)-L(setPxQx)
216         .int       L(P4QB)-L(setPxQx)
217         .int       L(P5QB)-L(setPxQx)
218         .int       L(P6QB)-L(setPxQx)
219         .int       L(P7QB)-L(setPxQx)
221         .int       L(P0QC)-L(setPxQx)
222         .int       L(P1QC)-L(setPxQx)
223         .int       L(P2QC)-L(setPxQx)
224         .int       L(P3QC)-L(setPxQx)
225         .int       L(P4QC)-L(setPxQx)
226         .int       L(P5QC)-L(setPxQx)
227         .int       L(P6QC)-L(setPxQx)
228         .int       L(P7QC)-L(setPxQx)
230         .int       L(P0QD)-L(setPxQx)
231         .int       L(P1QD)-L(setPxQx)
232         .int       L(P2QD)-L(setPxQx)
233         .int       L(P3QD)-L(setPxQx)
234         .int       L(P4QD)-L(setPxQx)
235         .int       L(P5QD)-L(setPxQx)
236         .int       L(P6QD)-L(setPxQx)
237         .int       L(P7QD)-L(setPxQx)
239         .int       L(P0QE)-L(setPxQx)
240         .int       L(P1QE)-L(setPxQx)
241         .int       L(P2QE)-L(setPxQx)
242         .int       L(P3QE)-L(setPxQx)
243         .int       L(P4QE)-L(setPxQx)
244         .int       L(P5QE)-L(setPxQx)
245         .int       L(P6QE)-L(setPxQx)
246         .int       L(P7QE)-L(setPxQx)
248         .int       L(P0QF)-L(setPxQx)
249         .int       L(P1QF)-L(setPxQx)
250         .int       L(P2QF)-L(setPxQx)
251         .int       L(P3QF)-L(setPxQx)
252         .int       L(P4QF)-L(setPxQx)
253         .int       L(P5QF)-L(setPxQx)
254         .int       L(P6QF)-L(setPxQx)
255         .int       L(P7QF)-L(setPxQx)
257         .int       L(P0QG)-L(setPxQx)
258         .int       L(P1QG)-L(setPxQx)
259         .int       L(P2QG)-L(setPxQx)
260         .int       L(P3QG)-L(setPxQx)
261         .int       L(P4QG)-L(setPxQx)
262         .int       L(P5QG)-L(setPxQx)
263         .int       L(P6QG)-L(setPxQx)
264         .int       L(P7QG)-L(setPxQx)
266         .int       L(P0QH)-L(setPxQx)
267         .int       L(P1QH)-L(setPxQx)
268         .int       L(P2QH)-L(setPxQx)
269         .int       L(P3QH)-L(setPxQx)
270         .int       L(P4QH)-L(setPxQx)
271         .int       L(P5QH)-L(setPxQx)
272         .int       L(P6QH)-L(setPxQx)
273         .int       L(P7QH)-L(setPxQx)
275         .int       L(P0QI)-L(setPxQx)
276 # ifdef USE_EXTRA_TABLE
277         .int       L(P1QI)-L(setPxQx)
278         .int       L(P2QI)-L(setPxQx)
279         .int       L(P3QI)-L(setPxQx)
280         .int       L(P4QI)-L(setPxQx)
281         .int       L(P5QI)-L(setPxQx)
282         .int       L(P6QI)-L(setPxQx)
283         .int       L(P7QI)-L(setPxQx)
284 # endif
285 #endif
286         .popsection
288         .balign     16
289 #ifdef USE_EXTRA_TABLE
290 L(P1QI): mov    %rdx,-0x91(%rdi)
291 #endif
292 L(P1QH): mov    %rdx,-0x89(%rdi)
293 L(P1QG): mov    %rdx,-0x81(%rdi)
294 #                  .balign     16
295 L(P1QF): mov    %rdx,-0x79(%rdi)
296 L(P1QE): mov    %rdx,-0x71(%rdi)
297 L(P1QD): mov    %rdx,-0x69(%rdi)
298 L(P1QC): mov    %rdx,-0x61(%rdi)
299 L(P1QB): mov    %rdx,-0x59(%rdi)
300 L(P1QA): mov    %rdx,-0x51(%rdi)
301 L(P1Q9): mov    %rdx,-0x49(%rdi)
302 L(P1Q8): mov    %rdx,-0x41(%rdi)
303 L(P1Q7): mov    %rdx,-0x39(%rdi)
304 L(P1Q6): mov    %rdx,-0x31(%rdi)
305 L(P1Q5): mov    %rdx,-0x29(%rdi)
306 L(P1Q4): mov    %rdx,-0x21(%rdi)
307 L(P1Q3): mov    %rdx,-0x19(%rdi)
308 L(P1Q2): mov    %rdx,-0x11(%rdi)
309 L(P1Q1): mov    %rdx,-0x9(%rdi)
310 L(P1Q0): mov    %dl,-0x1(%rdi)
311                 retq   $0x0
313         .balign     16
314 L(P0QI): mov    %rdx,-0x90(%rdi)
315 L(P0QH): mov    %rdx,-0x88(%rdi)
316 #                  .balign     16
317 L(P0QG): mov    %rdx,-0x80(%rdi)
318 L(P0QF): mov    %rdx,-0x78(%rdi)
319 L(P0QE): mov    %rdx,-0x70(%rdi)
320 L(P0QD): mov    %rdx,-0x68(%rdi)
321 L(P0QC): mov    %rdx,-0x60(%rdi)
322 L(P0QB): mov    %rdx,-0x58(%rdi)
323 L(P0QA): mov    %rdx,-0x50(%rdi)
324 L(P0Q9): mov    %rdx,-0x48(%rdi)
325 L(P0Q8): mov    %rdx,-0x40(%rdi)
326 L(P0Q7): mov    %rdx,-0x38(%rdi)
327 L(P0Q6): mov    %rdx,-0x30(%rdi)
328 L(P0Q5): mov    %rdx,-0x28(%rdi)
329 L(P0Q4): mov    %rdx,-0x20(%rdi)
330 L(P0Q3): mov    %rdx,-0x18(%rdi)
331 L(P0Q2): mov    %rdx,-0x10(%rdi)
332 L(P0Q1): mov    %rdx,-0x8(%rdi)
333 L(P0Q0): retq   $0x0
336         .balign     16
337 #ifdef USE_EXTRA_TABLE
338 L(P2QI): mov    %rdx,-0x92(%rdi)
339 #endif
340 L(P2QH): mov    %rdx,-0x8a(%rdi)
341 L(P2QG): mov    %rdx,-0x82(%rdi)
342 #                  .balign     16
343 L(P2QF): mov    %rdx,-0x7a(%rdi)
344 L(P2QE): mov    %rdx,-0x72(%rdi)
345 L(P2QD): mov    %rdx,-0x6a(%rdi)
346 L(P2QC): mov    %rdx,-0x62(%rdi)
347 L(P2QB): mov    %rdx,-0x5a(%rdi)
348 L(P2QA): mov    %rdx,-0x52(%rdi)
349 L(P2Q9): mov    %rdx,-0x4a(%rdi)
350 L(P2Q8): mov    %rdx,-0x42(%rdi)
351 L(P2Q7): mov    %rdx,-0x3a(%rdi)
352 L(P2Q6): mov    %rdx,-0x32(%rdi)
353 L(P2Q5): mov    %rdx,-0x2a(%rdi)
354 L(P2Q4): mov    %rdx,-0x22(%rdi)
355 L(P2Q3): mov    %rdx,-0x1a(%rdi)
356 L(P2Q2): mov    %rdx,-0x12(%rdi)
357 L(P2Q1): mov    %rdx,-0xa(%rdi)
358 L(P2Q0): mov    %dx,-0x2(%rdi)
359                 retq   $0x0
361         .balign     16
362 #ifdef USE_EXTRA_TABLE
363 L(P3QI): mov    %rdx,-0x93(%rdi)
364 #endif
365 L(P3QH): mov    %rdx,-0x8b(%rdi)
366 L(P3QG): mov    %rdx,-0x83(%rdi)
367 #                  .balign     16
368 L(P3QF): mov    %rdx,-0x7b(%rdi)
369 L(P3QE): mov    %rdx,-0x73(%rdi)
370 L(P3QD): mov    %rdx,-0x6b(%rdi)
371 L(P3QC): mov    %rdx,-0x63(%rdi)
372 L(P3QB): mov    %rdx,-0x5b(%rdi)
373 L(P3QA): mov    %rdx,-0x53(%rdi)
374 L(P3Q9): mov    %rdx,-0x4b(%rdi)
375 L(P3Q8): mov    %rdx,-0x43(%rdi)
376 L(P3Q7): mov    %rdx,-0x3b(%rdi)
377 L(P3Q6): mov    %rdx,-0x33(%rdi)
378 L(P3Q5): mov    %rdx,-0x2b(%rdi)
379 L(P3Q4): mov    %rdx,-0x23(%rdi)
380 L(P3Q3): mov    %rdx,-0x1b(%rdi)
381 L(P3Q2): mov    %rdx,-0x13(%rdi)
382 L(P3Q1): mov    %rdx,-0xb(%rdi)
383 L(P3Q0): mov    %dx,-0x3(%rdi)
384                 mov    %dl,-0x1(%rdi)
385                 retq   $0x0
387         .balign     16
388 #ifdef USE_EXTRA_TABLE
389 L(P4QI): mov    %rdx,-0x94(%rdi)
390 #endif
391 L(P4QH): mov    %rdx,-0x8c(%rdi)
392 L(P4QG): mov    %rdx,-0x84(%rdi)
393 #                  .balign     16
394 L(P4QF): mov    %rdx,-0x7c(%rdi)
395 L(P4QE): mov    %rdx,-0x74(%rdi)
396 L(P4QD): mov    %rdx,-0x6c(%rdi)
397 L(P4QC): mov    %rdx,-0x64(%rdi)
398 L(P4QB): mov    %rdx,-0x5c(%rdi)
399 L(P4QA): mov    %rdx,-0x54(%rdi)
400 L(P4Q9): mov    %rdx,-0x4c(%rdi)
401 L(P4Q8): mov    %rdx,-0x44(%rdi)
402 L(P4Q7): mov    %rdx,-0x3c(%rdi)
403 L(P4Q6): mov    %rdx,-0x34(%rdi)
404 L(P4Q5): mov    %rdx,-0x2c(%rdi)
405 L(P4Q4): mov    %rdx,-0x24(%rdi)
406 L(P4Q3): mov    %rdx,-0x1c(%rdi)
407 L(P4Q2): mov    %rdx,-0x14(%rdi)
408 L(P4Q1): mov    %rdx,-0xc(%rdi)
409 L(P4Q0): mov    %edx,-0x4(%rdi)
410                 retq   $0x0
412         .balign     16
413 #if defined(USE_EXTRA_TABLE)
414 L(P5QI): mov    %rdx,-0x95(%rdi)
415 #endif
416 L(P5QH): mov    %rdx,-0x8d(%rdi)
417 L(P5QG): mov    %rdx,-0x85(%rdi)
418 #                  .balign     16
419 L(P5QF): mov    %rdx,-0x7d(%rdi)
420 L(P5QE): mov    %rdx,-0x75(%rdi)
421 L(P5QD): mov    %rdx,-0x6d(%rdi)
422 L(P5QC): mov    %rdx,-0x65(%rdi)
423 L(P5QB): mov    %rdx,-0x5d(%rdi)
424 L(P5QA): mov    %rdx,-0x55(%rdi)
425 L(P5Q9): mov    %rdx,-0x4d(%rdi)
426 L(P5Q8): mov    %rdx,-0x45(%rdi)
427 L(P5Q7): mov    %rdx,-0x3d(%rdi)
428 L(P5Q6): mov    %rdx,-0x35(%rdi)
429 L(P5Q5): mov    %rdx,-0x2d(%rdi)
430 L(P5Q4): mov    %rdx,-0x25(%rdi)
431 L(P5Q3): mov    %rdx,-0x1d(%rdi)
432 L(P5Q2): mov    %rdx,-0x15(%rdi)
433 L(P5Q1): mov    %rdx,-0xd(%rdi)
434 L(P5Q0): mov    %edx,-0x5(%rdi)
435                 mov    %dl,-0x1(%rdi)
436                 retq   $0x0
438         .balign     16
439 #ifdef USE_EXTRA_TABLE
440 L(P6QI): mov    %rdx,-0x96(%rdi)
441 #endif
442 L(P6QH): mov    %rdx,-0x8e(%rdi)
443 L(P6QG): mov    %rdx,-0x86(%rdi)
444 #                  .balign     16
445 L(P6QF): mov    %rdx,-0x7e(%rdi)
446 L(P6QE): mov    %rdx,-0x76(%rdi)
447 L(P6QD): mov    %rdx,-0x6e(%rdi)
448 L(P6QC): mov    %rdx,-0x66(%rdi)
449 L(P6QB): mov    %rdx,-0x5e(%rdi)
450 L(P6QA): mov    %rdx,-0x56(%rdi)
451 L(P6Q9): mov    %rdx,-0x4e(%rdi)
452 L(P6Q8): mov    %rdx,-0x46(%rdi)
453 L(P6Q7): mov    %rdx,-0x3e(%rdi)
454 L(P6Q6): mov    %rdx,-0x36(%rdi)
455 L(P6Q5): mov    %rdx,-0x2e(%rdi)
456 L(P6Q4): mov    %rdx,-0x26(%rdi)
457 L(P6Q3): mov    %rdx,-0x1e(%rdi)
458 L(P6Q2): mov    %rdx,-0x16(%rdi)
459 L(P6Q1): mov    %rdx,-0xe(%rdi)
460 L(P6Q0): mov    %edx,-0x6(%rdi)
461                 mov    %dx,-0x2(%rdi)
462                 retq   $0x0
464         .balign     16
465 #ifdef USE_EXTRA_TABLE
466 L(P7QI): mov    %rdx,-0x97(%rdi)
467 #endif
468 L(P7QH): mov    %rdx,-0x8f(%rdi)
469 L(P7QG): mov    %rdx,-0x87(%rdi)
470 #                  .balign     16
471 L(P7QF): mov    %rdx,-0x7f(%rdi)
472 L(P7QE): mov    %rdx,-0x77(%rdi)
473 L(P7QD): mov    %rdx,-0x6f(%rdi)
474 L(P7QC): mov    %rdx,-0x67(%rdi)
475 L(P7QB): mov    %rdx,-0x5f(%rdi)
476 L(P7QA): mov    %rdx,-0x57(%rdi)
477 L(P7Q9): mov    %rdx,-0x4f(%rdi)
478 L(P7Q8): mov    %rdx,-0x47(%rdi)
479 L(P7Q7): mov    %rdx,-0x3f(%rdi)
480 L(P7Q6): mov    %rdx,-0x37(%rdi)
481 L(P7Q5): mov    %rdx,-0x2f(%rdi)
482 L(P7Q4): mov    %rdx,-0x27(%rdi)
483 L(P7Q3): mov    %rdx,-0x1f(%rdi)
484 L(P7Q2): mov    %rdx,-0x17(%rdi)
485 L(P7Q1): mov    %rdx,-0xf(%rdi)
486 L(P7Q0): mov    %edx,-0x7(%rdi)
487                 mov    %dx,-0x3(%rdi)
488                 mov    %dl,-0x1(%rdi)
489                 retq   $0x0
491         .balign     16
492 L(ck_mem_ops_method):
494 # align to 16 byte boundary first
495         #test $0xf,%rdi
496         #jz L(aligned_now)
497          lea    L(AliPxQx)(%rip),%r11
498          mov    $0x10,%r10
499          mov    %rdi,%r9
500          and    $0xf,%r9
501          sub    %r9,%r10
502          and    $0xf,%r10
503          add    %r10,%rdi
504          sub    %r10,%r8
505 #ifndef PIC
506         jmpq   *(%r11,%r10,8)
507 #else
508         movslq (%r11,%r10,4),%rcx
509         lea    (%rcx,%r11,1),%r11
510         jmpq   *%r11
511 #endif
513         .pushsection .rodata
514         .balign     16
515 #ifndef PIC
516 L(AliPxQx):
517         .quad       L(aligned_now), L(A1Q0), L(A2Q0), L(A3Q0)
518         .quad       L(A4Q0), L(A5Q0), L(A6Q0), L(A7Q0)
519         .quad       L(A0Q1), L(A1Q1), L(A2Q1), L(A3Q1)
520         .quad       L(A4Q1), L(A5Q1), L(A6Q1), L(A7Q1)
521 #else
522 L(AliPxQx):
523         .int       L(aligned_now)-L(AliPxQx)
524         .int       L(A1Q0)-L(AliPxQx)
525         .int       L(A2Q0)-L(AliPxQx)
526         .int       L(A3Q0)-L(AliPxQx)
527         .int       L(A4Q0)-L(AliPxQx)
528         .int       L(A5Q0)-L(AliPxQx)
529         .int       L(A6Q0)-L(AliPxQx)
530         .int       L(A7Q0)-L(AliPxQx)
532         .int       L(A0Q1)-L(AliPxQx)
533         .int       L(A1Q1)-L(AliPxQx)
534         .int       L(A2Q1)-L(AliPxQx)
535         .int       L(A3Q1)-L(AliPxQx)
536         .int       L(A4Q1)-L(AliPxQx)
537         .int       L(A5Q1)-L(AliPxQx)
538         .int       L(A6Q1)-L(AliPxQx)
539         .int       L(A7Q1)-L(AliPxQx)
540 #endif
541         .popsection
543         .balign     16
544 L(A5Q1):    mov    %dl,-0xd(%rdi)
545 L(A4Q1):    mov    %edx,-0xc(%rdi)
546 L(A0Q1):    mov    %rdx,-0x8(%rdi)
547 L(A0Q0):    jmp     L(aligned_now)
549         .balign     16
550 L(A1Q1):   mov    %dl,-0x9(%rdi)
551         mov    %rdx,-0x8(%rdi)
552         jmp    L(aligned_now)
554         .balign     16
555 L(A1Q0):   mov    %dl,-0x1(%rdi)
556         jmp    L(aligned_now)
558         .balign     16
559 L(A3Q1):    mov    %dl,-0xb(%rdi)
560 L(A2Q1):    mov    %dx,-0xa(%rdi)
561         mov    %rdx,-0x8(%rdi)
562         jmp    L(aligned_now)
564         .balign     16
565 L(A3Q0):    mov    %dl,-0x3(%rdi)
566 L(A2Q0):    mov    %dx,-0x2(%rdi)
567         jmp    L(aligned_now)
569         .balign     16
570 L(A5Q0):    mov    %dl,-0x5(%rdi)
571 L(A4Q0):    mov    %edx,-0x4(%rdi)
572         jmp    L(aligned_now)
574         .balign     16
575 L(A7Q1):    mov    %dl,-0xf(%rdi)
576 L(A6Q1):    mov    %dx,-0xe(%rdi)
577         mov    %edx,-0xc(%rdi)
578         mov    %rdx,-0x8(%rdi)
579         jmp    L(aligned_now)
581         .balign     16
582 L(A7Q0):    mov    %dl,-0x7(%rdi)
583 L(A6Q0):    mov    %dx,-0x6(%rdi)
584         mov    %edx,-0x4(%rdi)
585         jmp    L(aligned_now)
587         .balign     16
588 L(aligned_now):
590          cmpl   $0x1,__x86_64_preferred_memory_instruction(%rip)
591          jle     L(Loop8byte_pre)
593          # fill RegXMM0 with the pattern
594          movd   %rdx,%xmm0
595          punpcklqdq %xmm0,%xmm0
597   #cmp ecx,256
598   #jmp L(byte32sse2)
599   #cmp ecx,512  ; 256 or 512 doesn't matter much. Changing to 256 would reduce code size
600   #cmp RegLen,128  ; 256 or 512 doesn't matter much. Changing to 256 would reduce code size
602          lea    L(SSExDx)(%rip),%r9        # for later after the alignment
603          cmp    $0xb0,%r8 # 176
604          jge    L(byte32sse2_pre)
606          add    %r8,%rdi
607 #ifndef PIC
608          jmpq   *(%r9,%r8,8)
609 #else
610          movslq    (%r9,%r8,4),%rcx
611          lea    (%rcx,%r9,1),%r9
612          jmpq   *%r9
613 #endif
615 L(SSE0QB):  movdqa %xmm0,-0xb0(%rdi)
616 L(SSE0QA):  movdqa %xmm0,-0xa0(%rdi)
617 L(SSE0Q9):  movdqa %xmm0,-0x90(%rdi)
618 L(SSE0Q8):  movdqa %xmm0,-0x80(%rdi)
619 L(SSE0Q7):  movdqa %xmm0,-0x70(%rdi)
620 L(SSE0Q6):  movdqa %xmm0,-0x60(%rdi)
621 L(SSE0Q5):  movdqa %xmm0,-0x50(%rdi)
622 L(SSE0Q4):  movdqa %xmm0,-0x40(%rdi)
623 L(SSE0Q3):  movdqa %xmm0,-0x30(%rdi)
624 L(SSE0Q2):  movdqa %xmm0,-0x20(%rdi)
625 L(SSE0Q1):  movdqa %xmm0,-0x10(%rdi)
626 L(SSE0Q0):  retq   $0x0
628 L(SSE1QB):  movdqa %xmm0,-0xb1(%rdi)
629 L(SSE1QA):  movdqa %xmm0,-0xa1(%rdi)
630 L(SSE1Q9):  movdqa %xmm0,-0x91(%rdi)
631 L(SSE1Q8):  movdqa %xmm0,-0x81(%rdi)
632 L(SSE1Q7):  movdqa %xmm0,-0x71(%rdi)
633 L(SSE1Q6):  movdqa %xmm0,-0x61(%rdi)
634 L(SSE1Q5):  movdqa %xmm0,-0x51(%rdi)
635 L(SSE1Q4):  movdqa %xmm0,-0x41(%rdi)
636 L(SSE1Q3):  movdqa %xmm0,-0x31(%rdi)
637 L(SSE1Q2):  movdqa %xmm0,-0x21(%rdi)
638 L(SSE1Q1):  movdqa %xmm0,-0x11(%rdi)
639 L(SSE1Q0):  mov    %dl,-0x1(%rdi)
640         retq   $0x0
642 L(SSE2QB):  movdqa %xmm0,-0xb2(%rdi)
643 L(SSE2QA):  movdqa %xmm0,-0xa2(%rdi)
644 L(SSE2Q9):  movdqa %xmm0,-0x92(%rdi)
645 L(SSE2Q8):  movdqa %xmm0,-0x82(%rdi)
646 L(SSE2Q7):  movdqa %xmm0,-0x72(%rdi)
647 L(SSE2Q6):  movdqa %xmm0,-0x62(%rdi)
648 L(SSE2Q5):  movdqa %xmm0,-0x52(%rdi)
649 L(SSE2Q4):  movdqa %xmm0,-0x42(%rdi)
650 L(SSE2Q3):  movdqa %xmm0,-0x32(%rdi)
651 L(SSE2Q2):  movdqa %xmm0,-0x22(%rdi)
652 L(SSE2Q1):  movdqa %xmm0,-0x12(%rdi)
653 L(SSE2Q0):  mov    %dx,-0x2(%rdi)
654         retq   $0x0
656 L(SSE3QB):  movdqa %xmm0,-0xb3(%rdi)
657 L(SSE3QA):  movdqa %xmm0,-0xa3(%rdi)
658 L(SSE3Q9):  movdqa %xmm0,-0x93(%rdi)
659 L(SSE3Q8):  movdqa %xmm0,-0x83(%rdi)
660 L(SSE3Q7):  movdqa %xmm0,-0x73(%rdi)
661 L(SSE3Q6):  movdqa %xmm0,-0x63(%rdi)
662 L(SSE3Q5):  movdqa %xmm0,-0x53(%rdi)
663 L(SSE3Q4):  movdqa %xmm0,-0x43(%rdi)
664 L(SSE3Q3):  movdqa %xmm0,-0x33(%rdi)
665 L(SSE3Q2):  movdqa %xmm0,-0x23(%rdi)
666 L(SSE3Q1):  movdqa %xmm0,-0x13(%rdi)
667 L(SSE3Q0):  mov    %dx,-0x3(%rdi)
668         mov    %dl,-0x1(%rdi)
669         retq   $0x0
671 L(SSE4QB):  movdqa %xmm0,-0xb4(%rdi)
672 L(SSE4QA):  movdqa %xmm0,-0xa4(%rdi)
673 L(SSE4Q9):  movdqa %xmm0,-0x94(%rdi)
674 L(SSE4Q8):  movdqa %xmm0,-0x84(%rdi)
675 L(SSE4Q7):  movdqa %xmm0,-0x74(%rdi)
676 L(SSE4Q6):  movdqa %xmm0,-0x64(%rdi)
677 L(SSE4Q5):  movdqa %xmm0,-0x54(%rdi)
678 L(SSE4Q4):  movdqa %xmm0,-0x44(%rdi)
679 L(SSE4Q3):  movdqa %xmm0,-0x34(%rdi)
680 L(SSE4Q2):  movdqa %xmm0,-0x24(%rdi)
681 L(SSE4Q1):  movdqa %xmm0,-0x14(%rdi)
682 L(SSE4Q0):  mov    %edx,-0x4(%rdi)
683         retq   $0x0
685 L(SSE5QB):  movdqa %xmm0,-0xb5(%rdi)
686 L(SSE5QA):  movdqa %xmm0,-0xa5(%rdi)
687 L(SSE5Q9):  movdqa %xmm0,-0x95(%rdi)
688 L(SSE5Q8):  movdqa %xmm0,-0x85(%rdi)
689 L(SSE5Q7):  movdqa %xmm0,-0x75(%rdi)
690 L(SSE5Q6):  movdqa %xmm0,-0x65(%rdi)
691 L(SSE5Q5):  movdqa %xmm0,-0x55(%rdi)
692 L(SSE5Q4):  movdqa %xmm0,-0x45(%rdi)
693 L(SSE5Q3):  movdqa %xmm0,-0x35(%rdi)
694 L(SSE5Q2):  movdqa %xmm0,-0x25(%rdi)
695 L(SSE5Q1):  movdqa %xmm0,-0x15(%rdi)
696 L(SSE5Q0):  mov    %edx,-0x5(%rdi)
697         mov    %dl,-0x1(%rdi)
698         retq   $0x0
701 L(SSE6QB):  movdqa %xmm0,-0xb6(%rdi)
702 L(SSE6QA):  movdqa %xmm0,-0xa6(%rdi)
703 L(SSE6Q9):  movdqa %xmm0,-0x96(%rdi)
704 L(SSE6Q8):  movdqa %xmm0,-0x86(%rdi)
705 L(SSE6Q7):  movdqa %xmm0,-0x76(%rdi)
706 L(SSE6Q6):  movdqa %xmm0,-0x66(%rdi)
707 L(SSE6Q5):  movdqa %xmm0,-0x56(%rdi)
708 L(SSE6Q4):  movdqa %xmm0,-0x46(%rdi)
709 L(SSE6Q3):  movdqa %xmm0,-0x36(%rdi)
710 L(SSE6Q2):  movdqa %xmm0,-0x26(%rdi)
711 L(SSE6Q1):  movdqa %xmm0,-0x16(%rdi)
712 L(SSE6Q0):  mov    %edx,-0x6(%rdi)
713         mov    %dx,-0x2(%rdi)
714         retq   $0x0
716 L(SSE7QB):  movdqa %xmm0,-0xb7(%rdi)
717 L(SSE7QA):  movdqa %xmm0,-0xa7(%rdi)
718 L(SSE7Q9):  movdqa %xmm0,-0x97(%rdi)
719 L(SSE7Q8):  movdqa %xmm0,-0x87(%rdi)
720 L(SSE7Q7):  movdqa %xmm0,-0x77(%rdi)
721 L(SSE7Q6):  movdqa %xmm0,-0x67(%rdi)
722 L(SSE7Q5):  movdqa %xmm0,-0x57(%rdi)
723 L(SSE7Q4):  movdqa %xmm0,-0x47(%rdi)
724 L(SSE7Q3):  movdqa %xmm0,-0x37(%rdi)
725 L(SSE7Q2):  movdqa %xmm0,-0x27(%rdi)
726 L(SSE7Q1):  movdqa %xmm0,-0x17(%rdi)
727 L(SSE7Q0):  mov    %edx,-0x7(%rdi)
728         mov    %dx,-0x3(%rdi)
729         mov    %dl,-0x1(%rdi)
730         retq   $0x0
732 L(SSE8QB):  movdqa %xmm0,-0xb8(%rdi)
733 L(SSE8QA):  movdqa %xmm0,-0xa8(%rdi)
734 L(SSE8Q9):  movdqa %xmm0,-0x98(%rdi)
735 L(SSE8Q8):  movdqa %xmm0,-0x88(%rdi)
736 L(SSE8Q7):  movdqa %xmm0,-0x78(%rdi)
737 L(SSE8Q6):  movdqa %xmm0,-0x68(%rdi)
738 L(SSE8Q5):  movdqa %xmm0,-0x58(%rdi)
739 L(SSE8Q4):  movdqa %xmm0,-0x48(%rdi)
740 L(SSE8Q3):  movdqa %xmm0,-0x38(%rdi)
741 L(SSE8Q2):  movdqa %xmm0,-0x28(%rdi)
742 L(SSE8Q1):  movdqa %xmm0,-0x18(%rdi)
743 L(SSE8Q0):  mov    %rdx,-0x8(%rdi)
744         retq   $0x0
746 L(SSE9QB):  movdqa %xmm0,-0xb9(%rdi)
747 L(SSE9QA):  movdqa %xmm0,-0xa9(%rdi)
748 L(SSE9Q9):  movdqa %xmm0,-0x99(%rdi)
749 L(SSE9Q8):  movdqa %xmm0,-0x89(%rdi)
750 L(SSE9Q7):  movdqa %xmm0,-0x79(%rdi)
751 L(SSE9Q6):  movdqa %xmm0,-0x69(%rdi)
752 L(SSE9Q5):  movdqa %xmm0,-0x59(%rdi)
753 L(SSE9Q4):  movdqa %xmm0,-0x49(%rdi)
754 L(SSE9Q3):  movdqa %xmm0,-0x39(%rdi)
755 L(SSE9Q2):  movdqa %xmm0,-0x29(%rdi)
756 L(SSE9Q1):  movdqa %xmm0,-0x19(%rdi)
757 L(SSE9Q0):  mov    %rdx,-0x9(%rdi)
758         mov    %dl,-0x1(%rdi)
759         retq   $0x0
761 L(SSE10QB): movdqa %xmm0,-0xba(%rdi)
762 L(SSE10QA): movdqa %xmm0,-0xaa(%rdi)
763 L(SSE10Q9): movdqa %xmm0,-0x9a(%rdi)
764 L(SSE10Q8): movdqa %xmm0,-0x8a(%rdi)
765 L(SSE10Q7): movdqa %xmm0,-0x7a(%rdi)
766 L(SSE10Q6): movdqa %xmm0,-0x6a(%rdi)
767 L(SSE10Q5): movdqa %xmm0,-0x5a(%rdi)
768 L(SSE10Q4): movdqa %xmm0,-0x4a(%rdi)
769 L(SSE10Q3): movdqa %xmm0,-0x3a(%rdi)
770 L(SSE10Q2): movdqa %xmm0,-0x2a(%rdi)
771 L(SSE10Q1): movdqa %xmm0,-0x1a(%rdi)
772 L(SSE10Q0): mov    %rdx,-0xa(%rdi)
773         mov    %dx,-0x2(%rdi)
774         retq   $0x0
776 L(SSE11QB): movdqa %xmm0,-0xbb(%rdi)
777 L(SSE11QA): movdqa %xmm0,-0xab(%rdi)
778 L(SSE11Q9): movdqa %xmm0,-0x9b(%rdi)
779 L(SSE11Q8): movdqa %xmm0,-0x8b(%rdi)
780 L(SSE11Q7): movdqa %xmm0,-0x7b(%rdi)
781 L(SSE11Q6): movdqa %xmm0,-0x6b(%rdi)
782 L(SSE11Q5): movdqa %xmm0,-0x5b(%rdi)
783 L(SSE11Q4): movdqa %xmm0,-0x4b(%rdi)
784 L(SSE11Q3): movdqa %xmm0,-0x3b(%rdi)
785 L(SSE11Q2): movdqa %xmm0,-0x2b(%rdi)
786 L(SSE11Q1): movdqa %xmm0,-0x1b(%rdi)
787 L(SSE11Q0): mov    %rdx,-0xb(%rdi)
788         mov    %dx,-0x3(%rdi)
789         mov    %dl,-0x1(%rdi)
790         retq   $0x0
792 L(SSE12QB): movdqa %xmm0,-0xbc(%rdi)
793 L(SSE12QA): movdqa %xmm0,-0xac(%rdi)
794 L(SSE12Q9): movdqa %xmm0,-0x9c(%rdi)
795 L(SSE12Q8): movdqa %xmm0,-0x8c(%rdi)
796 L(SSE12Q7): movdqa %xmm0,-0x7c(%rdi)
797 L(SSE12Q6): movdqa %xmm0,-0x6c(%rdi)
798 L(SSE12Q5): movdqa %xmm0,-0x5c(%rdi)
799 L(SSE12Q4): movdqa %xmm0,-0x4c(%rdi)
800 L(SSE12Q3): movdqa %xmm0,-0x3c(%rdi)
801 L(SSE12Q2): movdqa %xmm0,-0x2c(%rdi)
802 L(SSE12Q1): movdqa %xmm0,-0x1c(%rdi)
803 L(SSE12Q0): mov    %rdx,-0xc(%rdi)
804         mov    %edx,-0x4(%rdi)
805         retq   $0x0
807 L(SSE13QB): movdqa %xmm0,-0xbd(%rdi)
808 L(SSE13QA): movdqa %xmm0,-0xad(%rdi)
809 L(SSE13Q9): movdqa %xmm0,-0x9d(%rdi)
810 L(SSE13Q8): movdqa %xmm0,-0x8d(%rdi)
811 L(SSE13Q7): movdqa %xmm0,-0x7d(%rdi)
812 L(SSE13Q6): movdqa %xmm0,-0x6d(%rdi)
813 L(SSE13Q5): movdqa %xmm0,-0x5d(%rdi)
814 L(SSE13Q4): movdqa %xmm0,-0x4d(%rdi)
815 L(SSE13Q3): movdqa %xmm0,-0x3d(%rdi)
816 L(SSE13Q2): movdqa %xmm0,-0x2d(%rdi)
817 L(SSE13Q1): movdqa %xmm0,-0x1d(%rdi)
818 L(SSE13Q0): mov    %rdx,-0xd(%rdi)
819         mov    %edx,-0x5(%rdi)
820         mov    %dl,-0x1(%rdi)
821         retq   $0x0
823 L(SSE14QB): movdqa %xmm0,-0xbe(%rdi)
824 L(SSE14QA): movdqa %xmm0,-0xae(%rdi)
825 L(SSE14Q9): movdqa %xmm0,-0x9e(%rdi)
826 L(SSE14Q8): movdqa %xmm0,-0x8e(%rdi)
827 L(SSE14Q7): movdqa %xmm0,-0x7e(%rdi)
828 L(SSE14Q6): movdqa %xmm0,-0x6e(%rdi)
829 L(SSE14Q5): movdqa %xmm0,-0x5e(%rdi)
830 L(SSE14Q4): movdqa %xmm0,-0x4e(%rdi)
831 L(SSE14Q3): movdqa %xmm0,-0x3e(%rdi)
832 L(SSE14Q2): movdqa %xmm0,-0x2e(%rdi)
833 L(SSE14Q1): movdqa %xmm0,-0x1e(%rdi)
834 L(SSE14Q0): mov    %rdx,-0xe(%rdi)
835         mov    %edx,-0x6(%rdi)
836         mov    %dx,-0x2(%rdi)
837         retq   $0x0
839 L(SSE15QB): movdqa %xmm0,-0xbf(%rdi)
840 L(SSE15QA): movdqa %xmm0,-0xaf(%rdi)
841 L(SSE15Q9): movdqa %xmm0,-0x9f(%rdi)
842 L(SSE15Q8): movdqa %xmm0,-0x8f(%rdi)
843 L(SSE15Q7): movdqa %xmm0,-0x7f(%rdi)
844 L(SSE15Q6): movdqa %xmm0,-0x6f(%rdi)
845 L(SSE15Q5): movdqa %xmm0,-0x5f(%rdi)
846 L(SSE15Q4): movdqa %xmm0,-0x4f(%rdi)
847 L(SSE15Q3): movdqa %xmm0,-0x3f(%rdi)
848 L(SSE15Q2): movdqa %xmm0,-0x2f(%rdi)
849 L(SSE15Q1): movdqa %xmm0,-0x1f(%rdi)
850 L(SSE15Q0): mov    %rdx,-0xf(%rdi)
851         mov    %edx,-0x7(%rdi)
852         mov    %dx,-0x3(%rdi)
853         mov    %dl,-0x1(%rdi)
854         retq   $0x0
856         .balign     16
857 L(byte32sse2_pre):
859         mov    __x86_64_shared_cache_size(%rip),%r9d  # The largest cache size
860         cmp    %r9,%r8
861         jg     L(sse2_nt_move_pre)
862         #jmp    L(byte32sse2)
863         .balign     16
864 L(byte32sse2):
865         lea    -0x80(%r8),%r8 # 128
866         cmp    $0x80,%r8   # 128
867         movdqa %xmm0,(%rdi)
868         movdqa %xmm0,0x10(%rdi)
869         movdqa %xmm0,0x20(%rdi)
870         movdqa %xmm0,0x30(%rdi)
871         movdqa %xmm0,0x40(%rdi)
872         movdqa %xmm0,0x50(%rdi)
873         movdqa %xmm0,0x60(%rdi)
874         movdqa %xmm0,0x70(%rdi)
876         lea    0x80(%rdi),%rdi
877         jge    L(byte32sse2)
878         lea    L(SSExDx)(%rip),%r11
879         add    %r8,%rdi
880 #ifndef PIC
881         jmpq   *(%r11,%r8,8)
882 #else
883         movslq    (%r11,%r8,4),%rcx
884         lea   (%rcx,%r11,1),%r11
885         jmpq   *%r11
886 #endif
888         .balign     16
889 L(sse2_nt_move_pre):
890         cmp    $0x0,%r9
891         je     L(byte32sse2)
892         jmp    L(sse2_nt_move)
894         .balign     16
895 L(sse2_nt_move):
896         lea    -0x80(%r8),%r8
897         cmp    $0x80,%r8
899         movntdq %xmm0,(%rdi)
900         movntdq %xmm0,0x10(%rdi)
901         movntdq %xmm0,0x20(%rdi)
902         movntdq %xmm0,0x30(%rdi)
903         movntdq %xmm0,0x40(%rdi)
904         movntdq %xmm0,0x50(%rdi)
905         movntdq %xmm0,0x60(%rdi)
906         movntdq %xmm0,0x70(%rdi)
908         lea    0x80(%rdi),%rdi
909         jge    L(sse2_nt_move)
910         lea    L(SSExDx)(%rip),%r11
911         sfence
912         add    %r8,%rdi
913 #ifndef PIC
914         jmpq   *(%r11,%r8,8)
915 #else
916         movslq (%r11,%r8,4),%rcx
917         lea   (%rcx,%r11,1),%r11
918         jmpq   *(%r11)
919 #endif
921         .balign     16
922 L(Loop8byte_pre):
923         mov    __x86_64_shared_cache_size(%rip),%r9d // ck largest cache size
925 L(top_8byte_loop):
926         cmp    %r9,%r8
927         jg     L(Loop8byte_nt_move_pre)
929         .balign     16
930 L(Loop8byte):
931         lea    -0x80(%r8),%r8
932         cmp    $0x80,%r8   # 64
933         mov    %rdx,(%rdi)
934         mov    %rdx,0x8(%rdi)
935         mov    %rdx,0x10(%rdi)
936         mov    %rdx,0x18(%rdi)
937         mov    %rdx,0x20(%rdi)
938         mov    %rdx,0x28(%rdi)
939         mov    %rdx,0x30(%rdi)
940         mov    %rdx,0x38(%rdi)
941         mov    %rdx,0x40(%rdi)
942         mov    %rdx,0x48(%rdi)
943         mov    %rdx,0x50(%rdi)
944         mov    %rdx,0x58(%rdi)
945         mov    %rdx,0x60(%rdi)
946         mov    %rdx,0x68(%rdi)
947         mov    %rdx,0x70(%rdi)
948         mov    %rdx,0x78(%rdi)
949         lea    0x80(%rdi),%rdi
950         jg     L(Loop8byte)
951         lea    (%rdi,%r8,1),%rdi
952         lea    L(setPxQx)(%rip),%r11
953 #ifndef PIC
954         jmpq   *(%r11,%r8,8)
955 #else
956         movslq    (%r11,%r8,4),%rcx
957         lea    (%rcx,%r11,1),%r11
958         jmpq   *%r11
959 #endif
961         .balign     16
962 L(Loop8byte_nt_move_pre):
963         cmp    $0x0,%r9
964         je     L(Loop8byte)
965         jmp    L(Loop8byte_nt_move)
967         .balign     16
968 L(Loop8byte_nt_move):
969         movnti %rdx,(%rdi)
970         movnti %rdx,0x8(%rdi)
971         lea    -0x40(%r8),%r8
972         movnti %rdx,0x10(%rdi)
973         movnti %rdx,0x18(%rdi)
974         movnti %rdx,0x20(%rdi)
975         cmp    $0x40,%r8  # 64
976         movnti %rdx,0x28(%rdi)
977         movnti %rdx,0x30(%rdi)
978         movnti %rdx,0x38(%rdi)
979         lea    0x40(%rdi),%rdi
980         jge    L(Loop8byte_nt_move)
981         lea    L(setPxQx)(%rip),%r11
982         lea    (%rdi,%r8,1),%rdi
983         sfence
984 #ifndef PIC
985         jmpq   *(%r11,%r8,8)
986 #else
987         movslq    (%r11,%r8,4),%rcx
988         lea    (%rcx,%r11,1),%r11
989         jmpq   *%r11
990 #endif
992         .pushsection .rodata
993         .balign     16
994 #ifndef PIC
995 L(SSExDx):
996         .quad       L(SSE0Q0), L(SSE1Q0), L(SSE2Q0), L(SSE3Q0)
997         .quad       L(SSE4Q0), L(SSE5Q0), L(SSE6Q0), L(SSE7Q0)
998         .quad       L(SSE8Q0), L(SSE9Q0), L(SSE10Q0), L(SSE11Q0)
999         .quad       L(SSE12Q0), L(SSE13Q0), L(SSE14Q0), L(SSE15Q0)
1000         .quad       L(SSE0Q1), L(SSE1Q1), L(SSE2Q1), L(SSE3Q1)
1001         .quad       L(SSE4Q1), L(SSE5Q1), L(SSE6Q1), L(SSE7Q1)
1002         .quad       L(SSE8Q1), L(SSE9Q1), L(SSE10Q1), L(SSE11Q1)
1003         .quad       L(SSE12Q1), L(SSE13Q1), L(SSE14Q1), L(SSE15Q1)
1004         .quad       L(SSE0Q2), L(SSE1Q2), L(SSE2Q2), L(SSE3Q2)
1005         .quad       L(SSE4Q2), L(SSE5Q2), L(SSE6Q2), L(SSE7Q2)
1006         .quad       L(SSE8Q2), L(SSE9Q2), L(SSE10Q2), L(SSE11Q2)
1007         .quad       L(SSE12Q2), L(SSE13Q2), L(SSE14Q2), L(SSE15Q2)
1008         .quad       L(SSE0Q3), L(SSE1Q3), L(SSE2Q3), L(SSE3Q3)
1009         .quad       L(SSE4Q3), L(SSE5Q3), L(SSE6Q3), L(SSE7Q3)
1010         .quad       L(SSE8Q3), L(SSE9Q3), L(SSE10Q3), L(SSE11Q3)
1011         .quad       L(SSE12Q3), L(SSE13Q3), L(SSE14Q3), L(SSE15Q3)
1012         .quad       L(SSE0Q4), L(SSE1Q4), L(SSE2Q4), L(SSE3Q4)
1013         .quad       L(SSE4Q4), L(SSE5Q4), L(SSE6Q4), L(SSE7Q4)
1014         .quad       L(SSE8Q4), L(SSE9Q4), L(SSE10Q4), L(SSE11Q4)
1015         .quad       L(SSE12Q4), L(SSE13Q4), L(SSE14Q4), L(SSE15Q4)
1016         .quad       L(SSE0Q5), L(SSE1Q5), L(SSE2Q5), L(SSE3Q5)
1017         .quad       L(SSE4Q5), L(SSE5Q5), L(SSE6Q5), L(SSE7Q5)
1018         .quad       L(SSE8Q5), L(SSE9Q5), L(SSE10Q5), L(SSE11Q5)
1019         .quad       L(SSE12Q5), L(SSE13Q5), L(SSE14Q5), L(SSE15Q5)
1020         .quad       L(SSE0Q6), L(SSE1Q6), L(SSE2Q6), L(SSE3Q6)
1021         .quad       L(SSE4Q6), L(SSE5Q6), L(SSE6Q6), L(SSE7Q6)
1022         .quad       L(SSE8Q6), L(SSE9Q6), L(SSE10Q6), L(SSE11Q6)
1023         .quad       L(SSE12Q6), L(SSE13Q6), L(SSE14Q6), L(SSE15Q6)
1024         .quad       L(SSE0Q7), L(SSE1Q7), L(SSE2Q7), L(SSE3Q7)
1025         .quad       L(SSE4Q7), L(SSE5Q7), L(SSE6Q7), L(SSE7Q7)
1026         .quad       L(SSE8Q7), L(SSE9Q7), L(SSE10Q7), L(SSE11Q7)
1027         .quad       L(SSE12Q7), L(SSE13Q7), L(SSE14Q7), L(SSE15Q7)
1028         .quad       L(SSE0Q8), L(SSE1Q8), L(SSE2Q8), L(SSE3Q8)
1029         .quad       L(SSE4Q8), L(SSE5Q8), L(SSE6Q8), L(SSE7Q8)
1030         .quad       L(SSE8Q8), L(SSE9Q8), L(SSE10Q8), L(SSE11Q8)
1031         .quad       L(SSE12Q8), L(SSE13Q8), L(SSE14Q8), L(SSE15Q8)
1032         .quad       L(SSE0Q9), L(SSE1Q9), L(SSE2Q9), L(SSE3Q9)
1033         .quad       L(SSE4Q9), L(SSE5Q9), L(SSE6Q9), L(SSE7Q9)
1034         .quad       L(SSE8Q9), L(SSE9Q9), L(SSE10Q9), L(SSE11Q9)
1035         .quad       L(SSE12Q9), L(SSE13Q9), L(SSE14Q9), L(SSE15Q9)
1036         .quad       L(SSE0QA), L(SSE1QA), L(SSE2QA), L(SSE3QA)
1037         .quad       L(SSE4QA), L(SSE5QA), L(SSE6QA), L(SSE7QA)
1038         .quad       L(SSE8QA), L(SSE9QA), L(SSE10QA), L(SSE11QA)
1039         .quad       L(SSE12QA), L(SSE13QA), L(SSE14QA), L(SSE15QA)
1040         .quad       L(SSE0QB), L(SSE1QB), L(SSE2QB), L(SSE3QB)
1041         .quad       L(SSE4QB), L(SSE5QB), L(SSE6QB), L(SSE7QB)
1042         .quad       L(SSE8QB), L(SSE9QB), L(SSE10QB), L(SSE11QB)
1043         .quad       L(SSE12QB), L(SSE13QB), L(SSE14QB), L(SSE15QB)
1044 #else
1045 L(SSExDx):
1046         .int       L(SSE0Q0) -L(SSExDx)
1047         .int       L(SSE1Q0) -L(SSExDx)
1048         .int       L(SSE2Q0) -L(SSExDx)
1049         .int       L(SSE3Q0) -L(SSExDx)
1050         .int       L(SSE4Q0) -L(SSExDx)
1051         .int       L(SSE5Q0) -L(SSExDx)
1052         .int       L(SSE6Q0) -L(SSExDx)
1053         .int       L(SSE7Q0) -L(SSExDx)
1055         .int       L(SSE8Q0) -L(SSExDx)
1056         .int       L(SSE9Q0) -L(SSExDx)
1057         .int       L(SSE10Q0)-L(SSExDx)
1058         .int       L(SSE11Q0)-L(SSExDx)
1059         .int       L(SSE12Q0)-L(SSExDx)
1060         .int       L(SSE13Q0)-L(SSExDx)
1061         .int       L(SSE14Q0)-L(SSExDx)
1062         .int       L(SSE15Q0)-L(SSExDx)
1064         .int       L(SSE0Q1) -L(SSExDx)
1065         .int       L(SSE1Q1) -L(SSExDx)
1066         .int       L(SSE2Q1) -L(SSExDx)
1067         .int       L(SSE3Q1) -L(SSExDx)
1068         .int       L(SSE4Q1) -L(SSExDx)
1069         .int       L(SSE5Q1) -L(SSExDx)
1070         .int       L(SSE6Q1) -L(SSExDx)
1071         .int       L(SSE7Q1) -L(SSExDx)
1073         .int       L(SSE8Q1) -L(SSExDx)
1074         .int       L(SSE9Q1) -L(SSExDx)
1075         .int       L(SSE10Q1)-L(SSExDx)
1076         .int       L(SSE11Q1)-L(SSExDx)
1077         .int       L(SSE12Q1)-L(SSExDx)
1078         .int       L(SSE13Q1)-L(SSExDx)
1079         .int       L(SSE14Q1)-L(SSExDx)
1080         .int       L(SSE15Q1)-L(SSExDx)
1082         .int       L(SSE0Q2) -L(SSExDx)
1083         .int       L(SSE1Q2) -L(SSExDx)
1084         .int       L(SSE2Q2) -L(SSExDx)
1085         .int       L(SSE3Q2) -L(SSExDx)
1086         .int       L(SSE4Q2) -L(SSExDx)
1087         .int       L(SSE5Q2) -L(SSExDx)
1088         .int       L(SSE6Q2) -L(SSExDx)
1089         .int       L(SSE7Q2) -L(SSExDx)
1091         .int       L(SSE8Q2) -L(SSExDx)
1092         .int       L(SSE9Q2) -L(SSExDx)
1093         .int       L(SSE10Q2)-L(SSExDx)
1094         .int       L(SSE11Q2)-L(SSExDx)
1095         .int       L(SSE12Q2)-L(SSExDx)
1096         .int       L(SSE13Q2)-L(SSExDx)
1097         .int       L(SSE14Q2)-L(SSExDx)
1098         .int       L(SSE15Q2)-L(SSExDx)
1100         .int       L(SSE0Q3) -L(SSExDx)
1101         .int       L(SSE1Q3) -L(SSExDx)
1102         .int       L(SSE2Q3) -L(SSExDx)
1103         .int       L(SSE3Q3) -L(SSExDx)
1104         .int       L(SSE4Q3) -L(SSExDx)
1105         .int       L(SSE5Q3) -L(SSExDx)
1106         .int       L(SSE6Q3) -L(SSExDx)
1107         .int       L(SSE7Q3) -L(SSExDx)
1109         .int       L(SSE8Q3) -L(SSExDx)
1110         .int       L(SSE9Q3) -L(SSExDx)
1111         .int       L(SSE10Q3)-L(SSExDx)
1112         .int       L(SSE11Q3)-L(SSExDx)
1113         .int       L(SSE12Q3)-L(SSExDx)
1114         .int       L(SSE13Q3)-L(SSExDx)
1115         .int       L(SSE14Q3)-L(SSExDx)
1116         .int       L(SSE15Q3)-L(SSExDx)
1118         .int       L(SSE0Q4) -L(SSExDx)
1119         .int       L(SSE1Q4) -L(SSExDx)
1120         .int       L(SSE2Q4) -L(SSExDx)
1121         .int       L(SSE3Q4) -L(SSExDx)
1122         .int       L(SSE4Q4) -L(SSExDx)
1123         .int       L(SSE5Q4) -L(SSExDx)
1124         .int       L(SSE6Q4) -L(SSExDx)
1125         .int       L(SSE7Q4) -L(SSExDx)
1127         .int       L(SSE8Q4) -L(SSExDx)
1128         .int       L(SSE9Q4) -L(SSExDx)
1129         .int       L(SSE10Q4)-L(SSExDx)
1130         .int       L(SSE11Q4)-L(SSExDx)
1131         .int       L(SSE12Q4)-L(SSExDx)
1132         .int       L(SSE13Q4)-L(SSExDx)
1133         .int       L(SSE14Q4)-L(SSExDx)
1134         .int       L(SSE15Q4)-L(SSExDx)
1136         .int       L(SSE0Q5) -L(SSExDx)
1137         .int       L(SSE1Q5) -L(SSExDx)
1138         .int       L(SSE2Q5) -L(SSExDx)
1139         .int       L(SSE3Q5) -L(SSExDx)
1140         .int       L(SSE4Q5) -L(SSExDx)
1141         .int       L(SSE5Q5) -L(SSExDx)
1142         .int       L(SSE6Q5) -L(SSExDx)
1143         .int       L(SSE7Q5) -L(SSExDx)
1145         .int       L(SSE8Q5) -L(SSExDx)
1146         .int       L(SSE9Q5) -L(SSExDx)
1147         .int       L(SSE10Q5)-L(SSExDx)
1148         .int       L(SSE11Q5)-L(SSExDx)
1149         .int       L(SSE12Q5)-L(SSExDx)
1150         .int       L(SSE13Q5)-L(SSExDx)
1151         .int       L(SSE14Q5)-L(SSExDx)
1152         .int       L(SSE15Q5)-L(SSExDx)
1154         .int       L(SSE0Q6) -L(SSExDx)
1155         .int       L(SSE1Q6) -L(SSExDx)
1156         .int       L(SSE2Q6) -L(SSExDx)
1157         .int       L(SSE3Q6) -L(SSExDx)
1158         .int       L(SSE4Q6) -L(SSExDx)
1159         .int       L(SSE5Q6) -L(SSExDx)
1160         .int       L(SSE6Q6) -L(SSExDx)
1161         .int       L(SSE7Q6) -L(SSExDx)
1163         .int       L(SSE8Q6) -L(SSExDx)
1164         .int       L(SSE9Q6) -L(SSExDx)
1165         .int       L(SSE10Q6)-L(SSExDx)
1166         .int       L(SSE11Q6)-L(SSExDx)
1167         .int       L(SSE12Q6)-L(SSExDx)
1168         .int       L(SSE13Q6)-L(SSExDx)
1169         .int       L(SSE14Q6)-L(SSExDx)
1170         .int       L(SSE15Q6)-L(SSExDx)
1172         .int       L(SSE0Q7) -L(SSExDx)
1173         .int       L(SSE1Q7) -L(SSExDx)
1174         .int       L(SSE2Q7) -L(SSExDx)
1175         .int       L(SSE3Q7) -L(SSExDx)
1176         .int       L(SSE4Q7) -L(SSExDx)
1177         .int       L(SSE5Q7) -L(SSExDx)
1178         .int       L(SSE6Q7) -L(SSExDx)
1179         .int       L(SSE7Q7) -L(SSExDx)
1181         .int       L(SSE8Q7) -L(SSExDx)
1182         .int       L(SSE9Q7) -L(SSExDx)
1183         .int       L(SSE10Q7)-L(SSExDx)
1184         .int       L(SSE11Q7)-L(SSExDx)
1185         .int       L(SSE12Q7)-L(SSExDx)
1186         .int       L(SSE13Q7)-L(SSExDx)
1187         .int       L(SSE14Q7)-L(SSExDx)
1188         .int       L(SSE15Q7)-L(SSExDx)
1190         .int       L(SSE0Q8) -L(SSExDx)
1191         .int       L(SSE1Q8) -L(SSExDx)
1192         .int       L(SSE2Q8) -L(SSExDx)
1193         .int       L(SSE3Q8) -L(SSExDx)
1194         .int       L(SSE4Q8) -L(SSExDx)
1195         .int       L(SSE5Q8) -L(SSExDx)
1196         .int       L(SSE6Q8) -L(SSExDx)
1197         .int       L(SSE7Q8) -L(SSExDx)
1199         .int       L(SSE8Q8) -L(SSExDx)
1200         .int       L(SSE9Q8) -L(SSExDx)
1201         .int       L(SSE10Q8)-L(SSExDx)
1202         .int       L(SSE11Q8)-L(SSExDx)
1203         .int       L(SSE12Q8)-L(SSExDx)
1204         .int       L(SSE13Q8)-L(SSExDx)
1205         .int       L(SSE14Q8)-L(SSExDx)
1206         .int       L(SSE15Q8)-L(SSExDx)
1208         .int       L(SSE0Q9) -L(SSExDx)
1209         .int       L(SSE1Q9) -L(SSExDx)
1210         .int       L(SSE2Q9) -L(SSExDx)
1211         .int       L(SSE3Q9) -L(SSExDx)
1212         .int       L(SSE4Q9) -L(SSExDx)
1213         .int       L(SSE5Q9) -L(SSExDx)
1214         .int       L(SSE6Q9) -L(SSExDx)
1215         .int       L(SSE7Q9) -L(SSExDx)
1217         .int       L(SSE8Q9) -L(SSExDx)
1218         .int       L(SSE9Q9) -L(SSExDx)
1219         .int       L(SSE10Q9)-L(SSExDx)
1220         .int       L(SSE11Q9)-L(SSExDx)
1221         .int       L(SSE12Q9)-L(SSExDx)
1222         .int       L(SSE13Q9)-L(SSExDx)
1223         .int       L(SSE14Q9)-L(SSExDx)
1224         .int       L(SSE15Q9)-L(SSExDx)
1226         .int       L(SSE0QA) -L(SSExDx)
1227         .int       L(SSE1QA) -L(SSExDx)
1228         .int       L(SSE2QA) -L(SSExDx)
1229         .int       L(SSE3QA) -L(SSExDx)
1230         .int       L(SSE4QA) -L(SSExDx)
1231         .int       L(SSE5QA) -L(SSExDx)
1232         .int       L(SSE6QA) -L(SSExDx)
1233         .int       L(SSE7QA) -L(SSExDx)
1235         .int       L(SSE8QA) -L(SSExDx)
1236         .int       L(SSE9QA) -L(SSExDx)
1237         .int       L(SSE10QA)-L(SSExDx)
1238         .int       L(SSE11QA)-L(SSExDx)
1239         .int       L(SSE12QA)-L(SSExDx)
1240         .int       L(SSE13QA)-L(SSExDx)
1241         .int       L(SSE14QA)-L(SSExDx)
1242         .int       L(SSE15QA)-L(SSExDx)
1244         .int       L(SSE0QB) -L(SSExDx)
1245         .int       L(SSE1QB) -L(SSExDx)
1246         .int       L(SSE2QB) -L(SSExDx)
1247         .int       L(SSE3QB) -L(SSExDx)
1248         .int       L(SSE4QB) -L(SSExDx)
1249         .int       L(SSE5QB) -L(SSExDx)
1250         .int       L(SSE6QB) -L(SSExDx)
1251         .int       L(SSE7QB) -L(SSExDx)
1253         .int       L(SSE8QB) -L(SSExDx)
1254         .int       L(SSE9QB) -L(SSExDx)
1255         .int       L(SSE10QB)-L(SSExDx)
1256         .int       L(SSE11QB)-L(SSExDx)
1257         .int       L(SSE12QB)-L(SSExDx)
1258         .int       L(SSE13QB)-L(SSExDx)
1259         .int       L(SSE14QB)-L(SSExDx)
1260         .int       L(SSE15QB)-L(SSExDx)
1261 #endif
1262         .popsection
1264 END (memset)
1265 libc_hidden_builtin_def (memset)
1267 #if defined PIC && !defined NOT_IN_libc
1268 strong_alias (__memset_chk, __memset_zero_constant_len_parameter)
1269         .section .gnu.warning.__memset_zero_constant_len_parameter
1270         .string "memset used with constant zero length parameter; this could be due to transposed parameters"
1271 #endif