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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to