]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S
unify the name convention of label in .S files
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / X64 / SetMem.S
CommitLineData
4df876ad 1#
2# ConvertAsm.py: Automatically generated from SetMem.asm
3#
4#------------------------------------------------------------------------------
5#
6# Copyright (c) 2006, Intel Corporation
7# All rights reserved. This program and the accompanying materials
8# are licensed and made available under the terms and conditions of the BSD License
9# which accompanies this distribution. The full text of the license may be found at
10# http://opensource.org/licenses/bsd-license.php
11#
12# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14#
15# Module Name:
16#
17# SetMem.S
18#
19# Abstract:
20#
21# SetMem function
22#
23# Notes:
24#
25#------------------------------------------------------------------------------
26
27
28#------------------------------------------------------------------------------
29# VOID *
30# EFIAPI
31# InternalMemSetMem (
32# IN VOID *Buffer,
33# IN UINTN Count,
34# IN UINT8 Value
35# )
36#------------------------------------------------------------------------------
37.intel_syntax noprefix
38.globl ASM_PFX(InternalMemSetMem)
39ASM_PFX(InternalMemSetMem):
40 push rdi
41 mov rdi, rcx # rdi <- Buffer
42 mov al, r8b # al <- Value
43 mov r9, rdi # r9 <- Buffer as return value
44 xor rcx, rcx
45 sub rcx, rdi
46 and rcx, 15 # rcx + rdi aligns on 16-byte boundary
47 jz L0
48 cmp rcx, rdx
49 cmova rcx, rdx
50 sub rdx, rcx
51 rep stosb
52L0:
53 mov rcx, rdx
54 and rdx, 15
55 shr rcx, 4
852f5d96 56 jz L_SetBytes
4df876ad 57 mov ah, al # ax <- Value repeats twice
852f5d96 58 movdqa [rsp + 0x10], xmm0 # save xmm0
4df876ad 59 movd xmm0, eax # xmm0[0..16] <- Value repeats twice
60 pshuflw xmm0, xmm0, 0 # xmm0[0..63] <- Value repeats 8 times
61 movlhps xmm0, xmm0 # xmm0 <- Value repeats 16 times
62L1:
63 movntdq [rdi], xmm0 # rdi should be 16-byte aligned
64 add rdi, 16
65 loop L1
66 mfence
852f5d96 67 movdqa xmm0, [rsp + 0x10] # restore xmm0
68L_SetBytes:
4df876ad 69 mov ecx, edx # high 32 bits of rcx are always zero
70 rep stosb
71 mov rax, r9 # rax <- Return value
72 pop rdi
73 ret