Bill Wendling | 4c3b514d | 2013-09-11 19:06:04 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -disable-fp-elim -mtriple x86_64-apple-darwin11 -mcpu corei7 | FileCheck -check-prefix=ASM %s |
| 2 | ; RUN: llc < %s -disable-fp-elim -mtriple x86_64-apple-darwin11 -mcpu corei7 -filetype=obj -o - \ |
Bill Wendling | 58e2d3d | 2013-09-09 02:37:14 +0000 | [diff] [blame] | 3 | ; RUN: | llvm-objdump -triple x86_64-apple-darwin11 -s - \ |
| 4 | ; RUN: | FileCheck -check-prefix=CU %s |
Bill Wendling | 4c3b514d | 2013-09-11 19:06:04 +0000 | [diff] [blame] | 5 | ; RUN: llc < %s -disable-fp-elim -mtriple x86_64-apple-darwin11 -mcpu corei7 \ |
Bill Wendling | 19ba3c9 | 2013-09-09 20:29:32 +0000 | [diff] [blame] | 6 | ; RUN: | llvm-mc -triple x86_64-apple-darwin11 -filetype=obj -o - \ |
Bill Wendling | 93158ff | 2013-09-09 20:10:54 +0000 | [diff] [blame] | 7 | ; RUN: | llvm-objdump -triple x86_64-apple-darwin11 -s - \ |
| 8 | ; RUN: | FileCheck -check-prefix=FROM-ASM %s |
Bill Wendling | 07fe235 | 2013-05-09 20:10:38 +0000 | [diff] [blame] | 9 | |
| 10 | %ty = type { i8* } |
| 11 | |
| 12 | @gv = external global i32 |
| 13 | |
| 14 | ; This is aligning the stack with a push of a random register. |
Bill Wendling | 58e2d3d | 2013-09-09 02:37:14 +0000 | [diff] [blame] | 15 | ; ASM: pushq %rax |
Bill Wendling | 07fe235 | 2013-05-09 20:10:38 +0000 | [diff] [blame] | 16 | |
| 17 | ; Even though we can't encode %rax into the compact unwind, We still want to be |
| 18 | ; able to generate a compact unwind encoding in this particular case. |
Bill Wendling | 93158ff | 2013-09-09 20:10:54 +0000 | [diff] [blame] | 19 | |
Bill Wendling | 58e2d3d | 2013-09-09 02:37:14 +0000 | [diff] [blame] | 20 | ; CU: Contents of section __compact_unwind: |
| 21 | ; CU-NEXT: 0020 00000000 00000000 1e000000 01000101 |
| 22 | ; CU-NEXT: 0030 00000000 00000000 00000000 00000000 |
Bill Wendling | 07fe235 | 2013-05-09 20:10:38 +0000 | [diff] [blame] | 23 | |
Bill Wendling | 93158ff | 2013-09-09 20:10:54 +0000 | [diff] [blame] | 24 | ; FROM-ASM: Contents of section __compact_unwind: |
| 25 | ; FROM-ASM-NEXT: 0020 00000000 00000000 1e000000 01000101 |
| 26 | ; FROM-ASM-NEXT: 0030 00000000 00000000 00000000 00000000 |
| 27 | |
Bill Wendling | 07fe235 | 2013-05-09 20:10:38 +0000 | [diff] [blame] | 28 | define i8* @foo(i64 %size) { |
| 29 | %addr = alloca i64, align 8 |
| 30 | %tmp20 = load i32* @gv, align 4 |
| 31 | %tmp21 = call i32 @bar() |
| 32 | %tmp25 = load i64* %addr, align 8 |
| 33 | %tmp26 = inttoptr i64 %tmp25 to %ty* |
| 34 | %tmp29 = getelementptr inbounds %ty* %tmp26, i64 0, i32 0 |
| 35 | %tmp34 = load i8** %tmp29, align 8 |
| 36 | %tmp35 = getelementptr inbounds i8* %tmp34, i64 %size |
| 37 | store i8* %tmp35, i8** %tmp29, align 8 |
| 38 | ret i8* null |
| 39 | } |
| 40 | |
| 41 | declare i32 @bar() |