<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>I don't remember exactly why I did this.  I vaguely remember looking at this with one of the Sandybridge architects and following his suggestion.</div><div><br></div><div>When I look at it now, it looks like broadcasting the scalar would be faster because the 256 bit load on sandy bridge is double pumped.</div><div><br></div><div>I am CC-ing Elena, who should be able to tell.</div><br><div><div>On Nov 6, 2012, at 8:38 PM, Cameron McInally <<a href="mailto:cameron.mcinally@nyu.edu">cameron.mcinally@nyu.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">Hey guys,</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">I'm currently investigating broadcasts from the constant pool on Sandy Bridge. I see this comment in llvm/lib/Target/X86/X86ISelLowering.cpp:</div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); position: static; z-index: auto; ">
<div>   // Handle the broadcasting a single constant scalar from the constant pool</div><div>   // into a vector. On Sandybridge it is still better to load a constant vector</div><div>   // from the constant pool and not to broadcast it from a scalar.</div>
</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
Would anyone be able to explain why it is better to load a vector from the constant pool rather than broadcast a scalar? </div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">I checked out Agner Fog's tables, but it wasn't so obvious to me...</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)">
<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13px;background-color:rgb(255,255,255)"><pre style="white-space:pre-wrap;width:50em">vmovaps y, m256:
  Uops: 1
  Lat: 4
  Throughput: 1

vbroadcastsd y, m64:
  Uops: 2
  Lat: [Not or cannot be measured]
  Throughput: 1</pre><pre style="white-space:pre-wrap;width:50em;color:rgb(139,0,0)"><span style="font-family: arial; white-space: normal; "><br></span></pre><pre style="white-space:pre-wrap;width:50em;color:rgb(139,0,0)"><span style="font-family: arial; white-space: normal; ">Thanks in advance,</span></pre><pre style="white-space:pre-wrap;width:50em;color:rgb(139,0,0)"><span style="font-family: arial; white-space: normal; ">Cameron</span></pre>
</div>
_______________________________________________<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">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br></body></html>