<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
On 2010-03-18 15:38, Sergei Dyshel wrote:
<blockquote
 cite="mid:19e4cfaf1003180738u91cffb1h5de90bd3f6af1751@mail.gmail.com"
 type="cite">
  <div dir="ltr"><span class="Apple-style-span"
 style="font-family: arial,sans-serif; font-size: 15px; border-collapse: collapse;">Hello,
  <div><br>
  </div>
  <div>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.</div>
  </span></div>
</blockquote>
No there are no automatic autodetection for ppc.<br>
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.<br>
lib/System/Hosts.cpp<br>
This are the right place to add new PPC cpu/attributes autodetection
code.<br>
<a class="moz-txt-link-freetext" href="http://llvm.org/bugs/show_bug.cgi?id=5389">http://llvm.org/bugs/show_bug.cgi?id=5389</a><br>
<br>
<blockquote
 cite="mid:19e4cfaf1003180738u91cffb1h5de90bd3f6af1751@mail.gmail.com"
 type="cite">
  <div dir="ltr"><span class="Apple-style-span"
 style="font-family: arial,sans-serif; font-size: 15px; border-collapse: collapse;">
  <div><br>
  </div>
  <div>Can I turn Altivec support on (and off, I need both cases) from
the code? Some info: Mono's utilizes LLVM in this way:</div>
  <div><br>
  </div>
  <div>LLVMInitializePowerPCTarget ();</div>
  <div>LLVMInitializePowerPCTargetInfo ();</div>
  <div>ExecutionEngine *EE = ExecutionEngine::createJIT ( ... );</div>
  <div>fpm = new FunctionPassManager ( ... );</div>
  <div>
  <div>fpm->add(new TargetData(*EE->getTargetData()));</div>
  </div>
  </span></div>
</blockquote>
<br>
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:<br>
<br>
InitializeNativeTarget();   // use this instead of <span
 class="Apple-style-span"
 style="font-family: arial,sans-serif; font-size: 15px; border-collapse: collapse;">LLVMInitializePowerPCTarget
(); and </span><span class="Apple-style-span"
 style="font-family: arial,sans-serif; font-size: 15px; border-collapse: collapse;">LLVMInitializePowerPCTargetInfo
();</span><br>
<br>
EngineBuilder builder(Mod);<br>
builder.setMArch(MArch); // set arch  ppc_32 ppc_64 etc.<br>
builder.setMCPU(MCPU); // set desired cpu type for code generation<br>
builder.setMAttrs(MAttrs); // set desired cpu attributes (enable
Altivec etc)<br>
EE = builder.create();<br>
...<br>
<span class="Apple-style-span"
 style="font-family: arial,sans-serif; font-size: 15px; border-collapse: collapse;">fpm
= new FunctionPassManager ( ... );<br>
...</span><br>
<br>
<blockquote
 cite="mid:19e4cfaf1003180738u91cffb1h5de90bd3f6af1751@mail.gmail.com"
 type="cite">
  <div dir="ltr"><span class="Apple-style-span"
 style="font-family: arial,sans-serif; font-size: 15px; border-collapse: collapse;">
  <div>
  <div><br>
  </div>
  <div>and then uses ExecutionEngine object for compiling functions.</div>
  </div>
  </span>-- <br>
Regards,<br>
Sergei Dyshel<br>
  </div>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
  </pre>
</blockquote>
Cheers<br>
Xerxes<br>
</body>
</html>