; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-unknown-linux-gnu  | FileCheck %s
; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-unknown-linux-gnu  -regalloc=basic | FileCheck %s

declare i8* @llvm.frameaddress(i32) nounwind readnone

define i8* @g2() nounwind readnone {
; CHECK-LABEL: g2:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    lwz 3, 0(1)
; CHECK-NEXT:    blr
entry:
  %0 = tail call i8* @llvm.frameaddress(i32 1)    ; <i8*> [#uses=1]
  ret i8* %0
}

declare i8* @llvm.returnaddress(i32) nounwind readnone

define i8* @g() nounwind readnone {
; CHECK-LABEL: g:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    mflr 0
; CHECK-NEXT:    stw 0, 4(1)
; CHECK-NEXT:    stwu 1, -16(1)
; CHECK-NEXT:    lwz 3, 0(1)
; CHECK-NEXT:    lwz 3, 0(3)
; CHECK-NEXT:    lwz 3, 4(3)
; CHECK-NEXT:    lwz 0, 20(1)
; CHECK-NEXT:    addi 1, 1, 16
; CHECK-NEXT:    mtlr 0
; CHECK-NEXT:    blr
entry:
  %0 = tail call i8* @llvm.returnaddress(i32 1)   ; <i8*> [#uses=1]
  ret i8* %0
}
