[Ffmpeg-devel] Need -maltivec in addition to -faltivec for OSX
Sat Aug 13 01:38:44 CEST 2005
On 12 aug 2005, at 21:51, Michael Niedermayer wrote:
>> I suspect that this patch may be incorrect, or at least might have
>> some unwanted side-effects. From reading the documentation, using
>> -maltivec will allow GCC to generate AltiVec instructions from
>> ordinary, non-vectorised C-code. Currently, an AltiVec-enabled build
>> of FFmpeg should work on a G3, and using -maltivec might break this.
>> Have you verified that this still works on a G3s? If not, I may be
>> able to check it later.
> i think you are right, the change is problematic, the reason why i
> still applied it is that -maltivec was altready used for some gcc
> versions ...
> i think some --enable-runtime-cpudetect (or --disable) could be added
> to make it clear if the binary should be optimized for cpu X but
> run on
> any cpu of the same architecture or if its ok if it runs just on X
> alternatively the --tune option might be usefull for the distinction
It seems Apple is starting to move to the common -maltivec flag (as a
-machine option instead of a -language option) and apparently a bunch
of flags have significantly changed. So we shouldn't even need -
maltivec since -mcpu=7450 (G4) implies that now. Here's some
interesting stuff from Apple's gcc3.3 and gcc4.0 documentation. About
your question on the difference, the last paragraph should have some
Enable the AltiVec language extensions, as defined in Motorola's
AltiVec PIM. This includes the recognition of vector and pixel as
(context-dependent) keywords, the definition of built-in functions
such as vec_add, and other extensions. Note that unlike the option -
maltivec, the extensions do not require the inclusion of any special
header files. (APPLE ONLY) "
"-maltivec, -mno-altivec. These switches enable or disable the use of
built-in functions that allow access to the AltiVec instruction set.
You may also need to set -mabi=altivec to adjust the current ABI with
AltiVec ABI enhancements.This option is not supported on Mac OS X;
use -faltivec instead."
This flag is provided for compatibility with Metrowerks CodeWarrior
and MrC compilers as well as previous Apple versions of GCC. It
causes the -mpim-altivec option to be turned on. "
Generate code that uses (does not use) AltiVec instructions, and also
enable the use of built-in functions that allow more direct access to
the AltiVec instruction set. You may also need to set -mabi=altivec
to adjust the current ABI with AltiVec ABI enhancements. "
"The -mcpu options automatically enable or disable the following
options: -maltivec, -mhard-float, -mmfcrf, -mmultiple, -mnew-
mnemonics, -mpower, -mpower2, -mpowerpc64, -mpowerpc-gpopt, -mpowerpc-
gfxopt, -mstring. The particular options set for any particular CPU
will vary between compiler versions, depending on what setting seems
to produce optimal code for that CPU; it doesn't necessarily reflect
the actual hardware's capabilities."
Enable (or disable) built-in compiler support for the syntactic
extensions as well as operations and predicates defined in the
Motorola AltiVec Technology Programming Interface Manual (PIM). This
includes the recognition of vector and pixel as (context-dependent)
keywords, the definition of built-in functions such as vec_add, and
the use of parenthesized comma expression as AltiVec literals. Note
that unlike the option -maltivec, the extension does not require the
inclusion of any special header files; if <altivec.h> is included, a
warning will be issued and the contents of the header will be
ignored. The preprocessor shall provide an __APPLE_ALTIVEC__ manifest
constant when -mpim-altivec is specified. (APPLE ONLY)
In addition, the -mpim-altivec option disables the inlining of
functions containing AltiVec instructions into functions that do not
make use of the vector unit. Certain other optimizations, such as
inline vectorization of memset and memcpy calls, are also disabled.
These adjustments make it possible to compile programs whose use of
AltiVec instructions is preceded by a run-time check for the presence
of AltiVec functionality, and that can therefore be made to run on G3
processors. Note that all of these optimizations may be re-enabled by
supplying the -maltivec option, or an -mcpu option specifying a
processor that supports AltiVec instructions."
More information about the ffmpeg-devel