[LLVMbugs] [Bug 13839] New: llvm.umul.with.overflow.i64 intrinsic gives incorrect result, erroneously returns true for overflow on x86-32

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 13 13:04:20 PDT 2012


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

             Bug #: 13839
           Summary: llvm.umul.with.overflow.i64 intrinsic gives incorrect
                    result, erroneously returns true for overflow on
                    x86-32
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: arcata at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following LLVM IR:

---
declare {i64, i1} @llvm.umul.with.overflow.i64(i64, i64) nounwind readnone
declare i32 @printf(i8*, ...)

@.str = private unnamed_addr constant [10 x i8] c"%llx, %d\0A\00", align 1

define i32 @main() nounwind {
    %1 = call {i64, i1} @llvm.umul.with.overflow.i64(i64 9, i64 8)
    %2 = extractvalue {i64, i1} %1, 0
    %3 = extractvalue {i64, i1} %1, 1
    %4 = zext i1 %3 to i32
    %5 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([10 x i8]*
@.str, i32 0, i32 0), i64 %2, i32 %4)
    ret i32 0
}
---

when compiled and linked for i386 as follows (on OS X, but the same failure
occurs on Win32 and Linux i386):

---
/usr/local/llvm-svn/bin/llc -O0 -mtriple=i386--darwin umul-with-overflow-i64.ll
-filetype=obj -o=umul-with-overflow-i64.o
clang -arch i386 umul-with-overflow-i64.o
---

outputs "48, 1" when run. It should output "72, 0".

-- 
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