1 ; RUN: llc < %s -mtriple=x86_64-pc-win32 | FileCheck %s 2 3 define i32 @f1(i32 %p1, i32 %p2, i32 %p3, i32 %p4, i32 %p5) "no-frame-pointer-elim"="true" { 4 ; CHECK-LABEL: f1: 5 ; CHECK: movl 48(%rbp), %eax 6 ret i32 %p5 7 } 8 9 define void @f2(i32 %p, ...) "no-frame-pointer-elim"="true" { 10 ; CHECK-LABEL: f2: 11 ; CHECK: .seh_stackalloc 8 12 ; CHECK: movq %rsp, %rbp 13 ; CHECK: .seh_setframe 5, 0 14 ; CHECK: movq %rdx, 32(%rbp) 15 ; CHECK: leaq 32(%rbp), %rax 16 %ap = alloca i8, align 8 17 call void @llvm.va_start(i8* %ap) 18 ret void 19 } 20 21 define i8* @f3() "no-frame-pointer-elim"="true" { 22 ; CHECK-LABEL: f3: 23 ; CHECK: movq %rsp, %rbp 24 ; CHECK: .seh_setframe 5, 0 25 ; CHECK: movq 8(%rbp), %rax 26 %ra = call i8* @llvm.returnaddress(i32 0) 27 ret i8* %ra 28 } 29 30 define i8* @f4() "no-frame-pointer-elim"="true" { 31 ; CHECK-LABEL: f4: 32 ; CHECK: pushq %rbp 33 ; CHECK: .seh_pushreg 5 34 ; CHECK: subq $304, %rsp 35 ; CHECK: .seh_stackalloc 304 36 ; CHECK: leaq 128(%rsp), %rbp 37 ; CHECK: .seh_setframe 5, 128 38 ; CHECK: .seh_endprologue 39 ; CHECK: movq 184(%rbp), %rax 40 alloca [300 x i8] 41 %ra = call i8* @llvm.returnaddress(i32 0) 42 ret i8* %ra 43 } 44 45 declare void @external(i8*) 46 47 define void @f5() "no-frame-pointer-elim"="true" { 48 ; CHECK-LABEL: f5: 49 ; CHECK: subq $336, %rsp 50 ; CHECK: .seh_stackalloc 336 51 ; CHECK: leaq 128(%rsp), %rbp 52 ; CHECK: .seh_setframe 5, 128 53 ; CHECK: leaq -92(%rbp), %rcx 54 ; CHECK: callq external 55 %a = alloca [300 x i8] 56 %gep = getelementptr [300 x i8], [300 x i8]* %a, i32 0, i32 0 57 call void @external(i8* %gep) 58 ret void 59 } 60 61 define void @f6(i32 %p, ...) "no-frame-pointer-elim"="true" { 62 ; CHECK-LABEL: f6: 63 ; CHECK: subq $336, %rsp 64 ; CHECK: .seh_stackalloc 336 65 ; CHECK: leaq 128(%rsp), %rbp 66 ; CHECK: .seh_setframe 5, 128 67 ; CHECK: leaq -92(%rbp), %rcx 68 ; CHECK: callq external 69 %a = alloca [300 x i8] 70 %gep = getelementptr [300 x i8], [300 x i8]* %a, i32 0, i32 0 71 call void @external(i8* %gep) 72 ret void 73 } 74 75 define i32 @f7(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) "no-frame-pointer-elim"="true" { 76 ; CHECK-LABEL: f7: 77 ; CHECK: pushq %rbp 78 ; CHECK: .seh_pushreg 5 79 ; CHECK: subq $304, %rsp 80 ; CHECK: .seh_stackalloc 304 81 ; CHECK: leaq 128(%rsp), %rbp 82 ; CHECK: .seh_setframe 5, 128 83 ; CHECK: andq $-64, %rsp 84 ; CHECK: movl 224(%rbp), %eax 85 ; CHECK: leaq 176(%rbp), %rsp 86 alloca [300 x i8], align 64 87 ret i32 %e 88 } 89 90 define i32 @f8(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) "no-frame-pointer-elim"="true" { 91 ; CHECK-LABEL: f8: 92 ; CHECK: subq $352, %rsp 93 ; CHECK: .seh_stackalloc 352 94 ; CHECK: leaq 128(%rsp), %rbp 95 ; CHECK: .seh_setframe 5, 128 96 97 %alloca = alloca [300 x i8], align 64 98 ; CHECK: andq $-64, %rsp 99 ; CHECK: movq %rsp, %rbx 100 101 alloca i32, i32 %a 102 ; CHECK: movl %ecx, %eax 103 ; CHECK: leaq 15(,%rax,4), %rcx 104 ; CHECK: movabsq $34359738352, %rax 105 ; CHECK: andq %rcx, %rax 106 ; CHECK: callq __chkstk 107 ; CHECK: subq %rax, %rsp 108 109 %gep = getelementptr [300 x i8], [300 x i8]* %alloca, i32 0, i32 0 110 call void @external(i8* %gep) 111 ; CHECK: subq $32, %rsp 112 ; CHECK: leaq (%rbx), %rcx 113 ; CHECK: callq external 114 ; CHECK: addq $32, %rsp 115 116 ret i32 %e 117 ; CHECK: movl %esi, %eax 118 ; CHECK: leaq 224(%rbp), %rsp 119 } 120 121 declare i8* @llvm.returnaddress(i32) nounwind readnone 122 123 declare void @llvm.va_start(i8*) nounwind 124