Sergei Dyshel
2010-Mar-18 14:30 UTC
[LLVMdev] Turning on/off sub-target features (e.g. Altivec on PowerPC)
Hello, I'm using Mono with experimental LLVM backend support on PowerPC. I noticed that although LLVM's IR contains SIMD instructions the assembly produced doesn't contain any Altivec instructions and my PowerPC970 machine of course has Altivec support. Isn't there some kind of autodetection? I searched in Target sources but only found out that Altivec is disabled by default. Can I turn Altivec support on (and off, I need both cases) from the code? Some info: Mono's utilizes LLVM in this way: LLVMInitializePowerPCTarget (); LLVMInitializePowerPCTargetInfo (); ExecutionEngine *EE = ExecutionEngine::createJIT ( ... ); fpm = new FunctionPassManager ( ... ); fpm->add(new TargetData(*EE->getTargetData())); and then uses ExecutionEngine object for compiling functions. -- Regards, Sergei Dyshel -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100318/5ad4ef49/attachment.html>
Chris Lattner
2010-Mar-18 17:20 UTC
[LLVMdev] Turning on/off sub-target features (e.g. Altivec on PowerPC)
On Mar 18, 2010, at 7:30 AM, Sergei Dyshel wrote:> Hello, > > I'm using Mono with experimental LLVM backend support on PowerPC. I noticed that although LLVM's IR contains SIMD instructions the assembly produced doesn't contain any Altivec instructions and my PowerPC970 machine of course has Altivec support. Isn't there some kind of autodetection? I searched in Target sources but only found out that Altivec is disabled by default. > > Can I turn Altivec support on (and off, I need both cases) from the code? Some info: Mono's utilizes LLVM in this way: > > LLVMInitializePowerPCTarget (); > LLVMInitializePowerPCTargetInfo (); > ExecutionEngine *EE = ExecutionEngine::createJIT ( ... ); > fpm = new FunctionPassManager ( ... ); > fpm->add(new TargetData(*EE->getTargetData())); > > and then uses ExecutionEngine object for compiling functions.The JIT should autodetect that you have altivec. Check the code here: PPCSubtarget.cpp:75. It currently looks like it's only implemented for Mac OS/X systems. You can control individual cpu attributes like this by using EngineBuilder with the setMAttrs(...) function. It corresponds directly to llc's -mattr=+foo,-bar argument. -Chris