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 -mattr=+tpidr-el1 < %s -o - | FileCheck --check-prefixes=FUCHSIA-AARCH64-COMMON,FUCHSIA-AARCH64-KERNEL %s
5 ; RUN: llc -mtriple=aarch64-windows < %s -o - | FileCheck --check-prefix=WINDOWS-AARCH64 %s
6 ; RUN: llc -mtriple=arm64ec-windows-msvc < %s -o - | FileCheck --check-prefix=WINDOWS-ARM64EC %s
8 define void @_Z1fv() sspreq {
10 %x = alloca i32, align 4
11 call void @_Z7CapturePi(ptr nonnull %x)
15 declare void @_Z7CapturePi(ptr)
17 ; ANDROID-AARCH64: mrs [[A:.*]], TPIDR_EL0
18 ; ANDROID-AARCH64: ldr [[B:.*]], [[[A]], #40]
19 ; ANDROID-AARCH64: str [[B]], [sp,
20 ; ANDROID-AARCH64: ldr [[C:.*]], [[[A]], #40]
21 ; ANDROID-AARCH64: ldr [[D:.*]], [sp,
22 ; ANDROID-AARCH64: cmp [[C]], [[D]]
24 ; FUCHSIA-AARCH64-USER: mrs [[A:.*]], TPIDR_EL0
25 ; FUCHSIA-AARCH64-KERNEL: mrs [[A:.*]], TPIDR_EL1
26 ; FUCHSIA-AARCH64-COMMON: ldur [[B:.*]], [[[A]], #-16]
27 ; FUCHSIA-AARCH64-COMMON: str [[B]], [sp,
28 ; FUCHSIA-AARCH64-COMMON: ldur [[C:.*]], [[[A]], #-16]
29 ; FUCHSIA-AARCH64-COMMON: ldr [[D:.*]], [sp,
30 ; FUCHSIA-AARCH64-COMMON: cmp [[C]], [[D]]
32 ; WINDOWS-AARCH64: adrp x8, __security_cookie
33 ; WINDOWS-AARCH64: ldr x8, [x8, :lo12:__security_cookie]
34 ; WINDOWS-AARCH64: str x8, [sp, #8]
35 ; WINDOWS-AARCH64: bl _Z7CapturePi
36 ; WINDOWS-AARCH64: ldr x0, [sp, #8]
37 ; WINDOWS-AARCH64: bl __security_check_cookie
39 ; WINDOWS-ARM64EC: adrp x8, __security_cookie
40 ; WINDOWS-ARM64EC: ldr x8, [x8, :lo12:__security_cookie]
41 ; WINDOWS-ARM64EC: str x8, [sp, #8]
42 ; WINDOWS-ARM64EC: bl "#_Z7CapturePi"
43 ; WINDOWS-ARM64EC: ldr x0, [sp, #8]
44 ; WINDOWS-ARM64EC: bl "#__security_check_cookie_arm64ec"