<html><body>
<p><font size="2" face="sans-serif">Hi,</font><br>
<br>
<font size="2" face="sans-serif">I think more opportunities might be added for FMA in the DAG combiner, please tell me what you think. Right now, those cases are implemented:</font><br>
<br>
<font size="2" face="sans-serif">fold (fadd (fmul x, y), z) -> (fma x, y, z)</font><br>
<font size="2" face="sans-serif">fold (fadd x, (fmul y, z)) -> (fma y, z, x)</font><br>
<br>
<font size="2" face="sans-serif">When the TLI callback "enableAggressiveFMAFusion" returns true, we might also support:</font><br>
<br>
<font size="2" face="sans-serif">fold (fadd (fma x, y, (fmul u, v)), z) -> (fma x, y (fma u, v, z))</font><br>
<font size="2" face="sans-serif">fold (fadd x, (fma y, z, (fmul u, v)) -> (fma y, z (fma u, v, x))</font><br>
<br>
<font size="2" face="sans-serif">This kind of reassociation generates two FMA for (x^2 + y^2 + z).</font><br>
<br>
<font size="2" face="sans-serif">Finally, specifically for the PPC target, we could ignore FP_EXTEND in the patterns above as it will be removed by the Machine Common Subexpression Elimination pass. For instance:</font><br>
<br>
<font size="2" face="sans-serif">fold (fadd (fpext (fmul x, y)), z) -> (fma x, y, z)</font><br>
<font size="2" face="sans-serif">fold (fadd (fpext (fma x, y, (fmul u, v))), z) -> (fma x, y (fma u, v, z))</font><br>
<font size="2" face="sans-serif">...</font><br>
<br>
<font size="2" face="sans-serif">Thanks for your help.</font><br>
<font size="2" face="sans-serif">Olivier</font></body></html>