<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - APFloat::fusedMultiplyAdd is broken when addend is 0"
   href="http://llvm.org/bugs/show_bug.cgi?id=20832">20832</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>APFloat::fusedMultiplyAdd is broken when addend is 0
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Support Libraries
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>greg_bedwell@sn.scee.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I believe the following testcase demonstrates a bug in
APFloat::fusedMultiplyAdd.  I would expect this to produce a result of 56
((7*8)+0) but instead it produces 7.  The addend being 0 seems to be the key.

----------------------------------------------------------------------
declare double @llvm.fma.f64(double, double, double) nounwind

define double @_Z4testv() nounwind {
  %1 = call double @llvm.fma.f64(double 7.000000e+00, double 8.000000e+00,
double 0.000000e+00)
  ret double %1
}
----------------------------------------------------------------------

Using r216885:
llc test.ll -mtriple=x86_64-unknown-unknown -o -

we get the following constant generated:
.quad   4619567317775286272     # double 7

Within the function APFloat::fusedMultiplyAdd it calls multiplySpecials which
returns opOK allowing the call to addOrSubtract to occur, however at no point
is the actual multiplication performed, meaning that we essentially do 7+0,
ignoring the multiplicand entirely.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>