[LLVMbugs] [Bug 11812] New: Error in llvm.usub.with.overflow.i32 intrinsic [ARM]

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 20 06:17:24 PST 2012


             Bug #: 11812
           Summary: Error in llvm.usub.with.overflow.i32 intrinsic [ARM]
           Product: libraries
           Version: 2.8
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: LLVM assembly language parser
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: malvikus at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 7914
  --> http://llvm.org/bugs/attachment.cgi?id=7914
Test llvm.usub.with.overflow.i32 for unsigned overflow

When I run simplified test (for testing llvm.usub.with.overflow.i32 intrinsic)
I've got wrong result. 
This test:
store i32 1073741824, i32* @R6
store i32 536870912, i32* @R5
%FIRST = load i32* @R6
%SECOND = load i32* @R5

%RESULT = call {i32, i1} @llvm.usub.with.overflow.i32(i32 %FIRST, i32 %SECOND)
%CARRY = extractvalue {i32, i1} %RESULT, 1
%VALUE = extractvalue {i32, i1} %RESULT, 0
call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([10 x i8]*
@str_main_14, i64 0, i64 0), i1 %CARRY)
call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([10 x i8]*
@str_main_14, i64 0, i64 0), i32 %VALUE)

I've got wrong result - 0 in CARRY (should be 1 as unsigned overflow).
This code generate following asm-code:
add r1, r0, #-536870912 ; 0xe0000000 (in GDB)
the same as add    r1, r0, #14, 4    @ -536870912 (generated by llc)
which is wrong as is losing carry flag. 
Should be following:
adds r1, r0, #-536870912

How I've compiled:
1) llvm-as temp/test.ll -o temp/mycode.bc
2) llc -O0 temp/mycode.bc -o temp/mycode.s
3) arm-ololo-linux-gnueabi-gcc -O0 temp/mycode.s -o temp/mycode.llvm.exe

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