Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Floating point questions   Message List  
Reply | Forward Message #14670 of 15019 |
Re: [gbadev] Floating point questions


Sure, gcc and most other compilers use software floating point
operations if you dont have the hardware (well you have to tell the
compiler which way to do it).

Take some code like this:

float a,b,c;

void myfun ( void )
{
a=b+c;
}

And compile to asm and see what it produces

For example the gcc I use produced code like this

ldr r0, [r3, #0] @ float
ldr r1, [r2, #0] @ float
bl __addsf3
mov r3, r0
str r3, [r4, #0] @ float

Which is a soft fpu,

add -mhard-float to the command line and you get hardware fpu
instructions:

ldfs f1, [r3, #0]
ldfs f0, [r2, #0]
adfs f0, f1, f0
stfs f0, [r1, #0]


You dont want that, if you see f registers and adfs or adfd it is
building for a hard fpu...

And it runs as fast as it runs...

David








On Thu, 2003-12-11 at 08:13, Martijn Reuvers wrote:
> Hi all,
>
> Thanks for your comments, but please assume that I DO want to use floating
> point operations and not fixed point. There are only two operations that I'm
> interested in, addition and integer conversion. Is it possible at all to get
> these simple (to me) instructions fast on the AGB?
>
> Regards,
>
> Martijn
>
>
> ----- Original Message -----
> From: "Tomas Hallenberg" <tomha219@...>
> To: <gbadev@yahoogroups.com>
> Sent: Thursday 11 December 2003 15:30
> Subject: Re: [gbadev] Floating point questions
>
>
> > I don't see the reason for using any floating point arithmetics if
> > that's all you want to do. To begin with you'll only have integer
> > results unless you also have floating point constants, but then you
> > could do it with fixed point instead with good precision.
> >
> > Martijn Reuvers wrote:
> > > Hi,
> > >
> > > I want to do two floating point operations: addition/substraction and
> > > integer conversion. Is there any info on how fast these two operations
> are
> > > on the AGB since it hasn't any FP hardware? How many instructions,
> cycles?
> > > If it's really slow, does anyone know a fast trick to do these two
> > > operations?
> > >
> > > Regards,
> > >
> > > Martijn Reuvers
> >
> > --
> > http://dreamcache.mine.nu
> >
> >
> >
> >
> >
> >
> > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> >
> >
>
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>





Fri Dec 12, 2003 2:14 am

dwelchgba
Offline Offline
Send Email Send Email

Forward
Message #14670 of 15019 |
Expand Messages Author Sort by Date

Hi, I want to do two floating point operations: addition/substraction and integer conversion. Is there any info on how fast these two operations are on the AGB...
Martijn Reuvers
martijntwotr...
Offline Send Email
Dec 11, 2003
2:14 pm

I don't see the reason for using any floating point arithmetics if that's all you want to do. To begin with you'll only have integer results unless you also...
Tomas Hallenberg
tomha219@...
Send Email
Dec 11, 2003
2:51 pm

Hi all, Thanks for your comments, but please assume that I DO want to use floating point operations and not fixed point. There are only two operations that I'm...
Martijn Reuvers
martijntwotr...
Offline Send Email
Dec 12, 2003
12:44 am

Sure, gcc and most other compilers use software floating point operations if you dont have the hardware (well you have to tell the compiler which way to do...
David Welch
dwelchgba
Offline Send Email
Dec 12, 2003
4:15 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help