1 ; RUN: llc < %s 2 ; RUN: llc < %s -fast-isel 3 4 @ok = internal constant [4 x i8] c"%d\0A\00" 5 @no = internal constant [4 x i8] c"no\0A\00" 6 7 define i1 @func1(i32 %v1, i32 %v2) nounwind { 8 entry: 9 %t = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %v1, i32 %v2) 10 %sum = extractvalue {i32, i1} %t, 0 11 %obit = extractvalue {i32, i1} %t, 1 12 br i1 %obit, label %overflow, label %normal 13 14 normal: 15 %t1 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind 16 ret i1 true 17 18 overflow: 19 %t2 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @no, i32 0, i32 0) ) nounwind 20 ret i1 false 21 } 22 23 define i1 @func2(i32 %v1, i32 %v2) nounwind { 24 entry: 25 %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %v1, i32 %v2) 26 %sum = extractvalue {i32, i1} %t, 0 27 %obit = extractvalue {i32, i1} %t, 1 28 br i1 %obit, label %overflow, label %normal 29 30 normal: 31 %t1 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind 32 ret i1 true 33 34 overflow: 35 %t2 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @no, i32 0, i32 0) ) nounwind 36 ret i1 false 37 } 38 39 declare i32 @printf(i8*, ...) nounwind 40 declare {i32, i1} @llvm.sadd.with.overflow.i32(i32, i32) 41 declare {i32, i1} @llvm.uadd.with.overflow.i32(i32, i32) 42