FIX: floating point values not returned correctly on the ARM

Raffaele Sena raff at aromatic.com
Tue Jan 5 16:39:03 PST 1999


On Sun, 3 Jan 1999, Dirk Grunwald wrote:

> The following tests failed...
> 
> class domath{
>   public static void main (String args[]) {
>     System.out.println("Hello World!");
>     System.out.println("Sqrt(10) is " + java.lang.Math.sqrt(10));
>     System.out.println("sin(10) is " + java.lang.Math.sin(10));
>   }
> }
> 
> also, when you run "TestNative" from the regression directory, it
> fails as well. There's still one anomoly that I haven't figured out in
> with TestNative (actually, a modified JNI version). The last test
> 
> 	d = test16floatdouble(
> 	  -1.2f, 0.2, 3.3, 4.5, 5.6, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
> 
	...

I simplified a little Dirk's patch, and it seems to work both on the
test case and TestNative.java (I don't see the other errors reported by
Dirk). Can these changes be integrated ? 

Thanks,
	Raffaele

------------------------ 8< CUT HERE >8 ----------------------
Index: common.h
===================================================================
RCS file: /home/cvspublic/kaffe/config/arm/common.h,v
retrieving revision 1.3
diff -r1.3 common.h
38c38
<     int *res;								\
---
>     register double f0 asm("f0");                                       \
78,79c78,79
< 	  mov pc, %2\n"							\
<         : "=r" (r0), "=r" (r1)						\
---
> 	  mov pc, %3\n"							\
>         : "=r" (r0), "=r" (r1), "=f" (f0)				\
84,86c84,97
<     res = (int *)(CALL)->ret; 						\
<     res[0] = r0; 							\
<     res[1] = r1; 							\
---
>     switch((CALL)->rettype)    						\
>     {									\
>     case 'D':								\
>         asm("stfd %1,%0" : "=m" ((CALL)->ret->d) : "f" (f0));		\
> 	break;								\
>     case 'F':								\
> 	asm("stfs %1,%0" : "=m" ((CALL)->ret->f) : "f" (f0));		\
> 	break;								\
>     case 'J':								\
> 	(&(CALL)->ret->i)[1] = r1;					\
> 	/* follow through */						\
>     default:								\
> 	(CALL)->ret->i = r0;						\
>     }									\
89c100
< } while (0)								\
---
> } while (0)

-------------------------------------------------------------------------
raff at aromatic.com           (::)           http://www.aromatic.com/~raff/
                  http://www.aromatic.com/



More information about the kaffe mailing list