problem while building arm vfp softfloat gcc
add
addsub@eyou.com
Sat Feb 7 03:44:00 GMT 2004
sorry for my testcase, I had rewriten it to easy to understand, but on the
contrary...
Here is my true test case using printf:
----main.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
float i=1.0;
printf("%f",i);
return 0;
}
----main.c
here is generated by arm-linux-gcc -S main.c -o main.s
----main.s
<sniz>
main:
@ args = 0, pretend = 0, frame = 4
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {r4, fp, ip, lr, pc}
sub fp, ip, #4
sub sp, sp, #4
ldr r3, .L2 @ float
str r3, [fp, #-20] @ float
ldr r0, [fp, #-20] @ float
bl __extendsfdf2
mov r4, r1
mov r3, r0
ldr r0, .L2+4
mov r2, r4
mov r1, r3
bl printf
mov r3, #0
mov r0, r3
<sniz>
-----main.s
if I arm-linux-gcc main.s -o test
then execute test on pxa board, it will output: -1.999744
but if I modified the two lines before "bl printf" in main.s to:
mov r2, r3
mov r3, r4
then compile main.s and execute,
it will print right result: 1.00000
so conclusion:
my toolchain must has a problem of float param passing, seemly related to
float word order. so I want to dig into my gcc source tree to find where is
responsible for generating this wrong asm code.
I hope this time it's clearer :)
and Dan, I think the most recently snapshot ptxdist still has this problem
:(
in your letter you wrote:
>add <addsub@eyou.com> wrote:
>> I'm building a arm-linux-gcc toolchain with soft-vfp support by
>> crosstool-0.27(Thanks to Dan). But generated code cannot execute
>> "printf("%f",1.00)" well, it will output 0.00000.
>>
>> Then I found gcc doesn't produce right code, it uses wrong registers
sequence
>> to pass float argument to function()
>
>Richard Earnshaw wrote:
>> To the best of my knowledge the only configuration of a released version
>> of gcc that supports soft-vfp is arm-netbsdelf.
>
>He's using a patch that adds that, I think. The patch is taken from
>http://www.pengutronix.de/software/ptxdist/patches-cvs/gcc-3.3.2/generic/gcc-
3.3.2-arm-softfloat.diff
>This is mostly just Nicholas Pitre's patch:
>http://lists.arm.linux.org.uk/pipermail/linux-arm/2003-October/006436.html
>
>(The script he's using to build gcc is
>http://kegel.com/crosstool/crosstool-0.27/demo-arm-softfloat.sh
>and the complete set of gcc patches he's using is
>http://kegel.com/crosstool/crosstool-0.27/patches/gcc-3.3.2/
>most of which just deal with the regression test suite,
>or fix minor sh4 problems.)
>
>Anyway, he says in his little "float i=1.0; foo(i);" test program, gcc
generates
> mov r4, r1
> mov r3, r0
> mov r1, r4 /* this line wrong -by addsub*/
> mov r0, r3 /* this line wrong -by addsub*/
> bl foo
>when it should generate
> mov r4, r1
> mov r3, r0
> mov r2, r3
> mov r3, r4
> bl foo
>I don't know anything about arm assembly, and it'll be a while before
>I can dig into this. I'd probably start by just building the latest cvs
>version of ptxdist's toolchain, and see where its gcc build procedure
>differs from mine... although I could also try running the gcc regression
>tests on the arm hardware I have. Anyway, perhaps Robert or Nicolas will
>rescue me and tell me what I forgot :-)
>- Dan
>
>
--http://www.eyou.com
--Ãö¨¿Ã¿¿µÃµçÃÃÃÃ
Ãä ÃïÃôÃüþ Ãö¯Ãéé ÃÃÃú·þÃñ ÃøÃç´æ´¢...ÃÃÃÃô¾¡
--http://vip.eyou.com
--¿ì¿ìµÃüÃÃÃÃVIPÃÃ
Ãä â²áÃúÃÃÃâµÃÃû§Ãû
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list