Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/arch/i386/gen add a simpler version
details: https://anonhg.NetBSD.org/src/rev/bba9326cd26c
branches: trunk
changeset: 769999:bba9326cd26c
user: christos <christos%NetBSD.org@localhost>
date: Thu Sep 29 22:46:00 2011 +0000
description:
add a simpler version
diffstat:
lib/libc/arch/i386/gen/flt_rounds.S | 39 ++++++++++++------------------------
1 files changed, 13 insertions(+), 26 deletions(-)
diffs (50 lines):
diff -r f4950de8fa4f -r bba9326cd26c lib/libc/arch/i386/gen/flt_rounds.S
--- a/lib/libc/arch/i386/gen/flt_rounds.S Thu Sep 29 22:45:20 2011 +0000
+++ b/lib/libc/arch/i386/gen/flt_rounds.S Thu Sep 29 22:46:00 2011 +0000
@@ -1,33 +1,20 @@
-/* $NetBSD: flt_rounds.S,v 1.6 1999/08/23 08:45:09 kleink Exp $ */
-
-/*
- * Written by J.T. Conklin, Apr 4, 1995
- * Public domain.
- */
+/* $NetBSD: flt_rounds.S,v 1.7 2011/09/29 22:46:00 christos Exp $ */
#include <machine/asm.h>
+/*
+ * 00 0 round to zero
+ * 01 1 round to nearest
+ * 10 2 round to positive infinity
+ * 11 3 round to negative infinity
+ */
.text
_ALIGN_TEXT
-_map:
- .byte 1 /* round to nearest */
- .byte 3 /* round to negative infinity */
- .byte 2 /* round to positive infinity */
- .byte 0 /* round to zero */
-
ENTRY(__flt_rounds)
- subl $4,%esp
- fnstcw (%esp)
- movl (%esp),%eax
- shrl $10,%eax
- andl $3,%eax
-#ifdef PIC
- PIC_PROLOGUE
- leal PIC_GOTOFF(_map),%ecx
- PIC_EPILOGUE
- movb (%ecx,%eax,1),%al
-#else
- movb _map(,%eax,1),%al
-#endif
- addl $4,%esp
+ fnstcw -4(%esp)
+ movl -4(%esp), %ecx
+ shrl $9, %ecx
+ andl $6, %ecx
+ xorl $1, %eax /* map 0,1,2,3 -> 1,0,3,2 */
+ andl $3, %eax
ret
Home |
Main Index |
Thread Index |
Old Index