42 lines · plain
1; RUN: llc < %s2; RUN: llc < %s -fast-isel3 4@ok = internal constant [4 x i8] c"%d\0A\00"5@no = internal constant [4 x i8] c"no\0A\00"6 7define i1 @func1(i32 %v1, i32 %v2) nounwind {8entry:9 %t = call {i32, i1} @llvm.sadd.with.overflow.i32(i32 %v1, i32 %v2)10 %sum = extractvalue {i32, i1} %t, 011 %obit = extractvalue {i32, i1} %t, 112 br i1 %obit, label %overflow, label %normal13 14normal:15 %t1 = tail call i32 (ptr, ...) @printf( ptr @ok, i32 %sum ) nounwind16 ret i1 true17 18overflow:19 %t2 = tail call i32 (ptr, ...) @printf( ptr @no ) nounwind20 ret i1 false21}22 23define i1 @func2(i32 %v1, i32 %v2) nounwind {24entry:25 %t = call {i32, i1} @llvm.uadd.with.overflow.i32(i32 %v1, i32 %v2)26 %sum = extractvalue {i32, i1} %t, 027 %obit = extractvalue {i32, i1} %t, 128 br i1 %obit, label %overflow, label %normal29 30normal:31 %t1 = tail call i32 (ptr, ...) @printf( ptr @ok, i32 %sum ) nounwind32 ret i1 true33 34overflow:35 %t2 = tail call i32 (ptr, ...) @printf( ptr @no ) nounwind36 ret i1 false37}38 39declare i32 @printf(ptr, ...) nounwind40declare {i32, i1} @llvm.sadd.with.overflow.i32(i32, i32)41declare {i32, i1} @llvm.uadd.with.overflow.i32(i32, i32)42