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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


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

Reply via email to