[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-devel-list
Subject:    Re: [Mono-dev] Arm9 NS9215 floating point troubles
From:       Trevor Ackerman <t_ackerman () yahoo ! com>
Date:       2010-06-18 16:24:18
Message-ID: 690572.4752.qm () web50404 ! mail ! re2 ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


~ # cat /proc/cpuinfo 
Processor       : ARM926EJ-S rev 5 (v5l)
BogoMIPS        : 74.34
Features        : swp half fastmult edsp java 
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
CPU part        : 0x926
CPU revision    : 5

Hardware        : ConnectCore 9P 9215 on a JSCC9P9215 Devboard
Revision        : 0000
Serial          : 0000000000000000


--- On Fri, 6/18/10, Geoff Norton <gnorton@novell.com> wrote:

From: Geoff Norton <gnorton@novell.com>
Subject: Re: [Mono-dev] Arm9 NS9215 floating point troubles
To: "Trevor Ackerman" <t_ackerman@yahoo.com>
Cc: "mono-devel-list@lists.ximian.com" <mono-devel-list@lists.ximian.com>
Date: Friday, June 18, 2010, 9:41 AM

The change you posted is certainly not correct as soft float works on
all our dev boards. Could you send us the contents of /process/cpuinfo
please?


On Friday, June 18, 2010, Trevor Ackerman <t_ackerman@yahoo.com> wrote:
> I believe it is armel, here's what 'file' reports for a natively compiled C \
> program. 
> hello_world_c: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses \
> shared libs), not stripped. 
> Let me know if you still believe it is a bug and how I may contribute a solution, \
> whether the example change I posted is appropriate or not. 
> Thanks
> 
> --- On Thu, 6/17/10, Geoff Norton <gnorton@novell.com> wrote:
> 
> From: Geoff Norton <gnorton@novell.com>
> Subject: Re: [Mono-dev] Arm9 NS9215 floating point troubles
> To: "Trevor Ackerman" <t_ackerman@yahoo.com>
> Cc: mono-devel-list@lists.ximian.com
> Date: Thursday, June 17, 2010, 9:54 PM
> 
> Is your system armeb or
> armel?
> It could be a endian bug in our softfloat impl somewhere.
> -g
> On 2010-06-17, at 7:54 PM, Trevor Ackerman wrote:
> I have more to report.
> 
> I wrote a quick native C program to print out the bytes of a float and double \
> variable that were assigned the literal value 1.0f. 
> Then in the mono 2.6.4 routine mono_method_to_ir in source code file \
> mono/mini/method_to_ir.c I dumped out the bytes of ip (instruction pointer) used \
> for the double value in the case for CEE_LDC_R8. 
> I discovered that the bytes in the double value used on mono had the high and low \
> 32 bits swapped compared to those produced by the native C program. I hacked the \
> routine decompose_soft_float to swap the high and low words and now I have no \
> troubles and the basic-float regression test passes 100%. 
> Although this happens to work, I have a hard time believing that this is the \
> correct solution to my problem. I feel that others are probably using ARM9 without \
> floating point issues and that I am probably missing something in how I built mono \
> for my platform. If anyone can shed some light on what I did wrong with building \
> mono that'd be great. Of course if this is the correct action to take please let me \
> know that too and how I may contribute the change back to the trunk (assuming that \
> the trunk doesn't work which I haven't had time to test yet). 
> In the meantime here's my hack to decompose_soft_float in method-to-ir.c
> 
> 
> 5073                 case OP_R8CONST: {
> 5074             unsigned char *ucp = (unsigned char *) ins->inst_p0;
> 5075             unsigned char
> rawval[8];
> 5076                     printf("decompose_soft_float OP_R8CONST\n");
> 5077             rawval[0] =
> ucp[4];
> 5078             rawval[1] = ucp[5];
> 5079             rawval[2] = ucp[6];
> 5080             rawval[3] = ucp[7];
> 5081             rawval[4] = ucp[0];
> 5082             rawval[5] = ucp[1];
> 5083             rawval[6] = ucp[2];
> 5084             rawval[7] = ucp[3];
> 5085                     DVal d;
> 5086
> //                  d.vald = *(double*)ins->inst_p0;
> 5087                     d.vald = *(double*)rawval;
> 5088                     MONO_EMIT_NEW_I8CONST (cfg, ins->dreg, d.vall);
> 5089                     break;
> 5090                 }
> 
> --- On Thu, 6/17/10, Trevor Ackerman <t_ackerman@yahoo.com \
> <http://mc/compose?to=t_ackerman@yahoo.com>> wrote: 
> From: Trevor Ackerman
> <t_ackerman@yahoo.com <http://mc/compose?to=t_ackerman@yahoo.com>>
> Subject: Re: [Mono-dev] Arm9 NS9215 floating point troubles
> To: mono-devel-list@lists.ximian.com
> Date: Thursday, June 17, 2010, 11:31 AM
> 
> Good suggestion but that did not change the results.
> 
> --- On Thu, 6/17/10, Robert Jordan <robertj@gmx.net \
> <http://mc/compose?to=robertj@gmx.net>> wrote: 
> From: Robert Jordan <robertj@gmx.net <http://mc/compose?to=robertj@gmx.net>>
> Subject: Re: [Mono-dev] Arm9 NS9215 floating point troubles
> To: mono-devel-list@lists.ximian.com
> Date: Thursday, June 17, 2010, 10:53 AM
> 
> On 17.06.2010 18:07, Trevor Ackerman wrote:
> > I have been able to cross-compile Mono 2.6.4 for the NS9215 (no fpu
> > afaik) and I'm having trouble with floats when executing
> code.
> 
> ...
> 
> > My CFLAGS and CPPFLAGS environment variables are
> > both
> > -DARM_FPU_NONE=1 -DMONO_ARCH_SOFT_FLOAT=1
> 
> -DNO_UNALIGNED_ACCESS is probably needed as
> well.
> 
> Robert
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 
> 
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> <http://lists.ximian.com/mailman/listinfo/mono-devel-list>
> 



      


