<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=Windows-1252">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<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.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@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">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Our specialists (Intel) say that “vmovaps” and “vmovsd” have the same
</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">throughput</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> and latency, but “vmovsd” reduces chance of 4k aliasing, so it is preferable.<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"><b><i><span style="color:teal">- Elena</span></i></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p></o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<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""> llvmdev-bounces@cs.uiuc.edu [mailto:llvmdev-bounces@cs.uiuc.edu]
<b>On Behalf Of </b>Cameron McInally<br>
<b>Sent:</b> Thursday, July 26, 2012 17:50<br>
<b>To:</b> Jan Sjodin<br>
<b>Cc:</b> dag@cray.com; llvmdev@cs.uiuc.edu<br>
<b>Subject:</b> Re: [LLVMdev] X86 FMA4<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hey Jan and Dave,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">It's not obvious, but there is a significant scalar performance issue following the GCC intrinsics.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Let's look at the VFMADDSD pattern. We're operating on scalars with undefineds as the remaining vector elements of the operands. This sounds okay, but when one looks closer...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">       vmovsd  fp4_+1088(%rip), %xmm3  # fpppp.f:647<br>
       vmovaps %xmm3, 18560(%rsp)      # fpppp.f:647 <= 16-byte spill<br>
       vfmaddsd        %xmm5, fp4_+3288(%rip), %xmm3, %xmm3 # fpppp.f:647<o:p></o:p></p>
<div>
<p class="MsoNormal">The spill here is 16-bytes. But, we're only using the low 8-bytes of xmm3. Changing the intrinsics and patterns to accept scalar operands, we end up with...<o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><br>
       vmovsd  fp4_+1056(%rip), %xmm0  # fpppp.f:666<br>
       vmovsd  %xmm0, 10088(%rsp)      # fpppp.f:666 <= 8-byte spill<br>
       vfmaddsd        %xmm3, fp4_+3288(%rip), %xmm0, %xmm3 # fpppp.f:666<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I do not know the actual number of cycles offhand, but I believe on Interlagos and Sandybridge, a vmovaps takes roughly 3x as many micro-ops as a vmovsd if it involves memory.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">-Cameron<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Thu, Jul 26, 2012 at 9:41 AM, Jan Sjodin <<a href="mailto:jan_sjodin@yahoo.com" target="_blank">jan_sjodin@yahoo.com</a>> wrote:<o:p></o:p></p>
<p class="MsoNormal">Because the intrinsics uses vector types (same as gcc).<br>
<br>
<br>
- Jan<br>
<br>
<br>
<br>
----- Original Message -----<br>
> From: "<a href="mailto:dag@cray.com">dag@cray.com</a>" <<a href="mailto:dag@cray.com">dag@cray.com</a>><br>
> To: <a href="mailto:llvmdev@cs.uiuc.edu">llvmdev@cs.uiuc.edu</a><br>
> Cc:<br>
> Sent: Wednesday, July 25, 2012 3:26 PM<br>
> Subject: [LLVMdev] X86 FMA4<br>
><br>
> We're migrating to LLVM 3.1 and trying to use the upstream FMA patterns.<br>
><br>
> Why is VFMADDSD4 defined with vector types?  Is this simply because the<br>
> gcc intrinsic uses vector types?  It's quite unnatural if you have a<br>
> compiler that generates FMAs as opposed to requiring user intrinsics.<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
<font face="monospace">---------------------------------------------------------------------<br>
Intel Israel (74) Limited<br>
<br>
This e-mail and any attachments may contain confidential material for<br>
the sole use of the intended recipient(s). Any review or distribution<br>
by others is strictly prohibited. If you are not the intended<br>
recipient, please contact the sender and delete all copies.</font></body>
</html>