b08661
--- ceph-15.2.2/src/common/crc32c_intel_fast_zero_asm.s.orig	2020-05-26 08:34:32.226201974 -0400
b08661
+++ ceph-15.2.2/src/common/crc32c_intel_fast_zero_asm.s	2020-05-26 17:19:32.497201974 -0400
b08661
@@ -1,5 +1,5 @@
b08661
 ;
b08661
-; Copyright 2012-2013 Intel Corporation All Rights Reserved.
b08661
+; Copyright 2012-2015 Intel Corporation All Rights Reserved.
b08661
 ; All rights reserved.
b08661
 ;
b08661
 ; http://opensource.org/licenses/BSD-3-Clause
b08661
@@ -59,6 +59,19 @@
b08661
 	xor     rbx, rbx                ;; rbx = crc1 = 0;
b08661
 	xor     r10, r10                ;; r10 = crc2 = 0;
b08661
 
b08661
+	cmp	len, %%bSize*3*2
b08661
+	jbe	%%non_prefetch
b08661
+
b08661
+ %assign i 0
b08661
+ %rep %%bSize/8 - 1
b08661
+	crc32   rax, bufptmp  ;; update crc0
b08661
+	crc32   rbx, bufptmp  ;; update crc1
b08661
+	crc32   r10, bufptmp  ;; update crc2
b08661
+	%assign i (i+8)
b08661
+ %endrep
b08661
+	jmp %%next %+ %1
b08661
+
b08661
+%%non_prefetch:
b08661
  %assign i 0
b08661
  %rep %%bSize/8 - 1
b08661
 	crc32   rax, bufptmp  ;; update crc0
b08661
@@ -66,6 +79,8 @@
b08661
 	crc32   r10, bufptmp  ;; update crc2
b08661
 	%assign i (i+8)
b08661
  %endrep
b08661
+
b08661
+%%next %+ %1:
b08661
 	crc32   rax, bufptmp  ;; update crc0
b08661
 	crc32   rbx, bufptmp  ;; update crc1
b08661
 ; SKIP  ;crc32  r10, bufptmp  ;; update crc2
b08661
@@ -180,12 +195,15 @@
b08661
 %define crc_init_dw     r8d
b08661
 %endif
b08661
 
b08661
-
b08661
+	endbranch
b08661
 	push    rdi
b08661
 	push    rbx
b08661
 
b08661
 	mov     rax, crc_init           ;; rax = crc_init;
b08661
 
b08661
+	cmp	len, 8
b08661
+	jb	less_than_8
b08661
+
b08661
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b08661
 ;; 1) ALIGN: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
b08661