1 ; Test codegen pipeline for SafeStack + StackProtector combination.
2 ; RUN: llc -mtriple=i386-linux < %s -o - | FileCheck --check-prefix=LINUX-I386 %s
3 ; RUN: llc -mtriple=x86_64-linux < %s -o - | FileCheck --check-prefix=LINUX-X64 %s
4 ; RUN: llc -mtriple=x86_64-fuchsia < %s -o - | FileCheck --check-prefix=FUCHSIA-X64 %s
6 define void @_Z1fv() safestack sspreq {
8 %x = alloca i32, align 4
9 %0 = bitcast i32* %x to i8*
10 call void @_Z7CapturePi(i32* nonnull %x)
14 declare void @_Z7CapturePi(i32*)
16 ; LINUX-X64-DAG: movq __safestack_unsafe_stack_ptr@GOTTPOFF(%rip), %[[A:.*]]
17 ; LINUX-X64-DAG: movq %fs:(%[[A]]), %[[B:.*]]
18 ; LINUX-X64-DAG: movq %fs:40, %[[COOKIE:.*]]
19 ; LINUX-X64-DAG: leaq -16(%[[B]]), %[[C:.*]]
20 ; LINUX-X64-DAG: movq %[[C]], %fs:(%[[A]])
21 ; LINUX-X64-DAG: movq %[[COOKIE]], -8(%[[B]])
23 ; LINUX-I386-DAG: movl __safestack_unsafe_stack_ptr@INDNTPOFF, %[[A:.*]]
24 ; LINUX-I386-DAG: movl %gs:(%[[A]]), %[[B:.*]]
25 ; LINUX-I386-DAG: movl %gs:20, %[[COOKIE:.*]]
26 ; LINUX-I386-DAG: leal -16(%[[B]]), %[[C:.*]]
27 ; LINUX-I386-DAG: movl %[[C]], %gs:(%[[A]])
28 ; LINUX-I386-DAG: movl %[[COOKIE]], -4(%[[B]])
30 ; FUCHSIA-X64-DAG: movq %fs:24, %[[B:.*]]
31 ; FUCHSIA-X64-DAG: movq %fs:16, %[[COOKIE:.*]]
32 ; FUCHSIA-X64-DAG: leaq -16(%[[B]]), %[[C:.*]]
33 ; FUCHSIA-X64-DAG: movq %[[C]], %fs:24
34 ; FUCHSIA-X64-DAG: movq %[[COOKIE]], -8(%[[B]])