<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div>
<div></div>
<div><font style="color:#333333"><i>Sent from my Verizon Wireless 4G LTE DROID</i></font></div>
<div><font style="color:#333333"><i>On Nov 19, 2016 10:26 AM, Sanjay Patel <</i></font><a href="mailto:spatel@rotateright.com"><font style="color:#333333"><i>spatel@rotateright.com</i></font></a><font style="color:#333333"><i>> wrote:</i></font></div>
<div><font style="color:#333333"><i>></i></font></div>
<div><font style="color:#333333"><i>> If I have my FMA intrinsics story straight now (thanks for the explanation, Hal!), I think it raises another question about IR canonicalization (and may affect the proposed revision to IR FMF):</i></font></div>
<div><font style="color:#333333"><i><br>
</i></font></div>
<div><font style="color:#333333"><i>No, I think that we specifically don't want to canonicalize to fmuladd at the IR level at all. If the backend has the freedom to form FMAs as it sees fit, then we should delay the decision until whenever the backend finds
 most appropriate. Some backends, for example, form FMAs using the MachineCombiner pass which considers critical path, latency, throughputs, etc. in order to find the best fusion opportunities. We only use fmuladd when required to restrict the backend to certain
 choices due to source-language semantics.</i></font></div>
<div><font style="color:#333333"><i><br>
</i></font></div>
<div><font style="color:#333333"><i>Thanks again,</i></font></div>
<div><font style="color:#333333"><i>Hal</i></font></div>
<div><font style="color:#333333"><i><br>
</i></font></div>
<div><font style="color:#333333"><i>></i></font></div>
<div><font style="color:#333333"><i>> define float @foo(float %a, float %b, float %c) {</i></font></div>
<div><font style="color:#333333"><i>>   %mul = fmul fast float %a, %b     ; using 'fast' because there is no 'fma' flag</i></font></div>
<div><font style="color:#333333"><i>>   %add = fadd fast float %mul, %c</i></font></div>
<div><font style="color:#333333"><i>>   ret float %add</i></font></div>
<div><font style="color:#333333"><i>> }</i></font></div>
<div><font style="color:#333333"><i>></i></font></div>
<div><font style="color:#333333"><i>> Should this be:</i></font></div>
<div><font style="color:#333333"><i>></i></font></div>
<div><font style="color:#333333"><i>> define float @goo(float %a, float %b, float %c) {</i></font></div>
<div><font style="color:#333333"><i>>   %</i></font><a href="http://maybe.fma"><font style="color:#333333"><i>maybe.fma</i></font></a><font style="color:#333333"><i> = call fast float @llvm.fmuladd.f32(float %a, float %b, float %c)</i></font></div>
<div><font style="color:#333333"><i>>   ret float %</i></font><a href="http://maybe.fma"><font style="color:#333333"><i>maybe.fma</i></font></a></div>
<div><font style="color:#333333"><i>> }</i></font></div>
<div><font style="color:#333333"><i>> declare float @llvm.fmuladd.f32(float %a, float %b, float %c)</i></font></div>
<div><font style="color:#333333"><i>></i></font></div>
<div><font style="color:#333333"><i>></i></font></div>
<div><font style="color:#333333"><i><br>
</i></font></div>
</div>
</body>
</html>