Port-alpha archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
fpgetround/fpsetround do not work
Hi,
I just had soe more time to look into the failures or regression test
for -current NetBSD/alpha i run from time to time on a PWS500au
machine (available at http://www.netbsd.org/~njoly/alpha-atf/).
Checking the lib/libc/ieeefp/t_round/fpround test show that
fpgetround/fpsetround do not work as expected, but FLT_ROUNDS do.
njoly@thanos [~]> /usr/tests/lib/libc/ieeefp/t_round fpround
*** Check failed: /local/src/NetBSD/src/tests/lib/libc/ieeefp/t_round.c:41:
fpgetround() != FP_RN
*** Check failed: /local/src/NetBSD/src/tests/lib/libc/ieeefp/t_round.c:64:
fpsetround(FP_RN) != FP_RN
*** Check failed: /local/src/NetBSD/src/tests/lib/libc/ieeefp/t_round.c:67:
fpgetround() != FP_RN
Lokking into the respective code show that both functions
(lib/libc/arch/alpha/gen/{flt_rounds,fpgetround}.c) use the same
code except for trapb operands which where removed in 2001.
Adding back the trapb ops to fpgetround()/fpsetround() make it work as
expected.
njoly@thanos [~]> /usr/tests/lib/libc/ieeefp/t_round fpround
passed
Any reason to not commit the attached patch ?
Thanks.
--
Nicolas Joly
Projects and Developments in Bioinformatics
Institut Pasteur, Paris.
Index: lib/libc/arch/alpha/gen/fpgetround.c
===================================================================
RCS file: /cvsroot/src/lib/libc/arch/alpha/gen/fpgetround.c,v
retrieving revision 1.9
diff -u -p -r1.9 fpgetround.c
--- lib/libc/arch/alpha/gen/fpgetround.c 24 Dec 2005 23:10:08 -0000
1.9
+++ lib/libc/arch/alpha/gen/fpgetround.c 11 Jun 2011 10:16:30 -0000
@@ -54,7 +54,9 @@ fpgetround()
double fpcrval;
u_int64_t old;
+ __asm("trapb");
__asm("mf_fpcr %0" : "=f" (fpcrval));
+ __asm("trapb");
old = *(u_int64_t *)(void *)&fpcrval;
return ((old >> 58) & 0x3);
Index: lib/libc/arch/alpha/gen/fpsetround.c
===================================================================
RCS file: /cvsroot/src/lib/libc/arch/alpha/gen/fpsetround.c,v
retrieving revision 1.10
diff -u -p -r1.10 fpsetround.c
--- lib/libc/arch/alpha/gen/fpsetround.c 24 Dec 2005 23:10:08 -0000
1.10
+++ lib/libc/arch/alpha/gen/fpsetround.c 11 Jun 2011 10:16:30 -0000
@@ -55,16 +55,18 @@ fpsetround(rnd_dir)
double fpcrval;
u_int64_t old, new;
- __asm("excb");
+ __asm("trapb");
__asm("mf_fpcr %0" : "=f" (fpcrval));
+ __asm("trapb");
old = *(u_int64_t *)(void *)&fpcrval;
new = old & ~(long)0x0c00000000000000;
new = (long)rnd_dir << 58;
*(u_int64_t *)(void *)&fpcrval = new;
+ __asm("trapb");
__asm("mt_fpcr %0" : : "f" (fpcrval));
- __asm("excb");
+ __asm("trapb");
return ((old >> 58) & 0x3);
}
Home |
Main Index |
Thread Index |
Old Index