Questionn: mul functions for v850e
Kai Ruottu
kai.ruottu@luukku.com
Thu Jun 6 06:01:00 GMT 2002
markku.pihlajamaa@luukku.com wrote:
>
> Perhaps you should write -mv850e instead of -Wa,-mv850e.
> I have tried this (gcc version 2.96-xscale-010827)
> and seen a mul instruction in the assembly list.
The Intel/RedHat XScale-sources are one solution, another is to try
to add the v850e/ea support to gcc-2.95.x. GCC sources where the
support exists have been many and probably there are many now...
Anyhow the address Markku forgot to announce is:
http://developer.intel.com/design/intelxscale/dev_tools/010827/
I haven't these sources yet, with a modem connection they are almost
impossible :-( or at least there must be some very important reason
for the download...). Markku seems to have some rich friend with a
direct connection, 'no-cost' line at work or something...
> > -----Original Message-----
> > My question are:
> > 1) Does GNU 2.95.2 support v850e?
No, when using the plain vanilla FSF sources.
> > 2) Why does not GCC generate muliply code sets?
> > GCC generates __mulsi3 sub routine call.
Maybe because v850 doesn't have this instruction code but v850e and
v850ea have it (I'm not a big V850-expert...)
> > 3) Please show me how to generate multiply code sets for v850e!
As Markku suggested, change your GCC version into another one or try
to copy the v850e/ea support to your current gcc-2.95.x sources. Then
use the '-mv850e' option for 'v850e'.
> > v850-elf/bin/gcc -c -S -Wall -Wno-format -Wimplicit -Wparentheses \
> > -Wunused -fconserve-space -fno-exceptions -fno-rtti -O2 \
> > -fno-expensive-optimizations -mno-pro \
> > log-function -gstabs3 -ffixed-r20 -ffixed-r21 -fpack-struct \
> > -Wa,-mv850e mul.c
I took the '-gstabs3' away, added the '-mv850e' and got for your:
> > int func(int b)
> > {
> > return~b;
> > }
> >
> > int main()
> > {
> >
> > int a= 3;
> > int b= 4;
> > int c;
> >
> > c= a * func(b);
> > return c;
> > }
the following output from my patched gcc-2.95.3-1 :
----------------- clip ----------------------------
.file "v850e-mul.c"
gcc2_compiled.:
.section .text
.align 1
.global _func
.type _func,@function
_func:
not r6,r10
jmp [r31]
.Lfe1:
.size _func,.Lfe1-_func
.align 1
.global _main
.type _main,@function
_main:
addi -20,sp,sp
st.w r31,16[sp]
mov 4,r6
jarl _func,r31
mov 3,r11
ld.w 16[sp],r31
mul r11,r10,r0
addi 20,sp,sp
jmp [r31]
.Lfe2:
.size _main,.Lfe2-_main
.ident "GCC: (GNU) 2.95.3-1 20010315 (release)"
----------------- clip ----------------------------
So your:
> > mov 3,r6
> > mov r10,r7
> > jarl ___mulsi3,r31
> > ld.w 16[sp],r31
was replaced by:
mov 3,r11
ld.w 16[sp],r31
mul r11,r10,r0
BTW, my gcc-2.95.3-1 generated identical code with yours gcc-2.95.2
without the '-mv850e'...
Cheers (Kampai?), Kai
------
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