1 ; RUN: llc < %s 2 3 @ok = internal constant [4 x i8] c"%d\0A\00" 4 @no = internal constant [4 x i8] c"no\0A\00" 5 6 define i1 @func1(i24 signext %v1, i24 signext %v2) nounwind { 7 entry: 8 %t = call {i24, i1} @llvm.sadd.with.overflow.i24(i24 %v1, i24 %v2) 9 %sum = extractvalue {i24, i1} %t, 0 10 %sum32 = sext i24 %sum to i32 11 %obit = extractvalue {i24, 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 %sum32 ) 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(i24 zeroext %v1, i24 zeroext %v2) nounwind { 24 entry: 25 %t = call {i24, i1} @llvm.uadd.with.overflow.i24(i24 %v1, i24 %v2) 26 %sum = extractvalue {i24, i1} %t, 0 27 %sum32 = zext i24 %sum to i32 28 %obit = extractvalue {i24, i1} %t, 1 29 br i1 %obit, label %carry, label %normal 30 31 normal: 32 %t1 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @ok, i32 0, i32 0), i32 %sum32 ) nounwind 33 ret i1 true 34 35 carry: 36 %t2 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([4 x i8]* @no, i32 0, i32 0) ) nounwind 37 ret i1 false 38 } 39 40 declare i32 @printf(i8*, ...) nounwind 41 declare {i24, i1} @llvm.sadd.with.overflow.i24(i24, i24) 42 declare {i24, i1} @llvm.uadd.with.overflow.i24(i24, i24) 43