1; RUN: llc < %s -mtriple x86_64-apple-darwin11 -O0 -fast-isel-abort | FileCheck %s
2
3%struct.x = type { i64, i64 }
4%addovf = type { i32, i1 }
5declare %struct.x @f()
6
7define void @test1(i64*) nounwind ssp {
8  %2 = tail call %struct.x @f() nounwind
9  %3 = extractvalue %struct.x %2, 0
10  %4 = add i64 %3, 10
11  store i64 %4, i64* %0
12  ret void
13; CHECK-LABEL: test1:
14; CHECK: callq _f
15; CHECK-NEXT: addq	$10, %rax
16}
17
18define void @test2(i64*) nounwind ssp {
19  %2 = tail call %struct.x @f() nounwind
20  %3 = extractvalue %struct.x %2, 1
21  %4 = add i64 %3, 10
22  store i64 %4, i64* %0
23  ret void
24; CHECK-LABEL: test2:
25; CHECK: callq _f
26; CHECK-NEXT: addq	$10, %rdx
27}
28
29declare %addovf @llvm.sadd.with.overflow.i32(i32, i32) nounwind readnone
30
31define void @test3(i32 %x, i32 %y, i32* %z) {
32  %r = call %addovf @llvm.sadd.with.overflow.i32(i32 %x, i32 %y)
33  %sum = extractvalue %addovf %r, 0
34  %sum3 = mul i32 %sum, 3
35  %bit = extractvalue %addovf %r, 1
36  br i1 %bit, label %then, label %end
37
38then:
39  store i32 %sum3, i32* %z
40  br label %end
41
42end:
43  ret void
44; CHECK: test3
45; CHECK: addl
46; CHECK: seto %al
47; CHECK: testb $1, %al
48}
49