Runtime Altivec detection
damm at opensource.se
Sat Mar 8 06:44:45 EST 2003
On Fri, 7 Mar 2003 12:08:02 -0600
Nathan Ingersoll <ningerso at ruralcenter.org> wrote:
> > mplayer and ffmpeg does some kind of detection runtime.
> > I'm playing with it right now actually.
> Last I heard, it was a compile time detection or flag. So you had to build
> separate binaries for your G4 and non-G4 machines.
The latest released mplayer requires you to pass --enable-altivec to configure.
A runtime check is then performed in:
mplayer/cpudetect.c and ffmpeg/libavcodec/ppc/dsputil_altivec.c
> > I've seen that -maltivec and -mabi=altivec is passed sometimes.
> > If I want to build a binary that should be able to run on a
> > G3 without altivec and utilize altivec when present on a G4,
> > what flags should I use?
> There is no specific flag for doing so, you need some code to detect the
> capability, and then decide whether to use the Altivec routine.
Sorry, I think I was a little bit unclear in my question,
Do you have to pass any specific flags to gcc to be able to complile
altivec code, and if these flags are "-maltivec -mabi=altivec", is
it possible to pass them to gcc and still compile for G3 (-mcpu=750)?
It's a nice feature to be able to build one binary that is optimized
for G3 but does runtime checks and enables altivec if present.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-dev