1 ; RUN: llc < %s -mtriple=i386-pc-linux -mcpu=corei7 -relocation-model=static | FileCheck --check-prefix=X86 %s
2 ; RUN: llc < %s -mtriple=i386-pc-linux -mcpu=corei7 -relocation-model=pic | FileCheck --check-prefix=PIC86 %s
3 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=corei7 -relocation-model=static | FileCheck --check-prefix=X64 %s
4 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=corei7 -relocation-model=pic | FileCheck --check-prefix=PIC64 %s
6 @buf = internal global [5 x i8*] zeroinitializer
8 declare i8* @llvm.frameaddress(i32) nounwind readnone
10 declare i8* @llvm.stacksave() nounwind
12 declare i32 @llvm.eh.sjlj.setjmp(i8*) nounwind
14 declare void @llvm.eh.sjlj.longjmp(i8*) nounwind
16 define i32 @sj0() nounwind {
17 %fp = tail call i8* @llvm.frameaddress(i32 0)
18 store i8* %fp, i8** getelementptr inbounds ([5 x i8*], [5 x i8*]* @buf, i64 0, i64 0), align 16
19 %sp = tail call i8* @llvm.stacksave()
20 store i8* %sp, i8** getelementptr inbounds ([5 x i8*], [5 x i8*]* @buf, i64 0, i64 2), align 16
21 %r = tail call i32 @llvm.eh.sjlj.setjmp(i8* bitcast ([5 x i8*]* @buf to i8*))
25 ; X86: movl %esp, buf+8
26 ; x86: movl ${{.*LBB.*}}, buf+4
29 ; PIC86: movl %ebp, buf@GOTOFF(%[[GOT:.*]])
30 ; PIC86: movl %esp, buf@GOTOFF+8(%[[GOT]])
31 ; PIC86: leal {{.*LBB.*}}@GOTOFF(%[[GOT]]), %[[LREG:.*]]
32 ; PIC86: movl %[[LREG]], buf@GOTOFF+4
35 ; x64: movq %rbp, buf(%rip)
36 ; x64: movq ${{.*LBB.*}}, buf+8(%rip)
37 ; X64: movq %rsp, buf+16(%rip)
40 ; PIC64: movq %rbp, buf(%rip)
41 ; PIC64: movq %rsp, buf+16(%rip)
42 ; PIC64: leaq {{.*LBB.*}}(%rip), %[[LREG:.*]]
43 ; PIC64: movq %[[LREG]], buf+8(%rip)
47 define void @lj0() nounwind {
48 tail call void @llvm.eh.sjlj.longjmp(i8* bitcast ([5 x i8*]* @buf to i8*))
52 ; X86: movl buf+4, %[[REG32:.*]]
53 ; X86: movl buf+8, %esp
54 ; X86: jmpl *%[[REG32]]
56 ; X64: movq buf(%rip), %rbp
57 ; X64: movq buf+8(%rip), %[[REG64:.*]]
58 ; X64: movq buf+16(%rip), %rsp
59 ; X64: jmpq *%[[REG64]]