diff options
Diffstat (limited to 'test/CodeGen/X86/stack-protector-target.ll')
-rw-r--r-- | test/CodeGen/X86/stack-protector-target.ll | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/CodeGen/X86/stack-protector-target.ll b/test/CodeGen/X86/stack-protector-target.ll new file mode 100644 index 0000000000000..66e45055b2b51 --- /dev/null +++ b/test/CodeGen/X86/stack-protector-target.ll @@ -0,0 +1,27 @@ +; Test target-specific stack cookie location. +; RUN: llc -mtriple=i386-linux < %s -o - | FileCheck --check-prefix=LINUX-I386 %s +; RUN: llc -mtriple=x86_64-linux < %s -o - | FileCheck --check-prefix=LINUX-X64 %s +; RUN: llc -mtriple=i386-linux-android < %s -o - | FileCheck --check-prefix=LINUX-I386 %s +; RUN: llc -mtriple=x86_64-linux-android < %s -o - | FileCheck --check-prefix=LINUX-X64 %s +; RUN: llc -mtriple=i386-kfreebsd < %s -o - | FileCheck --check-prefix=LINUX-I386 %s +; RUN: llc -mtriple=x86_64-kfreebsd < %s -o - | FileCheck --check-prefix=LINUX-X64 %s + +define void @_Z1fv() sspreq { +entry: + %x = alloca i32, align 4 + %0 = bitcast i32* %x to i8* + call void @_Z7CapturePi(i32* nonnull %x) + ret void +} + +declare void @_Z7CapturePi(i32*) + +; LINUX-X64: movq %fs:40, %[[B:.*]] +; LINUX-X64: movq %[[B]], 16(%rsp) +; LINUX-X64: movq %fs:40, %[[C:.*]] +; LINUX-X64: cmpq 16(%rsp), %[[C]] + +; LINUX-I386: movl %gs:20, %[[B:.*]] +; LINUX-I386: movl %[[B]], 8(%esp) +; LINUX-I386: movl %gs:20, %[[C:.*]] +; LINUX-I386: cmpl 8(%esp), %[[C]] |