• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=i386-linux < %s -o - | FileCheck --check-prefix=LINUX-I386 %s
2; RUN: llc -mtriple=x86_64-linux < %s -o - | FileCheck --check-prefix=LINUX-X64 %s
3; RUN: llc -mtriple=i386-linux-android < %s -o - | FileCheck --check-prefix=ANDROID-I386 %s
4; RUN: llc -mtriple=x86_64-linux-android < %s -o - | FileCheck --check-prefix=ANDROID-X64 %s
5
6define void @_Z1fv() safestack {
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; LINUX-X64: movq __safestack_unsafe_stack_ptr@GOTTPOFF(%rip), %[[A:.*]]
17; LINUX-X64: movq %fs:(%[[A]]), %[[B:.*]]
18; LINUX-X64: leaq -16(%[[B]]), %[[C:.*]]
19; LINUX-X64: movq %[[C]], %fs:(%[[A]])
20
21; LINUX-I386: movl __safestack_unsafe_stack_ptr@INDNTPOFF, %[[A:.*]]
22; LINUX-I386: movl %gs:(%[[A]]), %[[B:.*]]
23; LINUX-I386: leal -16(%[[B]]), %[[C:.*]]
24; LINUX-I386: movl %[[C]], %gs:(%[[A]])
25
26; ANDROID-I386: movl %gs:36, %[[A:.*]]
27; ANDROID-I386: leal -16(%[[A]]), %[[B:.*]]
28; ANDROID-I386: movl %[[B]], %gs:36
29
30; ANDROID-X64: movq %fs:72, %[[A:.*]]
31; ANDROID-X64: leaq -16(%[[A]]), %[[B:.*]]
32; ANDROID-X64: movq %[[B]], %fs:72
33