Home | History | Annotate | Download | only in gen
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 
     22 /*
     23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     24  * Use is subject to license terms.
     25  */
     26 
     27 /*
     28  * Copyright (c) 2008, Intel Corporation
     29  * All rights reserved.
     30  */
     31 
     32 /*
     33  * Portions Copyright 2009 Advanced Micro Devices, Inc.
     34  */
     35 
     36 	.file	"memset.s"
     37 
     38 #include <sys/asm_linkage.h>
     39 
     40 	ANSI_PRAGMA_WEAK(memset,function)
     41 
     42 #include "cache.h"
     43 #include "proc64_id.h"
     44 
     45 #define L(s) .memset/**/s
     46 
     47 /*
     48  * memset algorithm overview:
     49  *
     50  * Thresholds used below were determined experimentally.
     51  *
     52  * Pseudo code:
     53  *
     54  * NOTE: On AMD NO_SSE is always set.  Performance on Opteron did not improve
     55  * using 16-byte stores.  Setting NO_SSE on AMD should be re-evaluated on
     56  * future AMD processors.
     57  *
     58  *
     59  * If (size <= 144 bytes) {
     60  *	do unrolled code (primarily 8-byte stores) regardless of alignment.
     61  * } else {
     62  *	Align destination to 16-byte boundary
     63  *
     64  *      if (NO_SSE) {
     65  *		If (size > largest level cache) {
     66  *			Use 8-byte non-temporal stores (64-bytes/loop)
     67  *		} else {
     68  *			if (size >= 2K) {
     69  *				Use rep sstoq
     70  *			} else {
     71  *				Use 8-byte stores (128 bytes per loop)
     72  *			}
     73  *		}
     74  *
     75  *	} else { **USE SSE**
     76  *		If (size <= 192 bytes) {
     77  *			do unrolled code using primarily 16-byte stores (SSE2)
     78  *		} else {
     79  *			If (size > largest level cache) {
     80  *				Use 16-byte non-temporal stores (128-bytes/loop)
     81  *			} else {
     82  *				Use 16-byte stores (128 bytes per loop)
     83  *			}
     84  *		}
     85  *	}
     86  *
     87  *	Finish any remaining bytes via unrolled code above.
     88  * }
     89  */
     90 
     91 		ENTRY(memset)		# (void *, const void*, size_t)
     92 		cmp    $0x1,%rdx
     93 		mov    %rdi,%rax	# memset returns the dest address
     94 		jne    L(ck2)
     95 		mov    %sil,(%rdi)
     96 		ret
     97 L(ck2):
     98 		mov    $0x0101010101010101,%r9
     99 		mov    %rdx,%r8
    100 		movzbq %sil,%rdx
    101 		imul   %r9,%rdx		# clone value 8 times
    102 
    103 		cmp    $0x90,%r8	# 144
    104 		jge    L(ck_align)
    105 
    106 		lea    L(setPxQx)(%rip),%r11
    107 		add    %r8,%rdi
    108 
    109 		movslq (%r11,%r8,4),%rcx
    110 		lea    (%rcx,%r11,1),%r11
    111 		jmpq   *%r11
    112 
    113 		.balign 16
    114 L(setPxQx):	.int       L(P0Q0)-L(setPxQx)
    115 		.int       L(P1Q0)-L(setPxQx)
    116 		.int       L(P2Q0)-L(setPxQx)
    117 		.int       L(P3Q0)-L(setPxQx)
    118 		.int       L(P4Q0)-L(setPxQx)
    119 		.int       L(P5Q0)-L(setPxQx)
    120 		.int       L(P6Q0)-L(setPxQx)
    121 		.int       L(P7Q0)-L(setPxQx)
    122 
    123 		.int       L(P0Q1)-L(setPxQx)
    124 		.int       L(P1Q1)-L(setPxQx)
    125 		.int       L(P2Q1)-L(setPxQx)
    126 		.int       L(P3Q1)-L(setPxQx)
    127 		.int       L(P4Q1)-L(setPxQx)
    128 		.int       L(P5Q1)-L(setPxQx)
    129 		.int       L(P6Q1)-L(setPxQx)
    130 		.int       L(P7Q1)-L(setPxQx)
    131 
    132 		.int       L(P0Q2)-L(setPxQx)
    133 		.int       L(P1Q2)-L(setPxQx)
    134 		.int       L(P2Q2)-L(setPxQx)
    135 		.int       L(P3Q2)-L(setPxQx)
    136 		.int       L(P4Q2)-L(setPxQx)
    137 		.int       L(P5Q2)-L(setPxQx)
    138 		.int       L(P6Q2)-L(setPxQx)
    139 		.int       L(P7Q2)-L(setPxQx)
    140 
    141 		.int       L(P0Q3)-L(setPxQx)
    142 		.int       L(P1Q3)-L(setPxQx)
    143 		.int       L(P2Q3)-L(setPxQx)
    144 		.int       L(P3Q3)-L(setPxQx)
    145 		.int       L(P4Q3)-L(setPxQx)
    146 		.int       L(P5Q3)-L(setPxQx)
    147 		.int       L(P6Q3)-L(setPxQx)
    148 		.int       L(P7Q3)-L(setPxQx)
    149 
    150 		.int       L(P0Q4)-L(setPxQx)
    151 		.int       L(P1Q4)-L(setPxQx)
    152 		.int       L(P2Q4)-L(setPxQx)
    153 		.int       L(P3Q4)-L(setPxQx)
    154 		.int       L(P4Q4)-L(setPxQx)
    155 		.int       L(P5Q4)-L(setPxQx)
    156 		.int       L(P6Q4)-L(setPxQx)
    157 		.int       L(P7Q4)-L(setPxQx)
    158 
    159 		.int       L(P0Q5)-L(setPxQx)
    160 		.int       L(P1Q5)-L(setPxQx)
    161 		.int       L(P2Q5)-L(setPxQx)
    162 		.int       L(P3Q5)-L(setPxQx)
    163 		.int       L(P4Q5)-L(setPxQx)
    164 		.int       L(P5Q5)-L(setPxQx)
    165 		.int       L(P6Q5)-L(setPxQx)
    166 		.int       L(P7Q5)-L(setPxQx)
    167 
    168 		.int       L(P0Q6)-L(setPxQx)
    169 		.int       L(P1Q6)-L(setPxQx)
    170 		.int       L(P2Q6)-L(setPxQx)
    171 		.int       L(P3Q6)-L(setPxQx)
    172 		.int       L(P4Q6)-L(setPxQx)
    173 		.int       L(P5Q6)-L(setPxQx)
    174 		.int       L(P6Q6)-L(setPxQx)
    175 		.int       L(P7Q6)-L(setPxQx)
    176 
    177 		.int       L(P0Q7)-L(setPxQx)
    178 		.int       L(P1Q7)-L(setPxQx)
    179 		.int       L(P2Q7)-L(setPxQx)
    180 		.int       L(P3Q7)-L(setPxQx)
    181 		.int       L(P4Q7)-L(setPxQx)
    182 		.int       L(P5Q7)-L(setPxQx)
    183 		.int       L(P6Q7)-L(setPxQx)
    184 		.int       L(P7Q7)-L(setPxQx)
    185 
    186 		.int       L(P0Q8)-L(setPxQx)
    187 		.int       L(P1Q8)-L(setPxQx)
    188 		.int       L(P2Q8)-L(setPxQx)
    189 		.int       L(P3Q8)-L(setPxQx)
    190 		.int       L(P4Q8)-L(setPxQx)
    191 		.int       L(P5Q8)-L(setPxQx)
    192 		.int       L(P6Q8)-L(setPxQx)
    193 		.int       L(P7Q8)-L(setPxQx)
    194 
    195 		.int       L(P0Q9)-L(setPxQx)
    196 		.int       L(P1Q9)-L(setPxQx)
    197 		.int       L(P2Q9)-L(setPxQx)
    198 		.int       L(P3Q9)-L(setPxQx)
    199 		.int       L(P4Q9)-L(setPxQx)
    200 		.int       L(P5Q9)-L(setPxQx)
    201 		.int       L(P6Q9)-L(setPxQx)
    202 		.int       L(P7Q9)-L(setPxQx)
    203 
    204 		.int       L(P0QA)-L(setPxQx)
    205 		.int       L(P1QA)-L(setPxQx)
    206 		.int       L(P2QA)-L(setPxQx)
    207 		.int       L(P3QA)-L(setPxQx)
    208 		.int       L(P4QA)-L(setPxQx)
    209 		.int       L(P5QA)-L(setPxQx)
    210 		.int       L(P6QA)-L(setPxQx)
    211 		.int       L(P7QA)-L(setPxQx)
    212 
    213 		.int       L(P0QB)-L(setPxQx)
    214 		.int       L(P1QB)-L(setPxQx)
    215 		.int       L(P2QB)-L(setPxQx)
    216 		.int       L(P3QB)-L(setPxQx)
    217 		.int       L(P4QB)-L(setPxQx)
    218 		.int       L(P5QB)-L(setPxQx)
    219 		.int       L(P6QB)-L(setPxQx)
    220 		.int       L(P7QB)-L(setPxQx)
    221 
    222 		.int       L(P0QC)-L(setPxQx)
    223 		.int       L(P1QC)-L(setPxQx)
    224 		.int       L(P2QC)-L(setPxQx)
    225 		.int       L(P3QC)-L(setPxQx)
    226 		.int       L(P4QC)-L(setPxQx)
    227 		.int       L(P5QC)-L(setPxQx)
    228 		.int       L(P6QC)-L(setPxQx)
    229 		.int       L(P7QC)-L(setPxQx)
    230 
    231 		.int       L(P0QD)-L(setPxQx)
    232 		.int       L(P1QD)-L(setPxQx)
    233 		.int       L(P2QD)-L(setPxQx)
    234 		.int       L(P3QD)-L(setPxQx)
    235 		.int       L(P4QD)-L(setPxQx)
    236 		.int       L(P5QD)-L(setPxQx)
    237 		.int       L(P6QD)-L(setPxQx)
    238 		.int       L(P7QD)-L(setPxQx)
    239 
    240 		.int       L(P0QE)-L(setPxQx)	# 112
    241 		.int       L(P1QE)-L(setPxQx)
    242 		.int       L(P2QE)-L(setPxQx)
    243 		.int       L(P3QE)-L(setPxQx)
    244 		.int       L(P4QE)-L(setPxQx)
    245 		.int       L(P5QE)-L(setPxQx)
    246 		.int       L(P6QE)-L(setPxQx)
    247 		.int       L(P7QE)-L(setPxQx)
    248 
    249 		.int       L(P0QF)-L(setPxQx)	#120
    250 		.int       L(P1QF)-L(setPxQx)
    251 		.int       L(P2QF)-L(setPxQx)
    252 		.int       L(P3QF)-L(setPxQx)
    253 		.int       L(P4QF)-L(setPxQx)
    254 		.int       L(P5QF)-L(setPxQx)
    255 		.int       L(P6QF)-L(setPxQx)
    256 		.int       L(P7QF)-L(setPxQx)
    257 
    258 		.int       L(P0QG)-L(setPxQx)	#128
    259 		.int       L(P1QG)-L(setPxQx)
    260 		.int       L(P2QG)-L(setPxQx)
    261 		.int       L(P3QG)-L(setPxQx)
    262 		.int       L(P4QG)-L(setPxQx)
    263 		.int       L(P5QG)-L(setPxQx)
    264 		.int       L(P6QG)-L(setPxQx)
    265 		.int       L(P7QG)-L(setPxQx)
    266 
    267 		.int       L(P0QH)-L(setPxQx)	#136
    268 		.int       L(P1QH)-L(setPxQx)
    269 		.int       L(P2QH)-L(setPxQx)
    270 		.int       L(P3QH)-L(setPxQx)
    271 		.int       L(P4QH)-L(setPxQx)
    272 		.int       L(P5QH)-L(setPxQx)
    273 		.int       L(P6QH)-L(setPxQx)
    274 		.int       L(P7QH)-L(setPxQx)	#143
    275 
    276 		.balign 16
    277 L(P1QH):	mov    %rdx,-0x89(%rdi)
    278 L(P1QG):	mov    %rdx,-0x81(%rdi)
    279 		.balign 16
    280 L(P1QF):	mov    %rdx,-0x79(%rdi)
    281 L(P1QE):	mov    %rdx,-0x71(%rdi)
    282 L(P1QD):	mov    %rdx,-0x69(%rdi)
    283 L(P1QC):	mov    %rdx,-0x61(%rdi)
    284 L(P1QB):	mov    %rdx,-0x59(%rdi)
    285 L(P1QA):	mov    %rdx,-0x51(%rdi)
    286 L(P1Q9):	mov    %rdx,-0x49(%rdi)
    287 L(P1Q8):	mov    %rdx,-0x41(%rdi)
    288 L(P1Q7):	mov    %rdx,-0x39(%rdi)
    289 L(P1Q6):	mov    %rdx,-0x31(%rdi)
    290 L(P1Q5):	mov    %rdx,-0x29(%rdi)
    291 L(P1Q4):	mov    %rdx,-0x21(%rdi)
    292 L(P1Q3):	mov    %rdx,-0x19(%rdi)
    293 L(P1Q2):	mov    %rdx,-0x11(%rdi)
    294 L(P1Q1):	mov    %rdx,-0x9(%rdi)
    295 L(P1Q0):	mov    %dl,-0x1(%rdi)
    296 		ret
    297 
    298 		.balign 16
    299 L(P0QH):	mov    %rdx,-0x88(%rdi)
    300 		.balign 16
    301 L(P0QG):	mov    %rdx,-0x80(%rdi)
    302 L(P0QF):	mov    %rdx,-0x78(%rdi)
    303 L(P0QE):	mov    %rdx,-0x70(%rdi)
    304 L(P0QD):	mov    %rdx,-0x68(%rdi)
    305 L(P0QC):	mov    %rdx,-0x60(%rdi)
    306 L(P0QB):	mov    %rdx,-0x58(%rdi)
    307 L(P0QA):	mov    %rdx,-0x50(%rdi)
    308 L(P0Q9):	mov    %rdx,-0x48(%rdi)
    309 L(P0Q8):	mov    %rdx,-0x40(%rdi)
    310 L(P0Q7):	mov    %rdx,-0x38(%rdi)
    311 L(P0Q6):	mov    %rdx,-0x30(%rdi)
    312 L(P0Q5):	mov    %rdx,-0x28(%rdi)
    313 L(P0Q4):	mov    %rdx,-0x20(%rdi)
    314 L(P0Q3):	mov    %rdx,-0x18(%rdi)
    315 L(P0Q2):	mov    %rdx,-0x10(%rdi)
    316 L(P0Q1):	mov    %rdx,-0x8(%rdi)
    317 L(P0Q0):	ret
    318 
    319 		.balign 16
    320 L(P2QH):	mov    %rdx,-0x8a(%rdi)
    321 L(P2QG):	mov    %rdx,-0x82(%rdi)
    322 		.balign 16
    323 L(P2QF):	mov    %rdx,-0x7a(%rdi)
    324 L(P2QE):	mov    %rdx,-0x72(%rdi)
    325 L(P2QD):	mov    %rdx,-0x6a(%rdi)
    326 L(P2QC):	mov    %rdx,-0x62(%rdi)
    327 L(P2QB):	mov    %rdx,-0x5a(%rdi)
    328 L(P2QA):	mov    %rdx,-0x52(%rdi)
    329 L(P2Q9):	mov    %rdx,-0x4a(%rdi)
    330 L(P2Q8):	mov    %rdx,-0x42(%rdi)
    331 L(P2Q7):	mov    %rdx,-0x3a(%rdi)
    332 L(P2Q6):	mov    %rdx,-0x32(%rdi)
    333 L(P2Q5):	mov    %rdx,-0x2a(%rdi)
    334 L(P2Q4):	mov    %rdx,-0x22(%rdi)
    335 L(P2Q3):	mov    %rdx,-0x1a(%rdi)
    336 L(P2Q2):	mov    %rdx,-0x12(%rdi)
    337 L(P2Q1):	mov    %rdx,-0xa(%rdi)
    338 L(P2Q0):	mov    %dx,-0x2(%rdi)
    339 		ret
    340 
    341 		.balign 16
    342 L(P3QH):	mov    %rdx,-0x8b(%rdi)
    343 L(P3QG):	mov    %rdx,-0x83(%rdi)
    344 		.balign 16
    345 L(P3QF):	mov    %rdx,-0x7b(%rdi)
    346 L(P3QE):	mov    %rdx,-0x73(%rdi)
    347 L(P3QD):	mov    %rdx,-0x6b(%rdi)
    348 L(P3QC):	mov    %rdx,-0x63(%rdi)
    349 L(P3QB):	mov    %rdx,-0x5b(%rdi)
    350 L(P3QA):	mov    %rdx,-0x53(%rdi)
    351 L(P3Q9):	mov    %rdx,-0x4b(%rdi)
    352 L(P3Q8):	mov    %rdx,-0x43(%rdi)
    353 L(P3Q7):	mov    %rdx,-0x3b(%rdi)
    354 L(P3Q6):	mov    %rdx,-0x33(%rdi)
    355 L(P3Q5):	mov    %rdx,-0x2b(%rdi)
    356 L(P3Q4):	mov    %rdx,-0x23(%rdi)
    357 L(P3Q3):	mov    %rdx,-0x1b(%rdi)
    358 L(P3Q2):	mov    %rdx,-0x13(%rdi)
    359 L(P3Q1):	mov    %rdx,-0xb(%rdi)
    360 L(P3Q0):	mov    %dx,-0x3(%rdi)
    361 		mov    %dl,-0x1(%rdi)
    362 		ret
    363 
    364 		.balign 16
    365 L(P4QH):	mov    %rdx,-0x8c(%rdi)
    366 L(P4QG):	mov    %rdx,-0x84(%rdi)
    367 		.balign 16
    368 L(P4QF):	mov    %rdx,-0x7c(%rdi)
    369 L(P4QE):	mov    %rdx,-0x74(%rdi)
    370 L(P4QD):	mov    %rdx,-0x6c(%rdi)
    371 L(P4QC):	mov    %rdx,-0x64(%rdi)
    372 L(P4QB):	mov    %rdx,-0x5c(%rdi)
    373 L(P4QA):	mov    %rdx,-0x54(%rdi)
    374 L(P4Q9):	mov    %rdx,-0x4c(%rdi)
    375 L(P4Q8):	mov    %rdx,-0x44(%rdi)
    376 L(P4Q7):	mov    %rdx,-0x3c(%rdi)
    377 L(P4Q6):	mov    %rdx,-0x34(%rdi)
    378 L(P4Q5):	mov    %rdx,-0x2c(%rdi)
    379 L(P4Q4):	mov    %rdx,-0x24(%rdi)
    380 L(P4Q3):	mov    %rdx,-0x1c(%rdi)
    381 L(P4Q2):	mov    %rdx,-0x14(%rdi)
    382 L(P4Q1):	mov    %rdx,-0xc(%rdi)
    383 L(P4Q0):	mov    %edx,-0x4(%rdi)
    384 		ret
    385 
    386 		.balign 16
    387 L(P5QH):	mov    %rdx,-0x8d(%rdi)
    388 L(P5QG):	mov    %rdx,-0x85(%rdi)
    389 		.balign 16
    390 L(P5QF):	mov    %rdx,-0x7d(%rdi)
    391 L(P5QE):	mov    %rdx,-0x75(%rdi)
    392 L(P5QD):	mov    %rdx,-0x6d(%rdi)
    393 L(P5QC):	mov    %rdx,-0x65(%rdi)
    394 L(P5QB):	mov    %rdx,-0x5d(%rdi)
    395 L(P5QA):	mov    %rdx,-0x55(%rdi)
    396 L(P5Q9):	mov    %rdx,-0x4d(%rdi)
    397 L(P5Q8):	mov    %rdx,-0x45(%rdi)
    398 L(P5Q7):	mov    %rdx,-0x3d(%rdi)
    399 L(P5Q6):	mov    %rdx,-0x35(%rdi)
    400 L(P5Q5):	mov    %rdx,-0x2d(%rdi)
    401 L(P5Q4):	mov    %rdx,-0x25(%rdi)
    402 L(P5Q3):	mov    %rdx,-0x1d(%rdi)
    403 L(P5Q2):	mov    %rdx,-0x15(%rdi)
    404 L(P5Q1):	mov    %rdx,-0xd(%rdi)
    405 L(P5Q0):	mov    %edx,-0x5(%rdi)
    406 		mov    %dl,-0x1(%rdi)
    407 		ret
    408 
    409 		.balign 16
    410 L(P6QH):	mov    %rdx,-0x8e(%rdi)
    411 L(P6QG):	mov    %rdx,-0x86(%rdi)
    412 		.balign 16
    413 L(P6QF):	mov    %rdx,-0x7e(%rdi)
    414 L(P6QE):	mov    %rdx,-0x76(%rdi)
    415 L(P6QD):	mov    %rdx,-0x6e(%rdi)
    416 L(P6QC):	mov    %rdx,-0x66(%rdi)
    417 L(P6QB):	mov    %rdx,-0x5e(%rdi)
    418 L(P6QA):	mov    %rdx,-0x56(%rdi)
    419 L(P6Q9):	mov    %rdx,-0x4e(%rdi)
    420 L(P6Q8):	mov    %rdx,-0x46(%rdi)
    421 L(P6Q7):	mov    %rdx,-0x3e(%rdi)
    422 L(P6Q6):	mov    %rdx,-0x36(%rdi)
    423 L(P6Q5):	mov    %rdx,-0x2e(%rdi)
    424 L(P6Q4):	mov    %rdx,-0x26(%rdi)
    425 L(P6Q3):	mov    %rdx,-0x1e(%rdi)
    426 L(P6Q2):	mov    %rdx,-0x16(%rdi)
    427 L(P6Q1):	mov    %rdx,-0xe(%rdi)
    428 L(P6Q0):	mov    %edx,-0x6(%rdi)
    429 		mov    %dx,-0x2(%rdi)
    430 		ret
    431 
    432 		.balign 16
    433 L(P7QH):	mov    %rdx,-0x8f(%rdi)
    434 L(P7QG):	mov    %rdx,-0x87(%rdi)
    435 		.balign 16
    436 L(P7QF):	mov    %rdx,-0x7f(%rdi)
    437 L(P7QE):	mov    %rdx,-0x77(%rdi)
    438 L(P7QD):	mov    %rdx,-0x6f(%rdi)
    439 L(P7QC):	mov    %rdx,-0x67(%rdi)
    440 L(P7QB):	mov    %rdx,-0x5f(%rdi)
    441 L(P7QA):	mov    %rdx,-0x57(%rdi)
    442 L(P7Q9):	mov    %rdx,-0x4f(%rdi)
    443 L(P7Q8):	mov    %rdx,-0x47(%rdi)
    444 L(P7Q7):	mov    %rdx,-0x3f(%rdi)
    445 L(P7Q6):	mov    %rdx,-0x37(%rdi)
    446 L(P7Q5):	mov    %rdx,-0x2f(%rdi)
    447 L(P7Q4):	mov    %rdx,-0x27(%rdi)
    448 L(P7Q3):	mov    %rdx,-0x1f(%rdi)
    449 L(P7Q2):	mov    %rdx,-0x17(%rdi)
    450 L(P7Q1):	mov    %rdx,-0xf(%rdi)
    451 L(P7Q0):	mov    %edx,-0x7(%rdi)
    452 		mov    %dx,-0x3(%rdi)
    453 		mov    %dl,-0x1(%rdi)
    454 		ret
    455 
    456 		.balign 16
    457 L(ck_align):
    458 		/*
    459 		 * Align to 16 byte boundary first
    460 		 */
    461 	 	lea    L(AliPxQx)(%rip),%r11
    462 	 	mov    $0x10,%r10
    463 	 	mov    %rdi,%r9
    464 	 	and    $0xf,%r9
    465 	 	sub    %r9,%r10
    466 	 	and    $0xf,%r10
    467 	 	add    %r10,%rdi
    468 	 	sub    %r10,%r8
    469 
    470 		movslq (%r11,%r10,4),%rcx
    471 		lea    (%rcx,%r11,1),%r11
    472 		jmpq   *%r11			# align dest to 16-byte boundary
    473 
    474 		.balign 16
    475 L(AliPxQx):	.int	L(aligned_now)-L(AliPxQx)
    476 		.int	L(A1Q0)-L(AliPxQx)
    477 		.int	L(A2Q0)-L(AliPxQx)
    478 		.int	L(A3Q0)-L(AliPxQx)
    479 		.int	L(A4Q0)-L(AliPxQx)
    480 		.int	L(A5Q0)-L(AliPxQx)
    481 		.int	L(A6Q0)-L(AliPxQx)
    482 		.int	L(A7Q0)-L(AliPxQx)
    483 
    484 		.int	L(A0Q1)-L(AliPxQx)
    485 		.int	L(A1Q1)-L(AliPxQx)
    486 		.int	L(A2Q1)-L(AliPxQx)
    487 		.int	L(A3Q1)-L(AliPxQx)
    488 		.int	L(A4Q1)-L(AliPxQx)
    489 		.int	L(A5Q1)-L(AliPxQx)
    490 		.int	L(A6Q1)-L(AliPxQx)
    491 		.int	L(A7Q1)-L(AliPxQx)
    492 
    493 		.balign 16
    494 L(A5Q1):	mov    %dl,-0xd(%rdi)
    495 L(A4Q1):	mov    %edx,-0xc(%rdi)
    496 L(A0Q1):	mov    %rdx,-0x8(%rdi)
    497 		jmp     L(aligned_now)
    498 
    499 		.balign 16
    500 L(A1Q1):	mov    %dl,-0x9(%rdi)
    501 		mov    %rdx,-0x8(%rdi)
    502 		jmp    L(aligned_now)
    503 
    504 		.balign 16
    505 L(A1Q0):	mov    %dl,-0x1(%rdi)
    506 		jmp    L(aligned_now)
    507 
    508 		.balign 16
    509 L(A3Q1):	mov    %dl,-0xb(%rdi)
    510 L(A2Q1):	mov    %dx,-0xa(%rdi)
    511 		mov    %rdx,-0x8(%rdi)
    512 		jmp    L(aligned_now)
    513 
    514 		.balign 16
    515 L(A3Q0):	mov    %dl,-0x3(%rdi)
    516 L(A2Q0):	mov    %dx,-0x2(%rdi)
    517 		jmp    L(aligned_now)
    518 
    519 		.balign 16
    520 L(A5Q0):	mov    %dl,-0x5(%rdi)
    521 L(A4Q0):	mov    %edx,-0x4(%rdi)
    522 		jmp    L(aligned_now)
    523 
    524 		.balign 16
    525 L(A7Q1):	mov    %dl,-0xf(%rdi)
    526 L(A6Q1):	mov    %dx,-0xe(%rdi)
    527 		mov    %edx,-0xc(%rdi)
    528 		mov    %rdx,-0x8(%rdi)
    529 		jmp    L(aligned_now)
    530 
    531 		.balign 16
    532 L(A7Q0):	mov    %dl,-0x7(%rdi)
    533 L(A6Q0):	mov    %dx,-0x6(%rdi)
    534 		mov    %edx,-0x4(%rdi)
    535 		#jmp    L(aligned_now)		# Fall thru...
    536 
    537 		.balign 16
    538 L(aligned_now):
    539 		/*
    540 		 * Check memops method
    541 		 */
    542 		cmpl   $NO_SSE,.memops_method(%rip)
    543 		je     L(Loop8byte_pre)
    544 
    545 		/*
    546 		 * Use SSE2 instructions
    547 		 */
    548 	 	movd   %rdx,%xmm0
    549 		lea    L(SSExDx)(%rip),%r9	# after dest alignment
    550 	 	punpcklqdq %xmm0,%xmm0		# fill RegXMM0 with the pattern
    551 		cmp    $0xc0,%r8		# 192
    552 		jge    L(byte32sse2_pre)
    553 
    554 		add    %r8,%rdi
    555 
    556 		movslq (%r9,%r8,4),%rcx
    557 		lea    (%rcx,%r9,1),%r9
    558 		jmpq   *%r9
    559 
    560 		.balign 16
    561 L(SSE0QB):	movdqa %xmm0,-0xb0(%rdi)
    562 L(SSE0QA):	movdqa %xmm0,-0xa0(%rdi)
    563 L(SSE0Q9):	movdqa %xmm0,-0x90(%rdi)
    564 L(SSE0Q8):	movdqa %xmm0,-0x80(%rdi)
    565 L(SSE0Q7):	movdqa %xmm0,-0x70(%rdi)
    566 L(SSE0Q6):	movdqa %xmm0,-0x60(%rdi)
    567 L(SSE0Q5):	movdqa %xmm0,-0x50(%rdi)
    568 L(SSE0Q4):	movdqa %xmm0,-0x40(%rdi)
    569 L(SSE0Q3):	movdqa %xmm0,-0x30(%rdi)
    570 L(SSE0Q2):	movdqa %xmm0,-0x20(%rdi)
    571 L(SSE0Q1):	movdqa %xmm0,-0x10(%rdi)
    572 L(SSE0Q0):	ret
    573 
    574 		.balign 16
    575 L(SSE1QB):	movdqa %xmm0,-0xb1(%rdi)
    576 L(SSE1QA):	movdqa %xmm0,-0xa1(%rdi)
    577 L(SSE1Q9):	movdqa %xmm0,-0x91(%rdi)
    578 L(SSE1Q8):	movdqa %xmm0,-0x81(%rdi)
    579 L(SSE1Q7):	movdqa %xmm0,-0x71(%rdi)
    580 L(SSE1Q6):	movdqa %xmm0,-0x61(%rdi)
    581 L(SSE1Q5):	movdqa %xmm0,-0x51(%rdi)
    582 L(SSE1Q4):	movdqa %xmm0,-0x41(%rdi)
    583 L(SSE1Q3):	movdqa %xmm0,-0x31(%rdi)
    584 L(SSE1Q2):	movdqa %xmm0,-0x21(%rdi)
    585 L(SSE1Q1):	movdqa %xmm0,-0x11(%rdi)
    586 L(SSE1Q0):	mov    %dl,-0x1(%rdi)
    587 		ret
    588 
    589 		.balign 16
    590 L(SSE2QB):	movdqa %xmm0,-0xb2(%rdi)
    591 L(SSE2QA):	movdqa %xmm0,-0xa2(%rdi)
    592 L(SSE2Q9):	movdqa %xmm0,-0x92(%rdi)
    593 L(SSE2Q8):	movdqa %xmm0,-0x82(%rdi)
    594 L(SSE2Q7):	movdqa %xmm0,-0x72(%rdi)
    595 L(SSE2Q6):	movdqa %xmm0,-0x62(%rdi)
    596 L(SSE2Q5):	movdqa %xmm0,-0x52(%rdi)
    597 L(SSE2Q4):	movdqa %xmm0,-0x42(%rdi)
    598 L(SSE2Q3):	movdqa %xmm0,-0x32(%rdi)
    599 L(SSE2Q2):	movdqa %xmm0,-0x22(%rdi)
    600 L(SSE2Q1):	movdqa %xmm0,-0x12(%rdi)
    601 L(SSE2Q0):	mov    %dx,-0x2(%rdi)
    602 		ret
    603 
    604 		.balign 16
    605 L(SSE3QB):	movdqa %xmm0,-0xb3(%rdi)
    606 L(SSE3QA):	movdqa %xmm0,-0xa3(%rdi)
    607 L(SSE3Q9):	movdqa %xmm0,-0x93(%rdi)
    608 L(SSE3Q8):	movdqa %xmm0,-0x83(%rdi)
    609 L(SSE3Q7):	movdqa %xmm0,-0x73(%rdi)
    610 L(SSE3Q6):	movdqa %xmm0,-0x63(%rdi)
    611 L(SSE3Q5):	movdqa %xmm0,-0x53(%rdi)
    612 L(SSE3Q4):	movdqa %xmm0,-0x43(%rdi)
    613 L(SSE3Q3):	movdqa %xmm0,-0x33(%rdi)
    614 L(SSE3Q2):	movdqa %xmm0,-0x23(%rdi)
    615 L(SSE3Q1):	movdqa %xmm0,-0x13(%rdi)
    616 L(SSE3Q0):	mov    %dx,-0x3(%rdi)
    617 		mov    %dl,-0x1(%rdi)
    618 		ret
    619 
    620 		.balign 16
    621 L(SSE4QB):	movdqa %xmm0,-0xb4(%rdi)
    622 L(SSE4QA):	movdqa %xmm0,-0xa4(%rdi)
    623 L(SSE4Q9):	movdqa %xmm0,-0x94(%rdi)
    624 L(SSE4Q8):	movdqa %xmm0,-0x84(%rdi)
    625 L(SSE4Q7):	movdqa %xmm0,-0x74(%rdi)
    626 L(SSE4Q6):	movdqa %xmm0,-0x64(%rdi)
    627 L(SSE4Q5):	movdqa %xmm0,-0x54(%rdi)
    628 L(SSE4Q4):	movdqa %xmm0,-0x44(%rdi)
    629 L(SSE4Q3):	movdqa %xmm0,-0x34(%rdi)
    630 L(SSE4Q2):	movdqa %xmm0,-0x24(%rdi)
    631 L(SSE4Q1):	movdqa %xmm0,-0x14(%rdi)
    632 L(SSE4Q0):	mov    %edx,-0x4(%rdi)
    633 		ret
    634 
    635 		.balign 16
    636 L(SSE5QB):	movdqa %xmm0,-0xb5(%rdi)
    637 L(SSE5QA):	movdqa %xmm0,-0xa5(%rdi)
    638 L(SSE5Q9):	movdqa %xmm0,-0x95(%rdi)
    639 L(SSE5Q8):	movdqa %xmm0,-0x85(%rdi)
    640 L(SSE5Q7):	movdqa %xmm0,-0x75(%rdi)
    641 L(SSE5Q6):	movdqa %xmm0,-0x65(%rdi)
    642 L(SSE5Q5):	movdqa %xmm0,-0x55(%rdi)
    643 L(SSE5Q4):	movdqa %xmm0,-0x45(%rdi)
    644 L(SSE5Q3):	movdqa %xmm0,-0x35(%rdi)
    645 L(SSE5Q2):	movdqa %xmm0,-0x25(%rdi)
    646 L(SSE5Q1):	movdqa %xmm0,-0x15(%rdi)
    647 L(SSE5Q0):	mov    %edx,-0x5(%rdi)
    648 		mov    %dl,-0x1(%rdi)
    649 		ret
    650 
    651 		.balign 16
    652 L(SSE6QB):	movdqa %xmm0,-0xb6(%rdi)
    653 L(SSE6QA):	movdqa %xmm0,-0xa6(%rdi)
    654 L(SSE6Q9):	movdqa %xmm0,-0x96(%rdi)
    655 L(SSE6Q8):	movdqa %xmm0,-0x86(%rdi)
    656 L(SSE6Q7):	movdqa %xmm0,-0x76(%rdi)
    657 L(SSE6Q6):	movdqa %xmm0,-0x66(%rdi)
    658 L(SSE6Q5):	movdqa %xmm0,-0x56(%rdi)
    659 L(SSE6Q4):	movdqa %xmm0,-0x46(%rdi)
    660 L(SSE6Q3):	movdqa %xmm0,-0x36(%rdi)
    661 L(SSE6Q2):	movdqa %xmm0,-0x26(%rdi)
    662 L(SSE6Q1):	movdqa %xmm0,-0x16(%rdi)
    663 L(SSE6Q0):	mov    %edx,-0x6(%rdi)
    664 		mov    %dx,-0x2(%rdi)
    665 		ret
    666 
    667 		.balign 16
    668 L(SSE7QB):	movdqa %xmm0,-0xb7(%rdi)
    669 L(SSE7QA):	movdqa %xmm0,-0xa7(%rdi)
    670 L(SSE7Q9):	movdqa %xmm0,-0x97(%rdi)
    671 L(SSE7Q8):	movdqa %xmm0,-0x87(%rdi)
    672 L(SSE7Q7):	movdqa %xmm0,-0x77(%rdi)
    673 L(SSE7Q6):	movdqa %xmm0,-0x67(%rdi)
    674 L(SSE7Q5):	movdqa %xmm0,-0x57(%rdi)
    675 L(SSE7Q4):	movdqa %xmm0,-0x47(%rdi)
    676 L(SSE7Q3):	movdqa %xmm0,-0x37(%rdi)
    677 L(SSE7Q2):	movdqa %xmm0,-0x27(%rdi)
    678 L(SSE7Q1):	movdqa %xmm0,-0x17(%rdi)
    679 L(SSE7Q0):	mov    %edx,-0x7(%rdi)
    680 		mov    %dx,-0x3(%rdi)
    681 		mov    %dl,-0x1(%rdi)
    682 		ret
    683 
    684 		.balign 16
    685 L(SSE8QB):	movdqa %xmm0,-0xb8(%rdi)
    686 L(SSE8QA):	movdqa %xmm0,-0xa8(%rdi)
    687 L(SSE8Q9):	movdqa %xmm0,-0x98(%rdi)
    688 L(SSE8Q8):	movdqa %xmm0,-0x88(%rdi)
    689 L(SSE8Q7):	movdqa %xmm0,-0x78(%rdi)
    690 L(SSE8Q6):	movdqa %xmm0,-0x68(%rdi)
    691 L(SSE8Q5):	movdqa %xmm0,-0x58(%rdi)
    692 L(SSE8Q4):	movdqa %xmm0,-0x48(%rdi)
    693 L(SSE8Q3):	movdqa %xmm0,-0x38(%rdi)
    694 L(SSE8Q2):	movdqa %xmm0,-0x28(%rdi)
    695 L(SSE8Q1):	movdqa %xmm0,-0x18(%rdi)
    696 L(SSE8Q0):	mov    %rdx,-0x8(%rdi)
    697 		ret
    698 
    699 		.balign 16
    700 L(SSE9QB):	movdqa %xmm0,-0xb9(%rdi)
    701 L(SSE9QA):	movdqa %xmm0,-0xa9(%rdi)
    702 L(SSE9Q9):	movdqa %xmm0,-0x99(%rdi)
    703 L(SSE9Q8):	movdqa %xmm0,-0x89(%rdi)
    704 L(SSE9Q7):	movdqa %xmm0,-0x79(%rdi)
    705 L(SSE9Q6):	movdqa %xmm0,-0x69(%rdi)
    706 L(SSE9Q5):	movdqa %xmm0,-0x59(%rdi)
    707 L(SSE9Q4):	movdqa %xmm0,-0x49(%rdi)
    708 L(SSE9Q3):	movdqa %xmm0,-0x39(%rdi)
    709 L(SSE9Q2):	movdqa %xmm0,-0x29(%rdi)
    710 L(SSE9Q1):	movdqa %xmm0,-0x19(%rdi)
    711 L(SSE9Q0):	mov    %rdx,-0x9(%rdi)
    712 		mov    %dl,-0x1(%rdi)
    713 		ret
    714 
    715 		.balign 16
    716 L(SSE10QB):	movdqa %xmm0,-0xba(%rdi)
    717 L(SSE10QA):	movdqa %xmm0,-0xaa(%rdi)
    718 L(SSE10Q9):	movdqa %xmm0,-0x9a(%rdi)
    719 L(SSE10Q8):	movdqa %xmm0,-0x8a(%rdi)
    720 L(SSE10Q7):	movdqa %xmm0,-0x7a(%rdi)
    721 L(SSE10Q6):	movdqa %xmm0,-0x6a(%rdi)
    722 L(SSE10Q5):	movdqa %xmm0,-0x5a(%rdi)
    723 L(SSE10Q4):	movdqa %xmm0,-0x4a(%rdi)
    724 L(SSE10Q3):	movdqa %xmm0,-0x3a(%rdi)
    725 L(SSE10Q2):	movdqa %xmm0,-0x2a(%rdi)
    726 L(SSE10Q1):	movdqa %xmm0,-0x1a(%rdi)
    727 L(SSE10Q0):	mov    %rdx,-0xa(%rdi)
    728 		mov    %dx,-0x2(%rdi)
    729 		ret
    730 
    731 		.balign 16
    732 L(SSE11QB):	movdqa %xmm0,-0xbb(%rdi)
    733 L(SSE11QA):	movdqa %xmm0,-0xab(%rdi)
    734 L(SSE11Q9):	movdqa %xmm0,-0x9b(%rdi)
    735 L(SSE11Q8):	movdqa %xmm0,-0x8b(%rdi)
    736 L(SSE11Q7):	movdqa %xmm0,-0x7b(%rdi)
    737 L(SSE11Q6):	movdqa %xmm0,-0x6b(%rdi)
    738 L(SSE11Q5):	movdqa %xmm0,-0x5b(%rdi)
    739 L(SSE11Q4):	movdqa %xmm0,-0x4b(%rdi)
    740 L(SSE11Q3):	movdqa %xmm0,-0x3b(%rdi)
    741 L(SSE11Q2):	movdqa %xmm0,-0x2b(%rdi)
    742 L(SSE11Q1):	movdqa %xmm0,-0x1b(%rdi)
    743 L(SSE11Q0):	mov    %rdx,-0xb(%rdi)
    744 		mov    %dx,-0x3(%rdi)
    745 		mov    %dl,-0x1(%rdi)
    746 		ret
    747 
    748 		.balign 16
    749 L(SSE12QB):	movdqa %xmm0,-0xbc(%rdi)
    750 L(SSE12QA):	movdqa %xmm0,-0xac(%rdi)
    751 L(SSE12Q9):	movdqa %xmm0,-0x9c(%rdi)
    752 L(SSE12Q8):	movdqa %xmm0,-0x8c(%rdi)
    753 L(SSE12Q7):	movdqa %xmm0,-0x7c(%rdi)
    754 L(SSE12Q6):	movdqa %xmm0,-0x6c(%rdi)
    755 L(SSE12Q5):	movdqa %xmm0,-0x5c(%rdi)
    756 L(SSE12Q4):	movdqa %xmm0,-0x4c(%rdi)
    757 L(SSE12Q3):	movdqa %xmm0,-0x3c(%rdi)
    758 L(SSE12Q2):	movdqa %xmm0,-0x2c(%rdi)
    759 L(SSE12Q1):	movdqa %xmm0,-0x1c(%rdi)
    760 L(SSE12Q0):	mov    %rdx,-0xc(%rdi)
    761 		mov    %edx,-0x4(%rdi)
    762 		ret
    763 
    764 		.balign 16
    765 L(SSE13QB):	movdqa %xmm0,-0xbd(%rdi)
    766 L(SSE13QA):	movdqa %xmm0,-0xad(%rdi)
    767 L(SSE13Q9):	movdqa %xmm0,-0x9d(%rdi)
    768 L(SSE13Q8):	movdqa %xmm0,-0x8d(%rdi)
    769 L(SSE13Q7):	movdqa %xmm0,-0x7d(%rdi)
    770 L(SSE13Q6):	movdqa %xmm0,-0x6d(%rdi)
    771 L(SSE13Q5):	movdqa %xmm0,-0x5d(%rdi)
    772 L(SSE13Q4):	movdqa %xmm0,-0x4d(%rdi)
    773 L(SSE13Q3):	movdqa %xmm0,-0x3d(%rdi)
    774 L(SSE13Q2):	movdqa %xmm0,-0x2d(%rdi)
    775 L(SSE13Q1):	movdqa %xmm0,-0x1d(%rdi)
    776 L(SSE13Q0):	mov    %rdx,-0xd(%rdi)
    777 		mov    %edx,-0x5(%rdi)
    778 		mov    %dl,-0x1(%rdi)
    779 		ret
    780 
    781 		.balign 16
    782 L(SSE14QB):	movdqa %xmm0,-0xbe(%rdi)
    783 L(SSE14QA):	movdqa %xmm0,-0xae(%rdi)
    784 L(SSE14Q9):	movdqa %xmm0,-0x9e(%rdi)
    785 L(SSE14Q8):	movdqa %xmm0,-0x8e(%rdi)
    786 L(SSE14Q7):	movdqa %xmm0,-0x7e(%rdi)
    787 L(SSE14Q6):	movdqa %xmm0,-0x6e(%rdi)
    788 L(SSE14Q5):	movdqa %xmm0,-0x5e(%rdi)
    789 L(SSE14Q4):	movdqa %xmm0,-0x4e(%rdi)
    790 L(SSE14Q3):	movdqa %xmm0,-0x3e(%rdi)
    791 L(SSE14Q2):	movdqa %xmm0,-0x2e(%rdi)
    792 L(SSE14Q1):	movdqa %xmm0,-0x1e(%rdi)
    793 L(SSE14Q0):	mov    %rdx,-0xe(%rdi)
    794 		mov    %edx,-0x6(%rdi)
    795 		mov    %dx,-0x2(%rdi)
    796 		ret
    797 
    798 		.balign 16
    799 L(SSE15QB):	movdqa %xmm0,-0xbf(%rdi)
    800 L(SSE15QA):	movdqa %xmm0,-0xaf(%rdi)
    801 L(SSE15Q9):	movdqa %xmm0,-0x9f(%rdi)
    802 L(SSE15Q8):	movdqa %xmm0,-0x8f(%rdi)
    803 L(SSE15Q7):	movdqa %xmm0,-0x7f(%rdi)
    804 L(SSE15Q6):	movdqa %xmm0,-0x6f(%rdi)
    805 L(SSE15Q5):	movdqa %xmm0,-0x5f(%rdi)
    806 L(SSE15Q4):	movdqa %xmm0,-0x4f(%rdi)
    807 L(SSE15Q3):	movdqa %xmm0,-0x3f(%rdi)
    808 L(SSE15Q2):	movdqa %xmm0,-0x2f(%rdi)
    809 L(SSE15Q1):	movdqa %xmm0,-0x1f(%rdi)
    810 L(SSE15Q0):	mov    %rdx,-0xf(%rdi)
    811 		mov    %edx,-0x7(%rdi)
    812 		mov    %dx,-0x3(%rdi)
    813 		mov    %dl,-0x1(%rdi)
    814 		ret
    815 
    816 		.balign 16
    817 L(byte32sse2_pre):
    818 		mov    .largest_level_cache_size(%rip),%r9d
    819 		cmp    %r9,%r8
    820 		jg     L(sse2_nt_move)
    821 		#jmp    L(byte32sse2)		# Fall thru...
    822 
    823 		.balign 16
    824 L(byte32sse2):
    825 		lea    -0x80(%r8),%r8		# 128
    826 		cmp    $0x80,%r8
    827 		movdqa %xmm0,(%rdi)
    828 		movdqa %xmm0,0x10(%rdi)
    829 		movdqa %xmm0,0x20(%rdi)
    830 		movdqa %xmm0,0x30(%rdi)
    831 		movdqa %xmm0,0x40(%rdi)
    832 		movdqa %xmm0,0x50(%rdi)
    833 		movdqa %xmm0,0x60(%rdi)
    834 		movdqa %xmm0,0x70(%rdi)
    835 
    836 		lea    0x80(%rdi),%rdi
    837 		jge    L(byte32sse2)
    838 
    839 		lea    L(SSExDx)(%rip),%r11
    840 		add    %r8,%rdi
    841 		movslq (%r11,%r8,4),%rcx
    842 		lea    (%rcx,%r11,1),%r11
    843 		jmpq   *%r11
    844 
    845 		.balign	16
    846 L(sse2_nt_move):
    847 		sub    $0x80,%r8		# 128
    848 		movntdq %xmm0,(%rdi)
    849 		movntdq %xmm0,0x10(%rdi)
    850 		movntdq %xmm0,0x20(%rdi)
    851 		movntdq %xmm0,0x30(%rdi)
    852 		movntdq %xmm0,0x40(%rdi)
    853 		movntdq %xmm0,0x50(%rdi)
    854 		movntdq %xmm0,0x60(%rdi)
    855 		movntdq %xmm0,0x70(%rdi)
    856 		add    $0x80,%rdi
    857 		cmp    $0x80,%r8
    858 		jge    L(sse2_nt_move)
    859 
    860 		sfence
    861 		lea    L(SSExDx)(%rip),%r11
    862 		add    %r8,%rdi
    863 		movslq (%r11,%r8,4),%rcx
    864 		lea    (%rcx,%r11,1),%r11
    865 		jmpq   *%r11
    866 
    867 		/*
    868 		 * Don't use SSE
    869 		 */
    870 		.balign 16
    871 L(Loop8byte_pre):
    872 		mov    .largest_level_cache_size(%rip),%r9d
    873 		cmp    %r9,%r8
    874 		jg     L(Loop8byte_nt_move)
    875 		cmp    $0x800,%r8		# Use rep sstoq
    876 		jge    L(use_rep)
    877 
    878 		.balign 16
    879 L(Loop8byte):
    880 		lea    -0x80(%r8),%r8		# 128
    881 		mov    %rdx,(%rdi)
    882 		mov    %rdx,0x8(%rdi)
    883 		mov    %rdx,0x10(%rdi)
    884 		mov    %rdx,0x18(%rdi)
    885 		mov    %rdx,0x20(%rdi)
    886 		mov    %rdx,0x28(%rdi)
    887 		mov    %rdx,0x30(%rdi)
    888 		mov    %rdx,0x38(%rdi)
    889 		cmp    $0x80,%r8
    890 		mov    %rdx,0x40(%rdi)
    891 		mov    %rdx,0x48(%rdi)
    892 		mov    %rdx,0x50(%rdi)
    893 		mov    %rdx,0x58(%rdi)
    894 		mov    %rdx,0x60(%rdi)
    895 		mov    %rdx,0x68(%rdi)
    896 		mov    %rdx,0x70(%rdi)
    897 		mov    %rdx,0x78(%rdi)
    898 		lea    0x80(%rdi),%rdi
    899 		jge    L(Loop8byte)
    900 
    901 1:
    902 		lea    L(setPxQx)(%rip),%r11
    903 		lea    (%rdi,%r8,1),%rdi
    904 
    905 		movslq (%r11,%r8,4),%rcx
    906 		lea    (%rcx,%r11,1),%r11
    907 		jmpq   *%r11
    908 
    909 		/*
    910 		 * Use rep sstoq for sizes > 2K
    911 		 */
    912 		.balign 16
    913 L(use_rep):
    914 		movq   %r8,%rcx			# get size in bytes
    915 		xchg   %rax,%rdx
    916 		shrq   $3,%rcx
    917 		rep
    918 		  sstoq
    919 		xchg   %rax,%rdx
    920 		andq   $7,%r8			# remaining bytes
    921 		jnz    1b
    922 		ret
    923 
    924 		.balign 16
    925 L(Loop8byte_nt_move):
    926 		lea    -0x80(%r8),%r8		# 128
    927 		movnti %rdx,(%rdi)
    928 		movnti %rdx,0x8(%rdi)
    929 		movnti %rdx,0x10(%rdi)
    930 		movnti %rdx,0x18(%rdi)
    931 		movnti %rdx,0x20(%rdi)
    932 		movnti %rdx,0x28(%rdi)
    933 		movnti %rdx,0x30(%rdi)
    934 		movnti %rdx,0x38(%rdi)
    935 		cmp    $0x80,%r8
    936 		movnti %rdx,0x40(%rdi)
    937 		movnti %rdx,0x48(%rdi)
    938 		movnti %rdx,0x50(%rdi)
    939 		movnti %rdx,0x58(%rdi)
    940 		movnti %rdx,0x60(%rdi)
    941 		movnti %rdx,0x68(%rdi)
    942 		movnti %rdx,0x70(%rdi)
    943 		movnti %rdx,0x78(%rdi)
    944 		lea    0x80(%rdi),%rdi
    945 		jge    L(Loop8byte_nt_move)
    946 
    947 		sfence
    948 		lea    L(setPxQx)(%rip),%r11
    949 		lea    (%rdi,%r8,1),%rdi
    950 
    951 		movslq    (%r11,%r8,4),%rcx
    952 		lea    (%rcx,%r11,1),%r11
    953 		jmpq   *%r11
    954 
    955 		.balign 16
    956 L(SSExDx):	.int       L(SSE0Q0) -L(SSExDx)
    957 		.int       L(SSE1Q0) -L(SSExDx)
    958 		.int       L(SSE2Q0) -L(SSExDx)
    959 		.int       L(SSE3Q0) -L(SSExDx)
    960 		.int       L(SSE4Q0) -L(SSExDx)
    961 		.int       L(SSE5Q0) -L(SSExDx)
    962 		.int       L(SSE6Q0) -L(SSExDx)
    963 		.int       L(SSE7Q0) -L(SSExDx)
    964 
    965 		.int       L(SSE8Q0) -L(SSExDx)
    966 		.int       L(SSE9Q0) -L(SSExDx)
    967 		.int       L(SSE10Q0)-L(SSExDx)
    968 		.int       L(SSE11Q0)-L(SSExDx)
    969 		.int       L(SSE12Q0)-L(SSExDx)
    970 		.int       L(SSE13Q0)-L(SSExDx)
    971 		.int       L(SSE14Q0)-L(SSExDx)
    972 		.int       L(SSE15Q0)-L(SSExDx)
    973 
    974 		.int       L(SSE0Q1) -L(SSExDx)
    975 		.int       L(SSE1Q1) -L(SSExDx)
    976 		.int       L(SSE2Q1) -L(SSExDx)
    977 		.int       L(SSE3Q1) -L(SSExDx)
    978 		.int       L(SSE4Q1) -L(SSExDx)
    979 		.int       L(SSE5Q1) -L(SSExDx)
    980 		.int       L(SSE6Q1) -L(SSExDx)
    981 		.int       L(SSE7Q1) -L(SSExDx)
    982 
    983 		.int       L(SSE8Q1) -L(SSExDx)
    984 		.int       L(SSE9Q1) -L(SSExDx)
    985 		.int       L(SSE10Q1)-L(SSExDx)
    986 		.int       L(SSE11Q1)-L(SSExDx)
    987 		.int       L(SSE12Q1)-L(SSExDx)
    988 		.int       L(SSE13Q1)-L(SSExDx)
    989 		.int       L(SSE14Q1)-L(SSExDx)
    990 		.int       L(SSE15Q1)-L(SSExDx)
    991 
    992 		.int       L(SSE0Q2) -L(SSExDx)
    993 		.int       L(SSE1Q2) -L(SSExDx)
    994 		.int       L(SSE2Q2) -L(SSExDx)
    995 		.int       L(SSE3Q2) -L(SSExDx)
    996 		.int       L(SSE4Q2) -L(SSExDx)
    997 		.int       L(SSE5Q2) -L(SSExDx)
    998 		.int       L(SSE6Q2) -L(SSExDx)
    999 		.int       L(SSE7Q2) -L(SSExDx)
   1000 
   1001 		.int       L(SSE8Q2) -L(SSExDx)
   1002 		.int       L(SSE9Q2) -L(SSExDx)
   1003 		.int       L(SSE10Q2)-L(SSExDx)
   1004 		.int       L(SSE11Q2)-L(SSExDx)
   1005 		.int       L(SSE12Q2)-L(SSExDx)
   1006 		.int       L(SSE13Q2)-L(SSExDx)
   1007 		.int       L(SSE14Q2)-L(SSExDx)
   1008 		.int       L(SSE15Q2)-L(SSExDx)
   1009 
   1010 		.int       L(SSE0Q3) -L(SSExDx)
   1011 		.int       L(SSE1Q3) -L(SSExDx)
   1012 		.int       L(SSE2Q3) -L(SSExDx)
   1013 		.int       L(SSE3Q3) -L(SSExDx)
   1014 		.int       L(SSE4Q3) -L(SSExDx)
   1015 		.int       L(SSE5Q3) -L(SSExDx)
   1016 		.int       L(SSE6Q3) -L(SSExDx)
   1017 		.int       L(SSE7Q3) -L(SSExDx)
   1018 
   1019 		.int       L(SSE8Q3) -L(SSExDx)
   1020 		.int       L(SSE9Q3) -L(SSExDx)
   1021 		.int       L(SSE10Q3)-L(SSExDx)
   1022 		.int       L(SSE11Q3)-L(SSExDx)
   1023 		.int       L(SSE12Q3)-L(SSExDx)
   1024 		.int       L(SSE13Q3)-L(SSExDx)
   1025 		.int       L(SSE14Q3)-L(SSExDx)
   1026 		.int       L(SSE15Q3)-L(SSExDx)
   1027 
   1028 		.int       L(SSE0Q4) -L(SSExDx)
   1029 		.int       L(SSE1Q4) -L(SSExDx)
   1030 		.int       L(SSE2Q4) -L(SSExDx)
   1031 		.int       L(SSE3Q4) -L(SSExDx)
   1032 		.int       L(SSE4Q4) -L(SSExDx)
   1033 		.int       L(SSE5Q4) -L(SSExDx)
   1034 		.int       L(SSE6Q4) -L(SSExDx)
   1035 		.int       L(SSE7Q4) -L(SSExDx)
   1036 
   1037 		.int       L(SSE8Q4) -L(SSExDx)
   1038 		.int       L(SSE9Q4) -L(SSExDx)
   1039 		.int       L(SSE10Q4)-L(SSExDx)
   1040 		.int       L(SSE11Q4)-L(SSExDx)
   1041 		.int       L(SSE12Q4)-L(SSExDx)
   1042 		.int       L(SSE13Q4)-L(SSExDx)
   1043 		.int       L(SSE14Q4)-L(SSExDx)
   1044 		.int       L(SSE15Q4)-L(SSExDx)
   1045 
   1046 		.int       L(SSE0Q5) -L(SSExDx)
   1047 		.int       L(SSE1Q5) -L(SSExDx)
   1048 		.int       L(SSE2Q5) -L(SSExDx)
   1049 		.int       L(SSE3Q5) -L(SSExDx)
   1050 		.int       L(SSE4Q5) -L(SSExDx)
   1051 		.int       L(SSE5Q5) -L(SSExDx)
   1052 		.int       L(SSE6Q5) -L(SSExDx)
   1053 		.int       L(SSE7Q5) -L(SSExDx)
   1054 
   1055 		.int       L(SSE8Q5) -L(SSExDx)
   1056 		.int       L(SSE9Q5) -L(SSExDx)
   1057 		.int       L(SSE10Q5)-L(SSExDx)
   1058 		.int       L(SSE11Q5)-L(SSExDx)
   1059 		.int       L(SSE12Q5)-L(SSExDx)
   1060 		.int       L(SSE13Q5)-L(SSExDx)
   1061 		.int       L(SSE14Q5)-L(SSExDx)
   1062 		.int       L(SSE15Q5)-L(SSExDx)
   1063 
   1064 		.int       L(SSE0Q6) -L(SSExDx)
   1065 		.int       L(SSE1Q6) -L(SSExDx)
   1066 		.int       L(SSE2Q6) -L(SSExDx)
   1067 		.int       L(SSE3Q6) -L(SSExDx)
   1068 		.int       L(SSE4Q6) -L(SSExDx)
   1069 		.int       L(SSE5Q6) -L(SSExDx)
   1070 		.int       L(SSE6Q6) -L(SSExDx)
   1071 		.int       L(SSE7Q6) -L(SSExDx)
   1072 
   1073 		.int       L(SSE8Q6) -L(SSExDx)
   1074 		.int       L(SSE9Q6) -L(SSExDx)
   1075 		.int       L(SSE10Q6)-L(SSExDx)
   1076 		.int       L(SSE11Q6)-L(SSExDx)
   1077 		.int       L(SSE12Q6)-L(SSExDx)
   1078 		.int       L(SSE13Q6)-L(SSExDx)
   1079 		.int       L(SSE14Q6)-L(SSExDx)
   1080 		.int       L(SSE15Q6)-L(SSExDx)
   1081 
   1082 		.int       L(SSE0Q7) -L(SSExDx)
   1083 		.int       L(SSE1Q7) -L(SSExDx)
   1084 		.int       L(SSE2Q7) -L(SSExDx)
   1085 		.int       L(SSE3Q7) -L(SSExDx)
   1086 		.int       L(SSE4Q7) -L(SSExDx)
   1087 		.int       L(SSE5Q7) -L(SSExDx)
   1088 		.int       L(SSE6Q7) -L(SSExDx)
   1089 		.int       L(SSE7Q7) -L(SSExDx)
   1090 
   1091 		.int       L(SSE8Q7) -L(SSExDx)
   1092 		.int       L(SSE9Q7) -L(SSExDx)
   1093 		.int       L(SSE10Q7)-L(SSExDx)
   1094 		.int       L(SSE11Q7)-L(SSExDx)
   1095 		.int       L(SSE12Q7)-L(SSExDx)
   1096 		.int       L(SSE13Q7)-L(SSExDx)
   1097 		.int       L(SSE14Q7)-L(SSExDx)
   1098 		.int       L(SSE15Q7)-L(SSExDx)
   1099 
   1100 		.int       L(SSE0Q8) -L(SSExDx)
   1101 		.int       L(SSE1Q8) -L(SSExDx)
   1102 		.int       L(SSE2Q8) -L(SSExDx)
   1103 		.int       L(SSE3Q8) -L(SSExDx)
   1104 		.int       L(SSE4Q8) -L(SSExDx)
   1105 		.int       L(SSE5Q8) -L(SSExDx)
   1106 		.int       L(SSE6Q8) -L(SSExDx)
   1107 		.int       L(SSE7Q8) -L(SSExDx)
   1108 
   1109 		.int       L(SSE8Q8) -L(SSExDx)
   1110 		.int       L(SSE9Q8) -L(SSExDx)
   1111 		.int       L(SSE10Q8)-L(SSExDx)
   1112 		.int       L(SSE11Q8)-L(SSExDx)
   1113 		.int       L(SSE12Q8)-L(SSExDx)
   1114 		.int       L(SSE13Q8)-L(SSExDx)
   1115 		.int       L(SSE14Q8)-L(SSExDx)
   1116 		.int       L(SSE15Q8)-L(SSExDx)
   1117 
   1118 		.int       L(SSE0Q9) -L(SSExDx)
   1119 		.int       L(SSE1Q9) -L(SSExDx)
   1120 		.int       L(SSE2Q9) -L(SSExDx)
   1121 		.int       L(SSE3Q9) -L(SSExDx)
   1122 		.int       L(SSE4Q9) -L(SSExDx)
   1123 		.int       L(SSE5Q9) -L(SSExDx)
   1124 		.int       L(SSE6Q9) -L(SSExDx)
   1125 		.int       L(SSE7Q9) -L(SSExDx)
   1126 
   1127 		.int       L(SSE8Q9) -L(SSExDx)
   1128 		.int       L(SSE9Q9) -L(SSExDx)
   1129 		.int       L(SSE10Q9)-L(SSExDx)
   1130 		.int       L(SSE11Q9)-L(SSExDx)
   1131 		.int       L(SSE12Q9)-L(SSExDx)
   1132 		.int       L(SSE13Q9)-L(SSExDx)
   1133 		.int       L(SSE14Q9)-L(SSExDx)
   1134 		.int       L(SSE15Q9)-L(SSExDx)
   1135 
   1136 		.int       L(SSE0QA) -L(SSExDx)
   1137 		.int       L(SSE1QA) -L(SSExDx)
   1138 		.int       L(SSE2QA) -L(SSExDx)
   1139 		.int       L(SSE3QA) -L(SSExDx)
   1140 		.int       L(SSE4QA) -L(SSExDx)
   1141 		.int       L(SSE5QA) -L(SSExDx)
   1142 		.int       L(SSE6QA) -L(SSExDx)
   1143 		.int       L(SSE7QA) -L(SSExDx)
   1144 
   1145 		.int       L(SSE8QA) -L(SSExDx)
   1146 		.int       L(SSE9QA) -L(SSExDx)
   1147 		.int       L(SSE10QA)-L(SSExDx)
   1148 		.int       L(SSE11QA)-L(SSExDx)
   1149 		.int       L(SSE12QA)-L(SSExDx)
   1150 		.int       L(SSE13QA)-L(SSExDx)
   1151 		.int       L(SSE14QA)-L(SSExDx)
   1152 		.int       L(SSE15QA)-L(SSExDx)
   1153 
   1154 		.int       L(SSE0QB) -L(SSExDx)
   1155 		.int       L(SSE1QB) -L(SSExDx)
   1156 		.int       L(SSE2QB) -L(SSExDx)
   1157 		.int       L(SSE3QB) -L(SSExDx)
   1158 		.int       L(SSE4QB) -L(SSExDx)
   1159 		.int       L(SSE5QB) -L(SSExDx)
   1160 		.int       L(SSE6QB) -L(SSExDx)
   1161 		.int       L(SSE7QB) -L(SSExDx)
   1162 
   1163 		.int       L(SSE8QB) -L(SSExDx)
   1164 		.int       L(SSE9QB) -L(SSExDx)
   1165 		.int       L(SSE10QB)-L(SSExDx)
   1166 		.int       L(SSE11QB)-L(SSExDx)
   1167 		.int       L(SSE12QB)-L(SSExDx)
   1168 		.int       L(SSE13QB)-L(SSExDx)
   1169 		.int       L(SSE14QB)-L(SSExDx)
   1170 		.int       L(SSE15QB)-L(SSExDx)
   1171 
   1172 		SET_SIZE(memset)
   1173