[LLVMbugs] [Bug 13704] New: __int128 decrement is broken

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Aug 27 00:45:40 PDT 2012


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

             Bug #: 13704
           Summary: __int128 decrement is broken
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: kcc at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


% cat m128.cc 
#include <stdio.h>
int main() {
  __int128 x = 2;
  x--;
  printf("%lx %lx\n", ((long*)(&x))[0], ((long*)(&x))[1]);
}


with gcc 4.7: 
% g++ m128.cc ; ./a.out 
1 0

with clang r162550:
% clang  m128.cc ; ./a.out 
1 1

clang   m128.cc -S -o - -emit-llvm
; ModuleID = 'm128.cc'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

define i32 @main() uwtable {
entry:
  %x = alloca i128, align 16
  store i128 2, i128* %x, align 16
  %0 = load i128* %x, align 16
  %dec = add nsw i128 %0, 18446744073709551615   <<<<<<<<<<<<<<<<<
  store i128 %dec, i128* %x, 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