Eli Friedman | 19515b4 | 2011-05-17 18:29:03 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -mtriple x86_64-apple-darwin11 -O0 -fast-isel-abort | FileCheck %s |
Eli Friedman | 2586b8f | 2011-05-16 20:27:46 +0000 | [diff] [blame] | 2 | |
| 3 | %struct.x = type { i64, i64 } |
Eli Friedman | 482feb3 | 2011-05-16 21:06:17 +0000 | [diff] [blame] | 4 | %addovf = type { i32, i1 } |
Eli Friedman | 2586b8f | 2011-05-16 20:27:46 +0000 | [diff] [blame] | 5 | declare %struct.x @f() |
| 6 | |
| 7 | define 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: test1: |
| 14 | ; CHECK: callq _f |
| 15 | ; CHECK-NEXT: addq $10, %rax |
| 16 | } |
| 17 | |
| 18 | define 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: test2: |
| 25 | ; CHECK: callq _f |
| 26 | ; CHECK-NEXT: addq $10, %rdx |
| 27 | } |
Eli Friedman | 482feb3 | 2011-05-16 21:06:17 +0000 | [diff] [blame] | 28 | |
| 29 | declare %addovf @llvm.sadd.with.overflow.i32(i32, i32) nounwind readnone |
| 30 | |
| 31 | define 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 | |
| 38 | then: |
| 39 | store i32 %sum3, i32* %z |
| 40 | br label %end |
| 41 | |
| 42 | end: |
| 43 | ret void |
| 44 | ; CHECK: test3 |
| 45 | ; CHECK: addl |
| 46 | ; CHECK: seto %al |
| 47 | ; CHECK: testb $1, %al |
| 48 | } |