1 ;------------------------------------------------------------------------------
3 ; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 ; SPDX-License-Identifier: BSD-2-Clause-Patent
16 ;------------------------------------------------------------------------------
21 ;------------------------------------------------------------------------------
28 ;------------------------------------------------------------------------------
29 global ASM_PFX(InternalMemSetMem)
30 ASM_PFX(InternalMemSetMem):
32 mov rdi, rcx ; rdi <- Buffer
33 mov al, r8b ; al <- Value
34 mov r9, rdi ; r9 <- Buffer as return value
37 and rcx, 15 ; rcx + rdi aligns on 16-byte boundary
48 mov ah, al ; ax <- Value repeats twice
49 movdqa [rsp + 0x10], xmm0 ; save xmm0
50 movd xmm0, eax ; xmm0[0..16] <- Value repeats twice
51 pshuflw xmm0, xmm0, 0 ; xmm0[0..63] <- Value repeats 8 times
52 movlhps xmm0, xmm0 ; xmm0 <- Value repeats 16 times
54 movntdq [rdi], xmm0 ; rdi should be 16-byte aligned
58 movdqa xmm0, [rsp + 0x10] ; restore xmm0
60 mov ecx, edx ; high 32 bits of rcx are always zero
62 mov rax, r9 ; rax <- Return value