[LLVMbugs] [Bug 20832] New: APFloat::fusedMultiplyAdd is broken when addend is

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Sep 2 01:40:18 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20832

            Bug ID: 20832
           Summary: APFloat::fusedMultiplyAdd is broken when addend is 0
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: greg_bedwell at sn.scee.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140902/56300c73/attachment.html>


More information about the llvm-bugs mailing list