1; Test target-specific stack cookie location.
2; RUN: llc -mtriple=aarch64-linux-android < %s -o - | FileCheck --check-prefix=ANDROID-AARCH64 %s
3; RUN: llc -mtriple=aarch64-fuchsia < %s -o - | FileCheck --check-prefixes=FUCHSIA-AARCH64-COMMON,FUCHSIA-AARCH64-USER %s
4; RUN: llc -mtriple=aarch64-fuchsia -code-model=kernel < %s -o - | FileCheck --check-prefixes=FUCHSIA-AARCH64-COMMON,FUCHSIA-AARCH64-KERNEL %s
5
6define void @_Z1fv() sspreq {
7entry:
8  %x = alloca i32, align 4
9  %0 = bitcast i32* %x to i8*
10  call void @_Z7CapturePi(i32* nonnull %x)
11  ret void
12}
13
14declare void @_Z7CapturePi(i32*)
15
16; ANDROID-AARCH64: mrs [[A:.*]], TPIDR_EL0
17; ANDROID-AARCH64: ldr [[B:.*]], {{\[}}[[A]], #40]
18; ANDROID-AARCH64: str [[B]], [sp,
19; ANDROID-AARCH64: ldr [[C:.*]], {{\[}}[[A]], #40]
20; ANDROID-AARCH64: ldr [[D:.*]], [sp,
21; ANDROID-AARCH64: cmp [[C]], [[D]]
22
23; FUCHSIA-AARCH64-USER: mrs [[A:.*]], TPIDR_EL0
24; FUCHSIA-AARCH64-KERNEL: mrs [[A:.*]], TPIDR_EL1
25; FUCHSIA-AARCH64-COMMON: ldur [[B:.*]], {{\[}}[[A]], #-16]
26; FUCHSIA-AARCH64-COMMON: str [[B]], [sp,
27; FUCHSIA-AARCH64-COMMON: ldur [[C:.*]], {{\[}}[[A]], #-16]
28; FUCHSIA-AARCH64-COMMON: ldr [[D:.*]], [sp,
29; FUCHSIA-AARCH64-COMMON: cmp [[C]], [[D]]
30