ARCv2: memset: don't prefetch for len == 0 which happens a alot
authorVineet Gupta <vgupta@kernel.org>
Fri, 7 Feb 2020 20:27:02 +0000 (12:27 -0800)
committerVineet Gupta <vgupta@kernel.org>
Thu, 17 Aug 2023 19:40:26 +0000 (12:40 -0700)
This avoids potential "bleeding" when size == 0 as cache line would be
dirtied (and possibly fetched from other cores) and due to the same
reaons more optimal too.

Signed-off-by: Vineet Gupta <vgupta@kernel.org>
arch/arc/lib/memset-archs.S

index d2e09fe..d0a5cec 100644 (file)
 #endif
 
 ENTRY_CFI(memset)
-       PREFETCHW_INSTR r0, 0   ; Prefetch the first write location
        mov.f   0, r2
 ;;; if size is zero
        jz.d    [blink]
        mov     r3, r0          ; don't clobber ret val
 
+       PREFETCHW_INSTR r0, 0   ; Prefetch the first write location
+
 ;;; if length < 8
        brls.d.nt       r2, 8, .Lsmallchunk
        mov.f   lp_count,r2