summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Liao <michael.liao@intel.com>2012-10-17 02:22:27 +0000
committerMichael Liao <michael.liao@intel.com>2012-10-17 02:22:27 +0000
commit281ae5abf57a4d318d308c0dd1326ff65d540b78 (patch)
treee645a02ea0188674fb3dafaacd12786847f877db /test
parentd7ea7d5cd7518788dea698d38023959480c8263a (diff)
downloadllvm-281ae5abf57a4d318d308c0dd1326ff65d540b78.tar.gz
llvm-281ae5abf57a4d318d308c0dd1326ff65d540b78.tar.bz2
llvm-281ae5abf57a4d318d308c0dd1326ff65d540b78.tar.xz
Fix setjmp on models with non-Small code model nor non-Static relocation model
- MBB address is only valid as an immediate value in Small & Static code/relocation models. On other models, LEA is needed to load IP address of the restore MBB. - A minor fix of MBB in MC lowering is added as well to enable target relocation flag being propagated into MC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166084 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/sjlj.ll18
1 files changed, 16 insertions, 2 deletions
diff --git a/test/CodeGen/X86/sjlj.ll b/test/CodeGen/X86/sjlj.ll
index d594e98299..681db00943 100644
--- a/test/CodeGen/X86/sjlj.ll
+++ b/test/CodeGen/X86/sjlj.ll
@@ -1,5 +1,7 @@
; RUN: llc < %s -mtriple=i386-pc-linux -mcpu=corei7 -relocation-model=static | FileCheck --check-prefix=X86 %s
-; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=corei7 | FileCheck --check-prefix=X64 %s
+; RUN: llc < %s -mtriple=i386-pc-linux -mcpu=corei7 -relocation-model=pic | FileCheck --check-prefix=PIC86 %s
+; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=corei7 -relocation-model=static | FileCheck --check-prefix=X64 %s
+; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=corei7 -relocation-model=pic | FileCheck --check-prefix=PIC64 %s
@buf = internal global [5 x i8*] zeroinitializer
@@ -20,14 +22,26 @@ define i32 @sj0() nounwind {
ret i32 %r
; X86: sj0
; x86: movl %ebp, buf
-; x86: movl ${{.*LBB.*}}, buf+4
; X86: movl %esp, buf+8
+; x86: movl ${{.*LBB.*}}, buf+4
; X86: ret
+; PIC86: sj0
+; PIC86: movl %ebp, buf@GOTOFF(%[[GOT:.*]])
+; PIC86: movl %esp, buf@GOTOFF+8(%[[GOT]])
+; PIC86: leal {{.*LBB.*}}@GOTOFF(%[[GOT]]), %[[LREG:.*]]
+; PIC86: movl %[[LREG]], buf@GOTOFF+4
+; PIC86: ret
; X64: sj0
; x64: movq %rbp, buf(%rip)
; x64: movq ${{.*LBB.*}}, buf+8(%rip)
; X64: movq %rsp, buf+16(%rip)
; X64: ret
+; PIC64: sj0
+; PIC64: movq %rbp, buf(%rip)
+; PIC64: movq %rsp, buf+16(%rip)
+; PIC64: leaq {{.*LBB.*}}(%rip), %[[LREG:.*]]
+; PIC64: movq %[[LREG]], buf+8(%rip)
+; PIC64: ret
}
define void @lj0() nounwind {