[Mono-dev] Arm9 NS9215 floating point troubles

Trevor Ackerman t_ackerman at yahoo.com
Fri Jun 18 12:24:18 EDT 2010


~ # 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 at novell.com> wrote:

From: Geoff Norton <gnorton at novell.com>
Subject: Re: [Mono-dev] Arm9 NS9215 floating point troubles
To: "Trevor Ackerman" <t_ackerman at yahoo.com>
Cc: "mono-devel-list at lists.ximian.com" <mono-devel-list at 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 at 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 at novell.com> wrote:
>
> From: Geoff Norton <gnorton at novell.com>
> Subject: Re: [Mono-dev] Arm9 NS9215 floating point troubles
> To: "Trevor Ackerman" <t_ackerman at yahoo.com>
> Cc: mono-devel-list at 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 at yahoo.com <http://mc/compose?to=t_ackerman@yahoo.com>> wrote:
>
> From: Trevor Ackerman
>  <t_ackerman at yahoo.com <http://mc/compose?to=t_ackerman@yahoo.com>>
> Subject: Re: [Mono-dev] Arm9 NS9215 floating point troubles
> To: mono-devel-list at 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 at gmx.net <http://mc/compose?to=robertj@gmx.net>> wrote:
>
> From: Robert Jordan <robertj at gmx.net <http://mc/compose?to=robertj@gmx.net>>
> Subject: Re: [Mono-dev] Arm9 NS9215 floating point troubles
> To: mono-devel-list at 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 at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
> -----Inline Attachment Follows-----
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
>  <http://lists.ximian.com/mailman/listinfo/mono-devel-list>
>



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100618/d690e3ed/attachment.html 


More information about the Mono-devel-list mailing list