Re: mpc8xx fpu emu

2 messages, 2 authors, 2002-09-11 · open the first message on its own page

Re: mpc8xx fpu emu

From: Alban Wood <hidden>
Date: 2002-09-11 19:38:48

I forgot to mention that I was able to verify that the floating point
emulator *works*. I examined the result of a floating point division in
memory and it was valid. So I guess it is the libc I am using. Like I
said, could it be that it was compiled with -msoft-float?

I'm also not sure I can draw conclusions from the following fact, but I
disassembled the libc used on the board, and found no floating point
instructions. I did the same with a libc on a powerpc 604 I have here, and
did find floating point instructions.

Regards,

Alban



Alban Wood wrote:
hello,

Regarding my problem, I searched the list archives and did found some
mpu
emul related posts but they were not exactly like my case.

Basically, I have an RPX Lite-M board. The mpc850 does not have an fpu,
but I have a need for non-intensive fpu operations. I don't want to
compile applications and librairies with -msoft-float - for my needs the
fpu emulator is really the way to go.

The board successfully boots a slightly modified linux 2.4.9. I've
compiled the kernel with and without math emulation.

I also compiled a very simple application that does a floating point
division and prints it. I explicitly specified -msoft-hard. (same with
the
kernel btw), checked out the resulting assembly and did in fact find an
fdiv instruction.

Without the emulation, executing the program results in a floating point
exception. This is normal.

With the math emu kernel, the exception is caught and seemingly handled
as
it should. However, a printf of a float results in "nan" (not a number).

If I invoke the printf binary (printf "%f\n" 43.34343) it is able to
print
a float.

I didn't compile my own toolchain. I switch between the binary
distributions I got from www.qslinux.org and timesys. I'm not sure this
is
a good idea.

Any ideas as to what could be wrong? Could it be that the libs in the
root
filesystem I'm using for the board were compiled with -msoft-float,  and
that as a result printf cannot properly output a float? (even though
it's
been properly handled by the fpu emulator?)


Thank you,


Alban


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

Re: mpc8xx fpu emu

From: Conn Clark <hidden>
Date: 2002-09-11 21:42:37

Hello Alban,

	Unfortunatly the ppc code generated by the -msoft-float option does not
pass values in the same way as code generated for a chip with a fpu or a kernel
with fpu emulation. This is done to get a boost in speed on fpuless chips. This
renders software/libraries compiled one way to not be compatible with stuff
compiled the other way when passing floating point values(Note: there are some
cases where they will work correctly together).

	The -msoft-float option does not increase executable/library size in
any signifigant way and provides a signifigant speed boost. Also a few people
say that the fpu emulation code in the kernel is buggy. The -msoft-float has
become the default way things are done on the fpuless Motorola 8xx family for
these reasons.

	This means you must compile everything (and I mean everything) to use
-msoft-float or compile everything to use the fpu. So if you are not interested
in building and maintaining your own tool chain and possibly squishing some fpu
emulation bugs, you are better off using -msoft-float like everybody else.

Hope this answers your question.

	Conn
--

*****************************************************************
  If you live at home long enough, your parents will move out.
 (Warning they may try to sell their house out from under you.)
*****************************************************************

Conn Clark
Engineering Stooge				clark@esteem.com
Electronic Systems Technology Inc.		www.esteem.com


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help