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 - \
3; RUN:  | llvm-objdump -triple x86_64-apple-darwin11 -s - \
4; RUN:  | FileCheck -check-prefix=CU %s
5; RUN: llc < %s -disable-fp-elim -mtriple x86_64-apple-darwin11 -mcpu corei7 \
6; RUN:  | llvm-mc -triple x86_64-apple-darwin11 -filetype=obj -o - \
7; RUN:  | llvm-objdump -triple x86_64-apple-darwin11 -s - \
8; RUN:  | FileCheck -check-prefix=FROM-ASM %s
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.
15; ASM: pushq %rax
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.
19
20; CU:      Contents of section __compact_unwind:
21; CU-NEXT: 0020 00000000 00000000 1e000000 01000101
22; CU-NEXT: 0030 00000000 00000000 00000000 00000000
23
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
28define 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
41declare i32 @bar()
42