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

Reply via email to