; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=mips64 -relocation-model=static -mattr=+noabicalls \
; RUN:   -target-abi n32 < %s | FileCheck %s

declare i64 @llvm.read_register.i64(metadata)

define i64 @get_gp() {
; CHECK-LABEL: get_gp:
; CHECK:       # %bb.0:
; CHECK-NEXT:    jr $ra
; CHECK-NEXT:    move $2, $gp
  %1 = call i64 @llvm.read_register.i64(metadata !0)
  ret i64 %1
}

define i64 @get_sp() {
; CHECK-LABEL: get_sp:
; CHECK:       # %bb.0:
; CHECK-NEXT:    jr $ra
; CHECK-NEXT:    move $2, $sp
  %1 = call i64 @llvm.read_register.i64(metadata !1)
  ret i64 %1
}

!llvm.named.register.$28 = !{!0}
!llvm.named.register.sp = !{!1}

!0 = !{!"$28"}
!1 = !{!"sp"}
