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; RUN: llc -mtriple=x86_64-fuchsia < %s -o - | FileCheck --check-prefix=FUCHSIA-X64 %s 6 7; RUN: llc -mtriple=i386-linux -safestack-use-pointer-address < %s -o - | FileCheck --check-prefix=LINUX-I386-PA %s 8 9define void @_Z1fv() safestack { 10entry: 11 %x = alloca i32, align 4 12 %0 = bitcast i32* %x to i8* 13 call void @_Z7CapturePi(i32* nonnull %x) 14 ret void 15} 16 17declare void @_Z7CapturePi(i32*) 18 19; LINUX-X64: movq __safestack_unsafe_stack_ptr@GOTTPOFF(%rip), %[[A:.*]] 20; LINUX-X64: movq %fs:(%[[A]]), %[[B:.*]] 21; LINUX-X64: leaq -16(%[[B]]), %[[C:.*]] 22; LINUX-X64: movq %[[C]], %fs:(%[[A]]) 23 24; LINUX-I386: movl __safestack_unsafe_stack_ptr@INDNTPOFF, %[[A:.*]] 25; LINUX-I386: movl %gs:(%[[A]]), %[[B:.*]] 26; LINUX-I386: leal -16(%[[B]]), %[[C:.*]] 27; LINUX-I386: movl %[[C]], %gs:(%[[A]]) 28 29; ANDROID-I386: movl %gs:36, %[[A:.*]] 30; ANDROID-I386: leal -16(%[[A]]), %[[B:.*]] 31; ANDROID-I386: movl %[[B]], %gs:36 32 33; ANDROID-X64: movq %fs:72, %[[A:.*]] 34; ANDROID-X64: leaq -16(%[[A]]), %[[B:.*]] 35; ANDROID-X64: movq %[[B]], %fs:72 36 37; FUCHSIA-X64: movq %fs:24, %[[A:.*]] 38; FUCHSIA-X64: leaq -16(%[[A]]), %[[B:.*]] 39; FUCHSIA-X64: movq %[[B]], %fs:24 40 41; LINUX-I386-PA: calll __safestack_pointer_address 42; LINUX-I386-PA: movl %eax, %[[A:.*]] 43; LINUX-I386-PA: movl (%eax), %[[B:.*]] 44; LINUX-I386-PA: leal -16(%[[B]]), %[[C:.*]] 45; LINUX-I386-PA: movl %[[C]], (%[[A]]) 46