1 ; RUN: llc < %s -mtriple=arm64-linux-gnu | FileCheck %s 2 3 define i64 @get_stack() nounwind { 4 entry: 5 ; CHECK-LABEL: get_stack: 6 ; CHECK: mov x0, sp 7 %sp = call i64 @llvm.read_register.i64(metadata !0) 8 ret i64 %sp 9 } 10 11 define void @set_stack(i64 %val) nounwind { 12 entry: 13 ; CHECK-LABEL: set_stack: 14 ; CHECK: mov sp, x0 15 call void @llvm.write_register.i64(metadata !0, i64 %val) 16 ret void 17 } 18 19 declare i64 @llvm.read_register.i64(metadata) nounwind 20 declare void @llvm.write_register.i64(metadata, i64) nounwind 21 22 ; register unsigned long current_stack_pointer asm("sp"); 23 ; CHECK-NOT: .asciz "sp" 24 !0 = !{!"sp\00"} 25