Re: [BUG] PPC math-emu multiply problem

From: Greg Weeks
Date: Fri Jul 30 2004 - 09:48:17 EST


Dan Malek wrote:


On Jul 29, 2004, at 10:06 AM, Kumar Gala wrote:


On Jul 29, 2004, at 8:14 AM, Greg Weeks wrote:

I'm seeing what appears to be a bug in the ppc kernel trap math
emulator. An extreme case for multiplies isn't working the way gcc
soft-float or hardware floating point is.


I'm not surprised. I lifted this code from Sparc, glibc, and adapted
it as best I could for PPC years ago for the 8xx. I was happy when
it appeared to work for the general cases. :-)

Due to its overhead, I never expected it to be _the_ solution for
processors that don't have floating point hardware. Recompiling
the libraries with soft-float and using that option when compiling
is the way to go.

OK, this patch fixes my multiply problem with the LSB test. I still need to test to make sure I didn't break anything else, but it appears the rounding is only used when converting back to IEEE format. Is there some reason this is something really dumb to do?

Signed-off-by: Greg Weeks <greg.weeks@xxxxxxxxxxx> under TS0087

--- tanith-linux-2.6.6/arch/ppc/math-emu/soft-fp.h.orig 2004-07-30 10:31:34.000000000 -0400
+++ tanith-linux-2.6.6/arch/ppc/math-emu/soft-fp.h 2004-07-30 10:31:57.000000000 -0400
@@ -15,7 +15,7 @@
# define FP_RND_PINF 2
# define FP_RND_MINF 3
#ifndef FP_ROUNDMODE
-# define FP_ROUNDMODE FP_RND_NEAREST
+# define FP_ROUNDMODE FP_RND_ZERO
#endif
#endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/