[LLVMbugs] [Bug 13991] New: llvm.smul.with.overflow overflow detection fails for 63 bit integer width

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 2 05:21:46 PDT 2012


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

             Bug #: 13991
           Summary: llvm.smul.with.overflow overflow detection fails for
                    63 bit integer width
           Product: libraries
           Version: 3.1
          Platform: PC
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: d.bussink at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


According to the documentation at
http://llvm.org/docs/LangRef.html#int_smul_overflow smul.with.overflow should
work for any integer bit width, but for a width of 63 bits there are some cases
where the overflow detection fails.

The following LLVM IR returns 0 instead of 1 in the overflow detection. If I
instead change it to multiplying 2 and 4611686018427387903 it does signal the
overflow in the overflow bit.


declare {i63, i1} @llvm.smul.with.overflow.i63(i63 %a, i63 %b)

define i1 @main() nounwind {
entry:

  %res = call {i63, i1} @llvm.smul.with.overflow.i63( i63 4, i63
4611686018427387903 )

  %sum = extractvalue {i63, i1} %res, 0
  %overflow = extractvalue {i63, i1} %res, 1

  ret i1 %overflow
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list