]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseMemoryLibSse2/x64/SetMem16.asm
a2f4d0e53856886d0508b645b6894cd173bbe7db
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / x64 / SetMem16.asm
1 ;------------------------------------------------------------------------------
2 ;
3 ; Copyright (c) 2006, Intel Corporation
4 ; All rights reserved. This program and the accompanying materials
5 ; are licensed and made available under the terms and conditions of the BSD License
6 ; which accompanies this distribution. The full text of the license may be found at
7 ; http://opensource.org/licenses/bsd-license.php
8 ;
9 ; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 ; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 ;
12 ; Module Name:
13 ;
14 ; SetMem16.asm
15 ;
16 ; Abstract:
17 ;
18 ; SetMem16 function
19 ;
20 ; Notes:
21 ;
22 ;------------------------------------------------------------------------------
23
24 .code
25
26 ;------------------------------------------------------------------------------
27 ; VOID *
28 ; _mem_SetMem16 (
29 ; IN VOID *Buffer,
30 ; IN UINTN Count,
31 ; IN UINT16 Value
32 ; )
33 ;------------------------------------------------------------------------------
34 InternalMemSetMem16 PROC USES rdi
35 mov rdi, rcx
36 mov r9, rdi
37 xor rcx, rcx
38 sub rcx, rdi
39 and rcx, 15
40 mov rax, r8
41 jz @F
42 shr rcx, 1
43 cmp rcx, rdx
44 cmova rcx, rdx
45 sub rdx, rcx
46 rep stosw
47 @@:
48 mov rcx, rdx
49 and edx, 7
50 shr rcx, 3
51 jz @SetWords
52 movd xmm0, eax
53 pshuflw xmm0, xmm0, 0
54 movlhps xmm0, xmm0
55 @@:
56 movntdq [rdi], xmm0
57 add rdi, 16
58 loop @B
59 mfence
60 @SetWords:
61 mov ecx, edx
62 rep stosw
63 mov rax, r9
64 ret
65 InternalMemSetMem16 ENDP
66
67 END