1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
2 ; RUN: llc < %s -mtriple=x86_64-linux-gnueabi | FileCheck %s
3 ; RUN: opt < %s -O3 -S -mtriple=x86_64-linux-gnueabi | FileCheck %s --check-prefix=OPT
5 define i64 @get_stack() nounwind {
7 ; CHECK-LABEL: get_stack:
8 ; CHECK: movq %rsp, %rax
9 %sp = call i64 @llvm.read_register.i64(metadata !0)
10 ; OPT: @llvm.read_register.i64
14 define void @set_stack(i64 %val) nounwind {
16 ; CHECK-LABEL: set_stack:
17 ; CHECK: movq %rdi, %rsp
18 call void @llvm.write_register.i64(metadata !0, i64 %val)
19 ; OPT: @llvm.write_register.i64
23 declare i64 @llvm.read_register.i64(metadata) nounwind
24 declare void @llvm.write_register.i64(metadata, i64) nounwind
26 ; register unsigned long current_stack_pointer asm("rsp");
27 ; CHECK-NOT: .asciz "rsp"