[vorbis-dev] Optimisations

David A. Gatwood dgatwood at deepspace.mklinux.org
Thu Nov 16 17:26:23 PST 2000



On Thu, 16 Nov 2000, David Riley wrote:

> "David A. Gatwood" wrote:
> > 
> > PowerPC 74xx (G4/Altivec) -- but not in assembly.  There are C/C++
> > extensions in gcc (or will be... not sure if they're out in public yet) to
> > make this easier.
> 
> Why not in assembly?  The GCC extensions won't necessarily work across
> platforms (i.e. with the Metrowerks compiler) while it's already
> accepted that assembly doesn't... 

The reasons for assembly not being cross-platform within the realm of ppc
compilers would be that gcc has never been available for MacOS before. 
With MacOS X, expect a LOT of standardization.  Codewarrior is suddenly
the underdog and will have to comply with the standards or else it will
likely be left behind by a good many developers.

The gcc extensions are official Apple-sanctioned extensions.  If
CodeWarrior doesn't support them yet, it almost certainly will.  By the
time OS X becomes final, I suspect those extensions will be so
indoctrinated in MacOS software that they won't have much choice.

> And (to my mind) it's easier to
> separate two similar assembly files than C files.

Nah.  You'll want the non-Altivec code to be present in the executable as
well, since most ppc machines don't have that hardware.  How aobut an
initialization section something like:

#ifdef __powerpc__
        if (an altivec instruction succeeds) {
                function_pointer_1 = altivec_fn_1
                function_pointer_2 = altivec_fn_2
        } else
#else
#ifdef __whatever__
        if (check for another optimization needed)
                function_poitner_1 = mmx_fn_1
        } else
#endif
#endif
        {
                function_pointer_1 = fn_1

        }

or something similar, maybe less ugly -- then call the functions by
pointer. That way if you have no optimized code compiled in, you just run
the standard functions, otherwise, you perform a test at run-time to see
which ones to run.  These routines could be written in whatever language
you wanted as long as they behaved like function calls on the appropriate
platform.  Thoughts?

David

---------------------------------------------------------------------
                    Check out my weekly web comic:
                     http://www.techmagazine.org

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list