<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div>Hi,</div>
<div> </div>
<div>I analyzed the folding DAG nodes algorithm in LLVM, compared to code generated by Intel compiler and got into conclusion that the LLVM code is not always optimal.</div>
<div>This is an example:</div>
<div> </div>
<div>  %b1 = fadd <8 x float> %a1, <float AAA, float AAA, float AAA, float AAA, float AAA, float AAA, float AAA, float AAA ></div>
<div>  %b2 = fadd <8 x float> %a2, <float AAA, float AAA, float AAA, float AAA, float AAA, float AAA, float AAA, float AAA ></div>
<div>  %c = fmul <8 x float> %b1, %b2</div>
<div> </div>
<div>The result (1) bellow is not better than (2), because loading constant is not a problem, but spilling %ymm2 that may be required  in (1) is not cheap.</div>
<div> </div>
<div>(1)</div>
<div>        vmovaps .LCPI1_0(%rip), %ymm2</div>
<div>        vaddps  %ymm2, %ymm1, %ymm1</div>
<div>        vaddps  %ymm2, %ymm0, %ymm0</div>
<div>        vmulps  %ymm1, %ymm0, %ymm0</div>
<div> </div>
<div>(2)</div>
<div>        vaddps  .LCPI1_0(%rip), %ymm1, %ymm1</div>
<div>        vaddps  .LCPI1_0(%rip),  %ymm0, %ymm0</div>
<div>        vmulps  %ymm1, %ymm0, %ymm0</div>
<div> </div>
<div>In the attached patch I did a minor thing that does not change the current algorithm, but allows to add some target-specific analysis.</div>
<div> </div>
<div>Please review.</div>
<div> </div>
<div>Thank you.</div>
<div> </div>
<ul style="margin:0;padding-left:36pt;">
<font face="Times New Roman" size="3" color="#31849B"><span style="font-size:12pt;">
<li><b><i> Elena</i></b></li></span></font>
</ul>
<div> </div>
<div> </div>
<div> </div>
</span></font>
<p>---------------------------------------------------------------------<br>
Intel Israel (74) Limited</p>

<p>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.</p></body>
</html>