<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<base href="x-msg://172/">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple style='word-wrap: break-word;
-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'>

<div class=WordSection1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Hi Chris,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>It's not broken, but the performance is crippled.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I noticed that the code still contains some MMX instructions,
but several operations get expanded (apparently swizzling and such get expanded
to a large number of byte moves).<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I could use intrinsics, but they wouldn't be optimized like
other vector operations. I could use SSE operations, but they would increase
SSE register pressure while MMX registers are left unused.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>So ideally I would like to inform LLVM that selecting MMX
instructions is fine. I'm inserting emms instructions in the right spots
myself.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Nicolas<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal style='margin-left:.5in'><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"'> Chris Lattner [mailto:clattner@apple.com] <br>
<b>Sent:</b> Tuesday, September 07, 2010 17:42<br>
<b>To:</b> Nicolas Capens<br>
<b>Cc:</b> llvmdev@cs.uiuc.edu<br>
<b>Subject:</b> Re: [LLVMdev] LLVM 2.8 and MMX<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p>

<p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p>

<div>

<div>

<p class=MsoNormal style='margin-left:.5in'>On Sep 7, 2010, at 7:45 AM, Nicolas
Capens wrote:<o:p></o:p></p>

</div>

<p class=MsoNormal style='margin-left:.5in'><br>
<br>
<o:p></o:p></p>

<div>

<div>

<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif"'>Hi all,<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif"'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif"'>I've tested a recent revision and noticed
that using 64-bit vectors became very slow. It looks like they are expanded to
non-MMX instructions to avoid breaking code which does not clear the MMX state
using emms?<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif"'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif"'>For my project I'm already manually
inserting emms instructions in the right places, so I'd really like 64-bit
vector operations to be lowered to MMX instructions for best performance. So is
there some way to get that behavior back? I tried making IsVerbotenVectorType
return false but that didn't appear to help.<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif"'> <o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif"'>I would be very grateful if someone would
add a switch to disable the expanding before the 2.8 release is finalized.<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'>The implementation of MMX is in a
state of flux: the plan is to stop generic vectors from being selected to mmx
operations, and add intrinsics for every mmx operations (including add).  However,
2.8 shouldn't be broken, that would be a serious regression.  Please file
a bug with a small example.  Thanks!<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'><o:p> </o:p></p>

</div>

<div>

<p class=MsoNormal style='margin-left:.5in'>-Chris<o:p></o:p></p>

</div>

</div>

</body>

</html>