]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.nasm
BaseMemoryLibSse2: Take advantage of write combining buffers
[mirror_edk2.git] / MdePkg / Library / BaseMemoryLibSse2 / X64 / SetMem16.nasm
index 90d159820aa161aae8039d7190a67e07a47a5d70..375be19313319a4e2ff693da472385a3947513d2 100644 (file)
@@ -33,7 +33,7 @@ ASM_PFX(InternalMemSetMem16):
     mov     r9, rdi\r
     xor     rcx, rcx\r
     sub     rcx, rdi\r
-    and     rcx, 15\r
+    and     rcx, 63\r
     mov     rax, r8\r
     jz      .0\r
     shr     rcx, 1\r
@@ -43,15 +43,18 @@ ASM_PFX(InternalMemSetMem16):
     rep     stosw\r
 .0:\r
     mov     rcx, rdx\r
-    and     edx, 7\r
-    shr     rcx, 3\r
+    and     edx, 31\r
+    shr     rcx, 5\r
     jz      @SetWords\r
     movd    xmm0, eax\r
     pshuflw xmm0, xmm0, 0\r
     movlhps xmm0, xmm0\r
 .1:\r
     movntdq [rdi], xmm0\r
-    add     rdi, 16\r
+    movntdq [rdi + 16], xmm0\r
+    movntdq [rdi + 32], xmm0\r
+    movntdq [rdi + 48], xmm0\r
+    add     rdi, 64\r
     loop    .1\r
     mfence\r
 @SetWords:\r