1 ; RUN: llc < %s -march=x86 | FileCheck %s
3 @ok = internal constant [4 x i8] c"%d\0A\00"
4 @no = internal constant [4 x i8] c"no\0A\00"
6 define i1 @test1(i32 %v1, i32 %v2) nounwind {
8 %t = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %v1, i32 %v2)
9 %sum = extractvalue {i32, i1} %t, 0
10 %obit = extractvalue {i32, i1} %t, 1
11 br i1 %obit, label %overflow, label %normal
14 %t1 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind
18 %t2 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @no, i32 0, i32 0) ) nounwind
25 define i1 @test2(i32 %v1, i32 %v2) nounwind {
27 %t = call {i32, i1} @llvm.smul.with.overflow.i32(i32 %v1, i32 %v2)
28 %sum = extractvalue {i32, i1} %t, 0
29 %obit = extractvalue {i32, i1} %t, 1
30 br i1 %obit, label %overflow, label %normal
33 %t2 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @no, i32 0, i32 0) ) nounwind
37 %t1 = tail call i32 (i8*, ...) @printf( i8* getelementptr ([4 x i8], [4 x i8]* @ok, i32 0, i32 0), i32 %sum ) nounwind
44 declare i32 @printf(i8*, ...) nounwind
45 declare {i32, i1} @llvm.smul.with.overflow.i32(i32, i32)
47 define i32 @test3(i32 %a, i32 %b) nounwind readnone {
49 %tmp0 = add i32 %b, %a
50 %tmp1 = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 %tmp0, i32 2)
51 %tmp2 = extractvalue { i32, i1 } %tmp1, 0
59 define i32 @test4(i32 %a, i32 %b) nounwind readnone {
61 %tmp0 = add i32 %b, %a
62 %tmp1 = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 %tmp0, i32 4)
63 %tmp2 = extractvalue { i32, i1 } %tmp1, 0
71 declare { i63, i1 } @llvm.smul.with.overflow.i63(i63, i63) nounwind readnone
73 define i1 @test5() nounwind {
75 %res = call { i63, i1 } @llvm.smul.with.overflow.i63(i63 4, i63 4611686018427387903)
76 %sum = extractvalue { i63, i1 } %res, 0
77 %overflow = extractvalue { i63, i1 } %res, 1
79 ; Was returning false, should return true (not constant folded yet though).