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