Re: enabling altivec in XCode
Re: enabling altivec in XCode
- Subject: Re: enabling altivec in XCode
- From: Ian Ollmann <email@hidden>
- Date: Wed, 2 Feb 2005 15:30:41 -0800
On Feb 2, 2005, at 12:06 PM, <email@hidden> wrote:
The purpose of
__VEC__ is to decide whether various vector operations should be
performed with java mode turned off (for G4 processors). Unless you're
sure you want that, I recommend just dumping any code you copy from the
vDSPExample code that is wrapped in the check for __VEC__.
That is rubbish.
The __VEC__ C preprocessor symbol is turned on automatically when the compiler is passed -faltivec. All __VEC__ means is that -faltivec was passed, which in turn means that the AltiVec C Programming interface has been turned on. It is a switch for controlling whether or not code is compiled and has nothing to do with java mode. Mostly it is used to stop vector code from causing compile time errors on non-AltiVec targets, for example when compiling code that is intended to be run on x86 on a cross platform app.
The problem here is really due to the way that ZeroLink works. There is no compile/link time check for absent functions. Because -faltivec was not passed, __VEC__ was never defined, which means that HasAltivec() was never compiled. The crash occurs when the code branches to a NULL function pointer.
My suggestion is two fold:
1) liberate HasAltiVec() implementation and declaration from the #ifdef __VEC__ block so that it is compiled regardless of whether __VEC__ is defined. That particular function works whether AltiVec is available or not, so it doesn't need to be protected by __VEC__. If you want, you can set it up to always return false if __VEC__ is undefined. There wouldn't be any vector code to call in that case.
2) If you intend to write your own AltiVec code using the AltiVec C Programming Interfaces, turn on the AltiVec C Programming Interfaces using the -faltivec flag. They are not turned on in xcode by default. You don't need -faltivec to use libraries that use altivec code.
You possibly might want to turn off ZeroLink to see what other link problems you have.
On a side note, unless you're specifically writing altivec code, the
accelerate framework chooses the vector or scalar implementation for
you. You don't even need to enable altivec code generation.
..which is correct.
Ian Ollmann
Vector and Numerics Group
Core OS
Apple Computer
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden