summaryrefslogtreecommitdiff
path: root/sys/lib
diff options
context:
space:
mode:
authoruch <uch@NetBSD.org>2001-10-16 15:40:53 +0000
committeruch <uch@NetBSD.org>2001-10-16 15:40:53 +0000
commit07f8f33bb94c1de9e1c8cf4ee075e9cd4cfa46f8 (patch)
treea931877b0584fd15e6c875b927c52092aeed1e44 /sys/lib
parent2fa5ea97206886a453eeb250cb19b80360181347 (diff)
R5900 miss-prediction of branch targets for short-loop.
Diffstat (limited to 'sys/lib')
-rw-r--r--sys/lib/libkern/arch/mips/memcpy.S16
-rw-r--r--sys/lib/libkern/arch/mips/memset.S14
2 files changed, 28 insertions, 2 deletions
diff --git a/sys/lib/libkern/arch/mips/memcpy.S b/sys/lib/libkern/arch/mips/memcpy.S
index 68ad2e1f569..2a391516262 100644
--- a/sys/lib/libkern/arch/mips/memcpy.S
+++ b/sys/lib/libkern/arch/mips/memcpy.S
@@ -1,4 +1,4 @@
-/* $NetBSD: memcpy.S,v 1.6 2000/10/10 20:29:03 jeffs Exp $ */
+/* $NetBSD: memcpy.S,v 1.7 2001/10/16 15:40:53 uch Exp $ */
/* XXXX We need to define this in a way which supports multiple architectures */
#include <machine/cdefs.h> /* Get SZREG correct */
@@ -126,6 +126,10 @@ wordcopy:
lw t3,0(a1)
addu a1,4
sw t3,0(a0)
+#ifdef MIPS3_5900
+ nop
+ nop
+#endif
bne a1,t0,1b
addu a0,4 # BDSLOT
@@ -137,6 +141,9 @@ bytecopy:
addu a1,1
sb t3,0(a0)
subu a2,1
+#ifdef MIPS3_5900
+ nop
+#endif
bgtz a2,2b
addu a0,1 # BDSLOT
@@ -158,6 +165,9 @@ destaligned:
LWLO t3,3(a1)
addi a1,4
sw t3,0(a0)
+#ifdef MIPS3_5900
+ nop
+#endif
bne a1,a3,3b
addi a0,4 # BDSLOT
@@ -175,6 +185,10 @@ backcopy:
lb t3,-1(t0)
subu t0,1
sb t3,-1(t1)
+#ifdef MIPS3_5900
+ nop
+ nop
+#endif
bne t0,a1,4b
subu t1,1 # BDSLOT
j ra
diff --git a/sys/lib/libkern/arch/mips/memset.S b/sys/lib/libkern/arch/mips/memset.S
index f8e617c6e6f..ba6530ae9de 100644
--- a/sys/lib/libkern/arch/mips/memset.S
+++ b/sys/lib/libkern/arch/mips/memset.S
@@ -1,4 +1,4 @@
-/* $NetBSD: memset.S,v 1.2 1999/03/15 06:34:10 jonathan Exp $ */
+/* $NetBSD: memset.S,v 1.3 2001/10/16 15:40:53 uch Exp $ */
#include <machine/cdefs.h>
#include <mips/asm.h>
#include <machine/endian.h>
@@ -32,6 +32,12 @@ LEAF(memset)
addu t0, t0, a0 # compute ending address
2:
addu a0, a0, 4 # clear words
+#ifdef MIPS3_5900
+ nop
+ nop
+ nop
+ nop
+#endif
bne a0, t0, 2b # unrolling loop does not help
sw t1, -4(a0) # since we are limited by memory speed
@@ -40,6 +46,12 @@ smallclr:
addu t0, a2, a0 # compute ending address
1:
addu a0, a0, 1 # clear bytes
+#ifdef MIPS3_5900
+ nop
+ nop
+ nop
+ nop
+#endif
bne a0, t0, 1b
sb a1, -1(a0)
2: