<div dir="ltr">LLVM will only generate MMX instructions from intrinsics. There is no support for creating mmx instructions from the vectorizers.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 10, 2015 at 11:01 PM, suyog sarda <span dir="ltr"><<a href="mailto:sardask01@gmail.com" target="_blank">sardask01@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">Hi Kevin,</p>
<p dir="ltr">Thanks for the reply.</p>
<p dir="ltr">The target-cpu generated in IR is pentium4 which has SSE. But we are overriding that by specifying features as "+mmx, -sse" which means we are disallowing SSE and only allowing MMX. </p>
<p dir="ltr">I further tried to see if it can vectorize (SLP) with MMX and without SSE. At the start of SLP vectorization, it checks if target has vector registers or not. For above IR, we have MMX on and SSE off. If I am not wrong, target with MMX feature has vector registers, and hence it should vectorize. But it is not vectorizing the IR.</p>
<p dir="ltr">Am I missing something here? </p>
<p dir="ltr">Regards,<br>
Suyog Sarda</p><div class="HOEnZb"><div class="h5">
<div class="gmail_quote">On 11 Apr 2015 01:31, "Smith, Kevin B" <<a href="mailto:kevin.b.smith@intel.com" target="_blank">kevin.b.smith@intel.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">Your clang invocation below works for me, and generates target triple in the llvm IR of<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">i386.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">And then in the specific options for the functions it generates the following:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">; Function Attrs: nounwind<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">define float @foo() #0 {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">entry:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"> ret float 1.000000e+00<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">}<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"=<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">"true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-ma<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">th"="false" "stack-protector-buffer-size"="8" "target-cpu"="pentium4" "target-fe<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">atures"="+mmx,-sse" "unsafe-fp-math"="false" "use-soft-float"="false" }<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">The attributes indicate to allow mmx, disallow sse, so this certainly looks like it might work. I don’t<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">know whether work has been done to specifically do something special for this combination, since<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">use of MMX overlaps with X87 floating point state. The processors that support mmx, but not SSE<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">would be<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">Pentium w MMX processor<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">Pentium II family processors<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d">Kevin<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> suyog sarda [mailto:<a href="mailto:sardask01@gmail.com" target="_blank">sardask01@gmail.com</a>]
<br>
<b>Sent:</b> Friday, April 10, 2015 2:51 AM<br>
<b>To:</b> Smith, Kevin B<br>
<b>Cc:</b> Sanjay Patel; David Majnemer; LLVM Developers Mailing List<br>
<b>Subject:</b> Re: [LLVMdev] MMX/SSE subtarget feature in IR<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">Hi Kevin,<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I had another query for 32 bit x86. (Apology for being naive) <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I guess <span style="color:black">the default CPU on 32-bit x86 is 'pentium4', which has SSE as seen in getX86TargetCPU() in tools/clang/lib/Driver/Tools.cpp:</span><u></u><u></u></p>
</div>
<pre style="white-space:pre-wrap"><span style="color:black">static const char *getX86TargetCPU(const ArgList &Args,<u></u><u></u></span></pre>
<pre><span style="color:black"> const llvm::Triple &Triple) {<u></u><u></u></span></pre>
<pre><span style="color:black">...<u></u><u></u></span></pre>
<pre><span style="color:black"> // Everything else goes to x86-64 in 64-bit mode.<u></u><u></u></span></pre>
<pre><span style="color:black"> if (Is64Bit)<u></u><u></u></span></pre>
<pre><span style="color:black"> return "x86-64";<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black"> switch (Triple.getOS()) {<u></u><u></u></span></pre>
<pre><span style="color:black"> case llvm::Triple::FreeBSD:<u></u><u></u></span></pre>
<pre><span style="color:black"> case llvm::Triple::NetBSD:<u></u><u></u></span></pre>
<pre><span style="color:black"> case llvm::Triple::OpenBSD:<u></u><u></u></span></pre>
<pre><span style="color:black"> return "i486";<u></u><u></u></span></pre>
<pre><span style="color:black"> case llvm::Triple::Haiku:<u></u><u></u></span></pre>
<pre><span style="color:black"> return "i586";<u></u><u></u></span></pre>
<pre><span style="color:black"> case llvm::Triple::Bitrig:<u></u><u></u></span></pre>
<pre><span style="color:black"> return "i686";<u></u><u></u></span></pre>
<pre><span style="color:black"> default:<u></u><u></u></span></pre>
<pre><span style="color:black"> // Fallback to p4.<u></u><u></u></span></pre>
<pre><span style="color:black"> return "pentium4";<u></u><u></u></span></pre>
<pre><span style="color:black"> }<u></u><u></u></span></pre>
<pre><span style="color:black">}<u></u><u></u></span></pre>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Is there any 32-bit CPU with MMX feature but without SSE feature?</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">Can it be done as follows :</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">$ clang 1.c -mmmx -mno-sse -emit-llvm -S -target i386.</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="color:black">My intention is to generate IR for x86 32 bit CPU with MMX feature but without SSE feature and further investigate if vectorization triggers for 32 bit architecture with MMX feature only.</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Regards,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Suyog Sarda<u></u><u></u></p>
</div>
</div>
</div>
</div>
</blockquote></div>
</div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">~Craig</div>
</div>