[Attachment #5 (text/html)]

<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: \
inherit;">~ # cat /proc/cpuinfo <br>Processor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : \
ARM926EJ-S rev 5 (v5l)<br>BogoMIPS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : \
74.34<br>Features&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : swp half fastmult edsp \
java <br>CPU implementer : 0x41<br>CPU architecture: 5TEJ<br>CPU \
variant&nbsp;&nbsp;&nbsp;&nbsp; : 0x0<br>CPU \
part&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 0x926<br>CPU \
revision&nbsp;&nbsp;&nbsp; : \
5<br><br>Hardware&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : ConnectCore 9P 9215 on \
a JSCC9P9215 Devboard<br>Revision&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : \
0000<br>Serial&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : \
0000000000000000<br><br><br>--- On <b>Fri, 6/18/10, Geoff Norton \
<i>&lt;gnorton@novell.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px \
solid rgb(16, 16, 255); margin-left: 5px;  padding-left: 5px;"><br>From: Geoff Norton \
&lt;gnorton@novell.com&gt;<br>Subject: Re: [Mono-dev] Arm9 NS9215 floating point \
troubles<br>To: "Trevor Ackerman" &lt;t_ackerman@yahoo.com&gt;<br>Cc: \
"mono-devel-list@lists.ximian.com" &lt;mono-devel-list@lists.ximian.com&gt;<br>Date: \
Friday, June 18, 2010, 9:41 AM<br><br><div class="plainMail">The change you posted is \
certainly not correct as soft float works on<br>all our dev boards. Could you send us \
the contents of /process/cpuinfo<br>please?<br><br><br>On Friday, June 18, 2010, \
Trevor Ackerman &lt;<a ymailto="mailto:t_ackerman@yahoo.com" \
href="/mc/compose?to=t_ackerman@yahoo.com">t_ackerman@yahoo.com</a>&gt; \
wrote:<br>&gt; I believe it is armel, here's what 'file' reports for a natively \
compiled C program.<br>&gt;<br>&gt; hello_world_c: ELF 32-bit LSB executable, ARM, \
version 1, dynamically linked (uses shared libs), not stripped.<br>&gt;<br>&gt; Let \
me know if you still believe it is a bug and how I may  contribute a solution, \
whether the example change I posted is appropriate or not.<br>&gt;<br>&gt; \
Thanks<br>&gt;<br>&gt; --- On Thu, 6/17/10, Geoff Norton &lt;<a \
ymailto="mailto:gnorton@novell.com" \
href="/mc/compose?to=gnorton@novell.com">gnorton@novell.com</a>&gt; \
wrote:<br>&gt;<br>&gt; From: Geoff Norton &lt;<a ymailto="mailto:gnorton@novell.com" \
href="/mc/compose?to=gnorton@novell.com">gnorton@novell.com</a>&gt;<br>&gt; Subject: \
Re: [Mono-dev] Arm9 NS9215 floating point troubles<br>&gt; To: "Trevor Ackerman" \
&lt;<a ymailto="mailto:t_ackerman@yahoo.com" \
href="/mc/compose?to=t_ackerman@yahoo.com">t_ackerman@yahoo.com</a>&gt;<br>&gt; Cc: \
<a ymailto="mailto:mono-devel-list@lists.ximian.com" \
href="/mc/compose?to=mono-devel-list@lists.ximian.com">mono-devel-list@lists.ximian.com</a><br>&gt; \
Date: Thursday, June 17, 2010, 9:54 PM<br>&gt;<br>&gt; Is your system armeb \
or<br>&gt;&nbsp; armel?<br>&gt; It could be a endian bug in our softfloat impl  \
somewhere.<br>&gt; -g<br>&gt; On 2010-06-17, at 7:54 PM, Trevor Ackerman \
wrote:<br>&gt; I have more to report.<br>&gt;<br>&gt; I wrote a quick native C \
program to print out the bytes of a float and double variable that were assigned the \
literal value 1.0f.<br>&gt;<br>&gt; Then in the mono 2.6.4 routine mono_method_to_ir \
in source code file mono/mini/method_to_ir.c I dumped out the bytes of ip \
(instruction pointer) used for the double value in the case for \
CEE_LDC_R8.<br>&gt;<br>&gt; I discovered that the bytes in the double value used on \
mono had the high and low 32 bits swapped compared to those produced by the native C \
program. I hacked the routine decompose_soft_float to swap the high and \
low<br>&gt;&nbsp; words and now I have no troubles and the basic-float regression \
test passes 100%.<br>&gt;<br>&gt; Although this happens to work, I have a hard time \
believing that this is the correct solution to my problem. I feel that others are \
probably using  ARM9 without<br>&gt;&nbsp; floating point issues and that I am \
probably missing something in how I built mono for my platform. If anyone can shed \
some light on what I did wrong with building mono that'd be great. Of course if this \
is the correct action to take please let me know that too and how I may contribute \
the change back to the trunk (assuming that the trunk doesn't work which I haven't \
had time to test yet).<br>&gt;<br>&gt; In the meantime here's my hack to \
decompose_soft_float in method-to-ir.c<br>&gt;<br>&gt;<br>&gt; \
&nbsp;5073&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
case OP_R8CONST: {<br>&gt; \
&nbsp;5074&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
unsigned char *ucp = (unsigned char *) ins-&gt;inst_p0;<br>&gt; \
&nbsp;5075&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
unsigned char<br>&gt;&nbsp; rawval[8];<br>&gt;  \
&nbsp;5076&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
printf("decompose_soft_float OP_R8CONST\n");<br>&gt; \
&nbsp;5077&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
rawval[0] =<br>&gt;&nbsp; ucp[4];<br>&gt; \
&nbsp;5078&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
rawval[1] = ucp[5];<br>&gt; \
&nbsp;5079&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
rawval[2] = ucp[6];<br>&gt; \
&nbsp;5080&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
rawval[3] = ucp[7];<br>&gt; \
&nbsp;5081&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
rawval[4] = ucp[0];<br>&gt; \
&nbs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bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
break;<br>&gt;  &nbsp;5090&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
}<br>&gt;<br>&gt; --- On Thu, 6/17/10, Trevor Ackerman &lt;<a \
ymailto="mailto:t_ackerman@yahoo.com" \
href="/mc/compose?to=t_ackerman@yahoo.com">t_ackerman@yahoo.com</a>&nbsp;&lt;<a \
href="http://mc/compose?to=t_ackerman@yahoo.com" \
target="_blank">http://mc/compose?to=t_ackerman@yahoo.com</a>&gt;&gt; \
wrote:<br>&gt;<br>&gt; From: Trevor Ackerman<br>&gt;&nbsp; &lt;<a \
ymailto="mailto:t_ackerman@yahoo.com" \
href="/mc/compose?to=t_ackerman@yahoo.com">t_ackerman@yahoo.com</a>&nbsp;&lt;<a \
href="http://mc/compose?to=t_ackerman@yahoo.com" \
target="_blank">http://mc/compose?to=t_ackerman@yahoo.com</a>&gt;&gt;<br>&gt; \
Subject: Re: [Mono-dev] Arm9 NS9215 floating point troubles<br>&gt; To: <a \
ymailto="mailto:mono-devel-list@lists.ximian.com" \
href="/mc/compose?to=mono-devel-list@lists.ximian.com">mono-devel-list@lists.ximian.com</a><br>&gt; \
Date: Thursday, June 17,  2010, 11:31 AM<br>&gt;<br>&gt; Good suggestion but that did \
not change the results.<br>&gt;<br>&gt; --- On Thu, 6/17/10, Robert Jordan &lt;<a \
ymailto="mailto:robertj@gmx.net" \
href="/mc/compose?to=robertj@gmx.net">robertj@gmx.net</a>&nbsp;&lt;<a \
href="http://mc/compose?to=robertj@gmx.net" \
target="_blank">http://mc/compose?to=robertj@gmx.net</a>&gt;&gt; \
wrote:<br>&gt;<br>&gt; From: Robert Jordan &lt;<a ymailto="mailto:robertj@gmx.net" \
href="/mc/compose?to=robertj@gmx.net">robertj@gmx.net</a>&nbsp;&lt;<a \
href="http://mc/compose?to=robertj@gmx.net" \
target="_blank">http://mc/compose?to=robertj@gmx.net</a>&gt;&gt;<br>&gt; Subject: Re: \
[Mono-dev] Arm9 NS9215 floating point troubles<br>&gt; To: <a \
ymailto="mailto:mono-devel-list@lists.ximian.com" \
href="/mc/compose?to=mono-devel-list@lists.ximian.com">mono-devel-list@lists.ximian.com</a><br>&gt; \
Date: Thursday, June 17, 2010, 10:53 AM<br>&gt;<br>&gt; On 17.06.2010 18:07, Trevor \
Ackerman wrote:<br>&gt;&gt; I have  been able to cross-compile Mono 2.6.4 for the \
NS9215 (no fpu<br>&gt;&gt; afaik) and I'm having trouble with floats when \
executing<br>&gt;&nbsp; code.<br>&gt;<br>&gt; ...<br>&gt;<br>&gt;&gt; My CFLAGS and \
CPPFLAGS environment variables are<br>&gt;&gt;&nbsp;&nbsp;&nbsp;both<br>&gt;&gt; \
-DARM_FPU_NONE=1 -DMONO_ARCH_SOFT_FLOAT=1<br>&gt;<br>&gt; -DNO_UNALIGNED_ACCESS is \
probably needed as<br>&gt;&nbsp; well.<br>&gt;<br>&gt; Robert<br>&gt;<br>&gt; \
_______________________________________________<br>&gt; Mono-devel-list mailing \
list<br>&gt; <a ymailto="mailto:Mono-devel-list@lists.ximian.com" \
href="/mc/compose?to=Mono-devel-list@lists.ximian.com">Mono-devel-list@lists.ximian.com</a><br>&gt; \
<a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" \
target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><br>&gt;<br>&gt;<br>&gt; \
-----Inline Attachment Follows-----<br>&gt;<br>&gt; \
_______________________________________________<br>&gt;  Mono-devel-list mailing \
list<br>&gt; <a ymailto="mailto:Mono-devel-list@lists.ximian.com" \
href="/mc/compose?to=Mono-devel-list@lists.ximian.com">Mono-devel-list@lists.ximian.com</a><br>&gt; \
&nbsp;&lt;<a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" \
target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a>&gt;<br>&gt;<br></div></blockquote></td></tr></table><br>


      



_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic