1c7aea40eSRenato Golin; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s 2c7aea40eSRenato Golin; RUN: llc < %s -mtriple=x86_64-linux-gnueabi | FileCheck %s 3e919fcacSRenato Golin; RUN: opt < %s -O3 -S -mtriple=x86_64-linux-gnueabi | FileCheck %s --check-prefix=OPT 4c7aea40eSRenato Golin 5c7aea40eSRenato Golindefine i64 @get_stack() nounwind { 6c7aea40eSRenato Golinentry: 7c7aea40eSRenato Golin; CHECK-LABEL: get_stack: 8c7aea40eSRenato Golin; CHECK: movq %rsp, %rax 9c7aea40eSRenato Golin %sp = call i64 @llvm.read_register.i64(metadata !0) 10e919fcacSRenato Golin; OPT: @llvm.read_register.i64 11c7aea40eSRenato Golin ret i64 %sp 12c7aea40eSRenato Golin} 13c7aea40eSRenato Golin 14c7aea40eSRenato Golindefine void @set_stack(i64 %val) nounwind { 15c7aea40eSRenato Golinentry: 16c7aea40eSRenato Golin; CHECK-LABEL: set_stack: 17c7aea40eSRenato Golin; CHECK: movq %rdi, %rsp 18c7aea40eSRenato Golin call void @llvm.write_register.i64(metadata !0, i64 %val) 19e919fcacSRenato Golin; OPT: @llvm.write_register.i64 20c7aea40eSRenato Golin ret void 21c7aea40eSRenato Golin} 22c7aea40eSRenato Golin 23c7aea40eSRenato Golindeclare i64 @llvm.read_register.i64(metadata) nounwind 24c7aea40eSRenato Golindeclare void @llvm.write_register.i64(metadata, i64) nounwind 25c7aea40eSRenato Golin 26c7aea40eSRenato Golin; register unsigned long current_stack_pointer asm("rsp"); 27c7aea40eSRenato Golin; CHECK-NOT: .asciz "rsp" 28*be7ea19bSDuncan P. N. Exon Smith!0 = !{!"rsp\00"} 29