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