[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problem with the MiNT library, -m68020
I recently was working with a program that uses floating point math.
I discovered that it worked correctly if compiled without -m68020, but
if compiled with -m68020 -lgnu020, I got some really strange behavior:
int
main()
{
double d;
int i = 200;
d = (double) i;
printf("%f\n", d);
}
...yields output of 0.0.
The problem seems to be in the 68881 version of the __floatsidf
routine. The following patch seems to cure my problem. However, the
solution provided here is based on GUESSWORK: I do not have a manual
for the 68881 and I do not really know what order GCC expects to find
the return values in d0,d1. My guess was based only on the fact that
the SFP version of the code loads d0 first and then d1, whereas the
68881 version uses a moveml to d0-d1 (which loads d1 first and then
d0). This may be irrelevant, but it's all I had to work with. Could
someone with more docs and more of a clue look into this? I think the
problem may affect several other conversion routines as well.
Cheers,
entropy
--- 45.1 1994/07/17 10:49:40
+++ _fltsi.cpp 1994/08/12 17:04:14
@@ -15,7 +15,8 @@
|
fintrzd a7@(4),fp0 | load long int to fp0
fmoved fp0,a7@- | get double from fp0
- moveml a7@+,d0-d1
+ movel a7@+,d0
+ movel a7@+,d1
rts
#endif __M68881__
--
entropy -- it's not just a good idea, it's the second law.
Personal mail: entropy@gnu.ai.mit.edu
MiNT library mail: entropy@terminator.rs.itd.umich.edu
"what do you have against octal?" -jrb