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