xref: /llvm-project/llvm/test/CodeGen/ARM/stackpointer.ll (revision be7ea19b585dc1b0d4c4358df3ca498ceb65b969)
1c7aea40eSRenato Golin; RUN: llc < %s -mtriple=arm-apple-darwin  | FileCheck %s
2c7aea40eSRenato Golin; RUN: llc < %s -mtriple=arm-linux-gnueabi | FileCheck %s
3c7aea40eSRenato Golin
4c7aea40eSRenato Golindefine i32 @get_stack() nounwind {
5c7aea40eSRenato Golinentry:
6c7aea40eSRenato Golin; CHECK-LABEL: get_stack:
7c7aea40eSRenato Golin; CHECK: mov   r0, sp
8c7aea40eSRenato Golin	%sp = call i32 @llvm.read_register.i32(metadata !0)
9c7aea40eSRenato Golin  ret i32 %sp
10c7aea40eSRenato Golin}
11c7aea40eSRenato Golin
12c7aea40eSRenato Golindefine void @set_stack(i32 %val) nounwind {
13c7aea40eSRenato Golinentry:
14c7aea40eSRenato Golin; CHECK-LABEL: set_stack:
15c7aea40eSRenato Golin; CHECK: mov   sp, r0
16c7aea40eSRenato Golin  call void @llvm.write_register.i32(metadata !0, i32 %val)
17c7aea40eSRenato Golin  ret void
18c7aea40eSRenato Golin}
19c7aea40eSRenato Golin
20c7aea40eSRenato Golindeclare i32 @llvm.read_register.i32(metadata) nounwind
21c7aea40eSRenato Golindeclare void @llvm.write_register.i32(metadata, i32) nounwind
22c7aea40eSRenato Golin
23c7aea40eSRenato Golin; register unsigned long current_stack_pointer asm("sp");
24c7aea40eSRenato Golin; CHECK-NOT: .asciz  "sp"
25*be7ea19bSDuncan P. N. Exon Smith!0 = !{!"sp\00"}
26