Sergei Dyshel
2010-Mar-18 14:38 UTC
[LLVMdev] Turning sub-target features on/off (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/b33eeb0c/attachment.html>
Xerxes RĂ„nby
2010-Mar-19 10:45 UTC
[LLVMdev] Turning sub-target features on/off (e.g. Altivec on PowerPC)
On 2010-03-18 15:38, 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.No there are no automatic autodetection for ppc. AFAIK only the X86 backend currently have some autodetection code buried in the target backends. The habit to have autodetection code in the target backend are discouraged and X86 are currently moving code out from the backend into two new API found in LLVM 2.7 that can be used by clients to find out of the cpu capabilities. lib/System/Hosts.cpp This are the right place to add new PPC cpu/attributes autodetection code. http://llvm.org/bugs/show_bug.cgi?id=5389> > 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()));I you use the EngineBuilder instead of calling createJIT directly then you can set the cpu type and select cpu attributes using mattr easily, this are how lli does it: InitializeNativeTarget(); // use this instead of LLVMInitializePowerPCTarget (); and LLVMInitializePowerPCTargetInfo (); EngineBuilder builder(Mod); builder.setMArch(MArch); // set arch ppc_32 ppc_64 etc. builder.setMCPU(MCPU); // set desired cpu type for code generation builder.setMAttrs(MAttrs); // set desired cpu attributes (enable Altivec etc) EE = builder.create(); ... fpm = new FunctionPassManager ( ... ); ...> > and then uses ExecutionEngine object for compiling functions. > -- > Regards, > Sergei Dyshel > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >Cheers Xerxes -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100319/771e3d82/attachment.html>