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 call void @_Z7CapturePi(ptr nonnull %x)
13 declare void @_Z7CapturePi(ptr)
15 ; LINUX-X64-DAG: movq __safestack_unsafe_stack_ptr@GOTTPOFF(%rip), %[[A:.*]]
16 ; LINUX-X64-DAG: movq %fs:(%[[A]]), %[[B:.*]]
17 ; LINUX-X64-DAG: movq %fs:40, %[[COOKIE:.*]]
18 ; LINUX-X64-DAG: leaq -16(%[[B]]), %[[C:.*]]
19 ; LINUX-X64-DAG: movq %[[C]], %fs:(%[[A]])
20 ; LINUX-X64-DAG: movq %[[COOKIE]], -8(%[[B]])
22 ; LINUX-I386-DAG: movl __safestack_unsafe_stack_ptr@INDNTPOFF, %[[A:.*]]
23 ; LINUX-I386-DAG: movl %gs:(%[[A]]), %[[B:.*]]
24 ; LINUX-I386-DAG: movl %gs:20, %[[COOKIE:.*]]
25 ; LINUX-I386-DAG: leal -16(%[[B]]), %[[C:.*]]
26 ; LINUX-I386-DAG: movl %[[C]], %gs:(%[[A]])
27 ; LINUX-I386-DAG: movl %[[COOKIE]], -4(%[[B]])
29 ; FUCHSIA-X64-DAG: movq %fs:24, %[[B:.*]]
30 ; FUCHSIA-X64-DAG: movq %fs:16, %[[COOKIE:.*]]
31 ; FUCHSIA-X64-DAG: leaq -16(%[[B]]), %[[C:.*]]
32 ; FUCHSIA-X64-DAG: movq %[[C]], %fs:24
33 ; FUCHSIA-X64-DAG: movq %[[COOKIE]], -8(%[[B]])