[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 : \
ARM926EJ-S rev 5 (v5l)<br>BogoMIPS : \
74.34<br>Features : swp half fastmult edsp \
java <br>CPU implementer : 0x41<br>CPU architecture: 5TEJ<br>CPU \
variant : 0x0<br>CPU \
part : 0x926<br>CPU \
revision : \
5<br><br>Hardware : ConnectCore 9P 9215 on \
a JSCC9P9215 Devboard<br>Revision : \
0000<br>Serial : \
0000000000000000<br><br><br>--- On <b>Fri, 6/18/10, Geoff Norton \
<i><gnorton@novell.com></i></b> wrote:<br><blockquote style="border-left: 2px \
solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Geoff Norton \
<gnorton@novell.com><br>Subject: Re: [Mono-dev] Arm9 NS9215 floating point \
troubles<br>To: "Trevor Ackerman" <t_ackerman@yahoo.com><br>Cc: \
"mono-devel-list@lists.ximian.com" <mono-devel-list@lists.ximian.com><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 <<a ymailto="mailto:t_ackerman@yahoo.com" \
href="/mc/compose?to=t_ackerman@yahoo.com">t_ackerman@yahoo.com</a>> \
wrote:<br>> I believe it is armel, here's what 'file' reports for a natively \
compiled C program.<br>><br>> hello_world_c: ELF 32-bit LSB executable, ARM, \
version 1, dynamically linked (uses shared libs), not stripped.<br>><br>> 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>><br>> \
Thanks<br>><br>> --- On Thu, 6/17/10, Geoff Norton <<a \
ymailto="mailto:gnorton@novell.com" \
href="/mc/compose?to=gnorton@novell.com">gnorton@novell.com</a>> \
wrote:<br>><br>> From: Geoff Norton <<a ymailto="mailto:gnorton@novell.com" \
href="/mc/compose?to=gnorton@novell.com">gnorton@novell.com</a>><br>> Subject: \
Re: [Mono-dev] Arm9 NS9215 floating point troubles<br>> To: "Trevor Ackerman" \
<<a ymailto="mailto:t_ackerman@yahoo.com" \
href="/mc/compose?to=t_ackerman@yahoo.com">t_ackerman@yahoo.com</a>><br>> 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>> \
Date: Thursday, June 17, 2010, 9:54 PM<br>><br>> Is your system armeb \
or<br>> armel?<br>> It could be a endian bug in our softfloat impl \
somewhere.<br>> -g<br>> On 2010-06-17, at 7:54 PM, Trevor Ackerman \
wrote:<br>> I have more to report.<br>><br>> 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>><br>> 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>><br>> 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>> words and now I have no troubles and the basic-float regression \
test passes 100%.<br>><br>> 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>> 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>><br>> In the meantime here's my hack to \
decompose_soft_float in method-to-ir.c<br>><br>><br>> \
5073 \
case OP_R8CONST: {<br>> \
5074 \
unsigned char *ucp = (unsigned char *) ins->inst_p0;<br>> \
5075 \
unsigned char<br>> rawval[8];<br>> \
5076 \
printf("decompose_soft_float OP_R8CONST\n");<br>> \
5077 \
rawval[0] =<br>> ucp[4];<br>> \
5078 \
rawval[1] = ucp[5];<br>> \
5079 \
rawval[2] = ucp[6];<br>> \
5080 \
rawval[3] = ucp[7];<br>> \
5081 \
rawval[4] = ucp[0];<br>> \
5082 \
rawval[5] = ucp[1];<br>> \
5083 \
rawval[6] = ucp[2];<br>> \
5084 \
rawval[7] = ucp[3];<br>> \
5085 \
DVal d;<br>> 5086<br>> \
// \
d.vald = *(double*)ins->inst_p0;<br>> \
5087 \
d.vald = *(double*)rawval;<br>> \
5088 \
MONO_EMIT_NEW_I8CONST (cfg, ins->dreg, d.vall);<br>> \
5089 \
break;<br>> 5090 \
}<br>><br>> --- On Thu, 6/17/10, Trevor Ackerman <<a \
ymailto="mailto:t_ackerman@yahoo.com" \
href="/mc/compose?to=t_ackerman@yahoo.com">t_ackerman@yahoo.com</a> <<a \
href="http://mc/compose?to=t_ackerman@yahoo.com" \
target="_blank">http://mc/compose?to=t_ackerman@yahoo.com</a>>> \
wrote:<br>><br>> From: Trevor Ackerman<br>> <<a \
ymailto="mailto:t_ackerman@yahoo.com" \
href="/mc/compose?to=t_ackerman@yahoo.com">t_ackerman@yahoo.com</a> <<a \
href="http://mc/compose?to=t_ackerman@yahoo.com" \
target="_blank">http://mc/compose?to=t_ackerman@yahoo.com</a>>><br>> \
Subject: Re: [Mono-dev] Arm9 NS9215 floating point troubles<br>> 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>> \
Date: Thursday, June 17, 2010, 11:31 AM<br>><br>> Good suggestion but that did \
not change the results.<br>><br>> --- On Thu, 6/17/10, Robert Jordan <<a \
ymailto="mailto:robertj@gmx.net" \
href="/mc/compose?to=robertj@gmx.net">robertj@gmx.net</a> <<a \
href="http://mc/compose?to=robertj@gmx.net" \
target="_blank">http://mc/compose?to=robertj@gmx.net</a>>> \
wrote:<br>><br>> From: Robert Jordan <<a ymailto="mailto:robertj@gmx.net" \
href="/mc/compose?to=robertj@gmx.net">robertj@gmx.net</a> <<a \
href="http://mc/compose?to=robertj@gmx.net" \
target="_blank">http://mc/compose?to=robertj@gmx.net</a>>><br>> Subject: Re: \
[Mono-dev] Arm9 NS9215 floating point troubles<br>> 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>> \
Date: Thursday, June 17, 2010, 10:53 AM<br>><br>> On 17.06.2010 18:07, Trevor \
Ackerman wrote:<br>>> I have been able to cross-compile Mono 2.6.4 for the \
NS9215 (no fpu<br>>> afaik) and I'm having trouble with floats when \
executing<br>> code.<br>><br>> ...<br>><br>>> My CFLAGS and \
CPPFLAGS environment variables are<br>>> both<br>>> \
-DARM_FPU_NONE=1 -DMONO_ARCH_SOFT_FLOAT=1<br>><br>> -DNO_UNALIGNED_ACCESS is \
probably needed as<br>> well.<br>><br>> Robert<br>><br>> \
_______________________________________________<br>> Mono-devel-list mailing \
list<br>> <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>> \
<a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" \
target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a><br>><br>><br>> \
-----Inline Attachment Follows-----<br>><br>> \
_______________________________________________<br>> Mono-devel-list mailing \
list<br>> <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>> \
<<a href="http://lists.ximian.com/mailman/listinfo/mono-devel-list" \
target="_blank">http://lists.ximian.com/mailman/listinfo/mono-devel-list</a>><br>><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