61 lines · plain
1; RUN: llc < %s -mtriple=i386-pc-linux -mcpu=corei7 -relocation-model=static | FileCheck --check-prefix=X86 %s2; RUN: llc < %s -mtriple=i386-pc-linux -mcpu=corei7 -relocation-model=pic | FileCheck --check-prefix=PIC86 %s3; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=corei7 -relocation-model=static | FileCheck --check-prefix=X64 %s4; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=corei7 -relocation-model=pic | FileCheck --check-prefix=PIC64 %s5 6@buf = internal global [5 x ptr] zeroinitializer7 8declare ptr @llvm.frameaddress(i32) nounwind readnone9 10declare ptr @llvm.stacksave() nounwind11 12declare i32 @llvm.eh.sjlj.setjmp(ptr) nounwind13 14declare void @llvm.eh.sjlj.longjmp(ptr) nounwind15 16define i32 @sj0() nounwind {17 %fp = tail call ptr @llvm.frameaddress(i32 0)18 store ptr %fp, ptr @buf, align 1619 %sp = tail call ptr @llvm.stacksave()20 store ptr %sp, ptr getelementptr inbounds ([5 x ptr], ptr @buf, i64 0, i64 2), align 1621 %r = tail call i32 @llvm.eh.sjlj.setjmp(ptr @buf)22 ret i32 %r23; X86: sj024; x86: movl %ebp, buf25; X86: movl %esp, buf+826; x86: movl ${{.*LBB.*}}, buf+427; X86: ret28; PIC86: sj029; 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+433; PIC86: ret34; X64: sj035; x64: movq %rbp, buf(%rip)36; x64: movq ${{.*LBB.*}}, buf+8(%rip)37; X64: movq %rsp, buf+16(%rip)38; X64: ret39; PIC64: sj040; 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)44; PIC64: ret45}46 47define void @lj0() nounwind {48 tail call void @llvm.eh.sjlj.longjmp(ptr @buf)49 unreachable50; X86: lj051; X86: movl buf, %ebp52; X86: movl buf+4, %[[REG32:.*]]53; X86: movl buf+8, %esp54; X86: jmpl *%[[REG32]]55; X64: lj056; X64: movq buf(%rip), %rbp57; X64: movq buf+8(%rip), %[[REG64:.*]]58; X64: movq buf+16(%rip), %rsp59; X64: jmpq *%[[REG64]]60}61