; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s --mtriple=loongarch64 -mattr=+d | FileCheck %s
define i64 @get_stack() nounwind {
; CHECK-LABEL: get_stack:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: move $a0, $sp
; CHECK-NEXT: ret
entry:
%sp = call i64 @llvm.read_register.i64(metadata !0)
ret i64 %sp
}
define void @set_stack(i64 %val) nounwind {
; CHECK-LABEL: set_stack:
; CHECK: # %bb.0: # %entry
; CHECK-NEXT: move $sp, $a0
; CHECK-NEXT: ret
entry:
call void @llvm.write_register.i64(metadata !0, i64 %val)
ret void
}
declare i64 @llvm.read_register.i64(metadata) nounwind
declare void @llvm.write_register.i64(metadata, i64) nounwind
!0 = !{!"$sp\00"}