This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problem with crosstool 0.28-pre28 supplied patch for gcc 3.3.[23] softfloat on ARM


On Tue, Aug 17, 2004 at 01:48:38AM +0200, Dimitry Andric wrote:

> > By the way, I'm on a big endian xscale here.
> 
> Okay, then ALL your doubles/floats should be bigendian format, even if
> you use VFP (since that uses native byte order).
> 
> So declaring a double with value 1.0 should give you:
> 
> one:
>         .word   1072693248
>         .word   0
> 
> in assembly.  Can you please check that?

Looks okay:

        .section        .rodata
        .align  2
        .type   one, %object
        .size   one, 8
one:
        .word   1072693248
        .word   0


But this is odd.  This program:

<source>
#include <stdio.h>
#include <stdlib.h>

int main()
{
        double x;

        x = (double)1.0;
        printf("%.8x %.8x\n", ((unsigned int *)&x)[0], ((unsigned int *)&x)[1]);

        return 0;
}
</source>

gives me this:

<output>
[root@enp2611 tmp]# /tmp/xi
3ff00000 00000000
[root@enp2611 tmp]# 
</output>

But this program:

<source>
#include <stdio.h>
#include <stdlib.h>

int main()
{
        double x;
        volatile int y;

        y = 1;
        x = (double)y;
        printf("%.8x %.8x\n", ((unsigned int *)&x)[0], ((unsigned int *)&x)[1]);

        return 0;
}
</source>

gives me this:

<output>
[root@enp2611 tmp]# /tmp/xi
00000000 3ff00000
[root@enp2611 tmp]# 
</output>

The second program gives after preprocessing:

phi% cat xi                                                                                                                                             /tmp
        .file   "xi.c"
        .section        .rodata.str1.4,"aMS",%progbits,1
        .align  2
.LC0:
        .ascii  "%.8x %.8x\n\000"
        .text
        .align  2
        .global main
        .type   main, %function
main:
        @ args = 0, pretend = 0, frame = 12
        @ frame_needed = 0, uses_anonymous_args = 0
        str     lr, [sp, #-4]!
        mov     r3, #1
        ldr     r0, .L2
        sub     sp, sp, #12
        str     r3, [sp, #8]
        ldr     r2, [sp, #8]
        fltd    f0, r2
        stfd    f0, [sp, #0]
        ldmia   sp, {r1, r2}    @ phole ldm
        bl      printf
        mov     r0, #0
        add     sp, sp, #12
        ldmfd   sp!, {pc}
.L3:
        .align  2
.L2:
        .word   .LC0
        .size   main, .-main
        .ident  "GCC: (GNU) 3.4.1"

I'm afraid I can't make much sense of that, but it looks like either
the fltd or the stfd are messing up.  Is the kernel FP emulator at
fault anyway?


cheers,
Lennert

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]