[LLVMbugs] [Bug 3975] New: llvm-gcc has some problem with int128 arithmetic

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sun Apr 12 23:59:29 PDT 2009


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

           Summary: llvm-gcc has some problem with int128 arithmetic
           Product: tools
           Version: 2.2
          Platform: PC
        OS/Version: All
            Status: NEW
          Keywords: miscompilation
          Severity: normal
          Priority: P2
         Component: llvm-g++
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: baldrick at free.fr, llvmbugs at cs.uiuc.edu


Consider this at -m64:
__uint128_t test2() {
  const __uint128_t c_zero = ~0;
  return c_zero;
}

This should compile to all 128 ones because the -1 signed integer sign extends
to i128. GCC produces the correct code:

__Z5test2v:
LFB8:
        pushq   %rbp
LCFI0:
        movq    %rsp, %rbp
LCFI1:
        movq    $-1, %rax
        movq    $-1, %rdx
        leave
        ret

but we compile it to 64 ones:

define i128 @_Z5test2v() nounwind readnone {
entry:
        ret i128 18446744073709551615
}

I think this is some problem in llvm-gcc, because the -O0 IR is already wrong:

        store i128 18446744073709551615, i128* %c_zero, align 16


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