• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: OT: alias options in gcc?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT: alias options in gcc?


  • Subject: Re: OT: alias options in gcc?
  • From: Stephen Davis <email@hidden>
  • Date: Tue, 26 Nov 2002 12:57:29 -0800

If that function contains altivec code then there is probably some prolog/epilog code for saving/restoring the altivec registers used by the code and those instructions will get executed on the G3 and kaboom! Since the compiler is free to do its register saving anywhere it wants to, you can't assume that code like this will not blow up on a G3.

void MyFunc( float * data, int numSamples, bool useAltivec )
{
if ( useAltivec )
{
vector float * fp = (vector float *) data;
... do some vector stuff
}
else
{
... do some scalar stuff ...
}
}

Even if the vector variables are all properly scoped the compiler will do its save/restore stuff outside the block so you're not safe.

OR

inline void MyVectorFunc( vector float * data, int numSamples )
{
... do some vector stuff ...
}

void MyFunc( float * data, int numSamples, bool useAltivec )
{
if ( useAltivec == true )
MyVectorFunc( (vector float *) data, numSamples );
else
... do scalar stuff ...
}

If MyVectorFunc() gets inlined then you are cheesed.

Hope that helps,
stephen

On Tuesday, November 26, 2002, at 12:35 PM, Kurt Bigler wrote:

on 11/26/02 12:01 PM, Bill Stewart <email@hidden> wrote:

the thing we most get bitten by here is
the proclivity of the compiler to inline code with O3 and small stub
routines that have altivec code ending up executing on a G3

Do you really mean "executing"? It doesn't make sense to me that inlining
would change what code gets executed. It seems conceivable that inlining
might cause altivec code to be included in a function intended to be
non-altivec only.

-Kurt Bigler
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: OT: alias options in gcc?
      • From: Chris Rogers <email@hidden>
    • Re: OT: alias options in gcc?
      • From: email@hidden
References: 
 >Re: OT: alias options in gcc? (From: Kurt Bigler <email@hidden>)

  • Prev by Date: Re: Newbie documentation for MIDI
  • Next by Date: Re: Newbie documentation for MIDI
  • Previous by thread: Re: OT: alias options in gcc?
  • Next by thread: Re: OT: alias options in gcc?
  • Index(es):
    • Date
    • Thread