llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

__int128 decrement is broken

Open kcc opened this issue 14 years ago • 1 comments

Bugzilla Link 13704
Resolution FIXED
Resolved on Aug 28, 2012 11:58
Version trunk
OS Linux
CC @darkbuck

Extended Description

% 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

kcc avatar Aug 27 '12 09:08 kcc

fixed by r162766.

darkbuck avatar Aug 28 '12 18:08 darkbuck