1 ;------------------------------------------------------------------------------
3 ; Copyright (c) 2007, 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
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.
22 ;------------------------------------------------------------------------------
29 ;------------------------------------------------------------------------------
36 ;------------------------------------------------------------------------------
38 mov edx, [esp + 16] ; edx <- Count
39 cmp edx, 0 ; if Count == 0, do nothing
41 mov edi, [esp + 8] ; edi <- Buffer
42 mov al, [esp + 12] ; al <- Value
45 and ecx, 15 ; ecx + edi aligns on 16-byte boundary
54 shr ecx, 4 ; ecx <- # of DQwords to set
56 mov ah, al ; ax <- Value | (Value << 8)
59 pshuflw xmm0, xmm0, 0 ; xmm0[0..63] <- Value repeats 8 times
60 movlhps xmm0, xmm0 ; xmm0 <- Value repeats 16 times
62 movdqa [edi], xmm0 ; edi should be 16-byte aligned
65 add esp, 16 ; stack cleanup
70 mov eax, [esp + 8] ; eax <- Buffer as return value