summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2013-06-05 22:48:22 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2013-06-05 22:48:22 +0000
commit2ed8dbc6a7f4008a0c24b5218993aea44051d01a (patch)
tree8f625762547398b2dcf535f499ef970f8a0e41ec /lib/libc
parent6c97d3f46eff8dbdc0dcb1d750a8d663af01cc9f (diff)
On second thought, do not use a tcnd instruction to test for divide-by-zero,
as it forces a pipeline synchronization; replace it with a bcnd + unconditional trap, to only synchronize when the trap is needed.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/arch/m88k/gen/divsi3.S6
-rw-r--r--lib/libc/arch/m88k/gen/modsi3.S8
-rw-r--r--lib/libc/arch/m88k/gen/udivsi3.S6
-rw-r--r--lib/libc/arch/m88k/gen/umodsi3.S6
4 files changed, 17 insertions, 9 deletions
diff --git a/lib/libc/arch/m88k/gen/divsi3.S b/lib/libc/arch/m88k/gen/divsi3.S
index 5c096e16e9c..09da2607c82 100644
--- a/lib/libc/arch/m88k/gen/divsi3.S
+++ b/lib/libc/arch/m88k/gen/divsi3.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: divsi3.S,v 1.2 2013/06/05 22:06:30 miod Exp $ */
+/* $OpenBSD: divsi3.S,v 1.3 2013/06/05 22:48:21 miod Exp $ */
/*
* Copyright (c) 2013 Miodrag Vallat.
@@ -28,7 +28,9 @@
#endif
ENTRY(__divsi3)
/* if divider is zero, trap */
- tcnd eq0, %r3, 503
+ bcnd ne0, %r3, 1f
+ tb0 0, %r0, 503
+1:
bb1 31, %r2, 1f
bb1 31, %r3, 2f
diff --git a/lib/libc/arch/m88k/gen/modsi3.S b/lib/libc/arch/m88k/gen/modsi3.S
index 4491370d9a6..dee1779a7dd 100644
--- a/lib/libc/arch/m88k/gen/modsi3.S
+++ b/lib/libc/arch/m88k/gen/modsi3.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: modsi3.S,v 1.1 2013/06/05 22:06:30 miod Exp $ */
+/* $OpenBSD: modsi3.S,v 1.2 2013/06/05 22:48:21 miod Exp $ */
/*
* Copyright (c) 2013 Miodrag Vallat.
@@ -28,7 +28,9 @@
#endif
ENTRY(__modsi3)
/* if divider is zero, trap */
- tcnd eq0, %r3, 503
+ bcnd ne0, %r3, 1f
+ tb0 0, %r0, 503
+1:
bb1 31, %r2, 1f
bb1 31, %r3, 2f
@@ -36,7 +38,7 @@ ENTRY(__modsi3)
/* both operands are positive */
divu %r4, %r2, %r3
9:
- mulu %r5, %r4, %r3
+ mul %r5, %r4, %r3
jmp.n %r1
subu %r2, %r2, %r5
diff --git a/lib/libc/arch/m88k/gen/udivsi3.S b/lib/libc/arch/m88k/gen/udivsi3.S
index ff7abf7b5ed..bc776bfc25b 100644
--- a/lib/libc/arch/m88k/gen/udivsi3.S
+++ b/lib/libc/arch/m88k/gen/udivsi3.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: udivsi3.S,v 1.2 2013/06/05 22:06:30 miod Exp $ */
+/* $OpenBSD: udivsi3.S,v 1.3 2013/06/05 22:48:21 miod Exp $ */
/*
* Copyright (c) 2013 Miodrag Vallat.
@@ -28,7 +28,9 @@
#endif
ENTRY(__udivsi3)
/* if divider is zero, trap */
- tcnd eq0, %r3, 503
+ bcnd ne0, %r3, 1f
+ tb0 0, %r0, 503
+1:
jmp.n %r1
divu %r2, %r2, %r3
diff --git a/lib/libc/arch/m88k/gen/umodsi3.S b/lib/libc/arch/m88k/gen/umodsi3.S
index 2cbdf86ec84..701bff893b1 100644
--- a/lib/libc/arch/m88k/gen/umodsi3.S
+++ b/lib/libc/arch/m88k/gen/umodsi3.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: umodsi3.S,v 1.1 2013/06/05 22:06:30 miod Exp $ */
+/* $OpenBSD: umodsi3.S,v 1.2 2013/06/05 22:48:21 miod Exp $ */
/*
* Copyright (c) 2013 Miodrag Vallat.
@@ -28,7 +28,9 @@
#endif
ENTRY(__umodsi3)
/* if divider is zero, trap */
- tcnd eq0, %r3, 503
+ bcnd ne0, %r3, 1f
+ tb0 0, %r0, 503
+1:
divu %r4, %r2, %r3
mulu %r5, %r4, %r3