| 1 |
; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc-unknown-linux-gnu | FileCheck %s -check-prefix=PPC32 |
| 2 |
; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s -check-prefix=PPC64 |
| 3 |
|
| 4 |
; PPC32: foo |
| 5 |
; PPC32: mflr 0 |
| 6 |
; PPC32: stwu 1, -[[STACK:[0-9]+]](1) |
| 7 |
; PPC32: stw 0, 20(1) |
| 8 |
; PPC32: lwz [[REG:[0-9]+]], [[RETADDR:[0-9]+]](1) |
| 9 |
; PPC32: stw [[REG]], 0(3) |
| 10 |
; PPC32: lwz 0, [[RETADDR]](1) |
| 11 |
; PPC32: addi 1, 1, [[STACK]] |
| 12 |
; PPC32: mtlr 0 |
| 13 |
; PPC32: blr |
| 14 |
|
| 15 |
; PPC64: foo |
| 16 |
; PPC64: mflr 0 |
| 17 |
; PPC64: stdu 1, -[[#%d,STACK:]] |
| 18 |
; PPC64: std 0, [[#%d,RETADDR:]] |
| 19 |
; PPC64: ld [[REG:[0-9]+]] |
| 20 |
; PPC64: std [[REG]], 0(3) |
| 21 |
; PPC64: addi 1, 1, [[#%d,STACK]] |
| 22 |
; PPC64: ld 0, [[#%d,RETADDR-STACK]] |
| 23 |
; PPC64: mtlr 0 |
| 24 |
; PPC64: blr |
| 25 |
|
| 26 |
define void @foo(ptr %X) nounwind { |
| 27 |
entry: |
| 28 |
%tmp = tail call ptr @llvm.returnaddress( i32 0 ) ; <ptr> [#uses=1] |
| 29 |
store ptr %tmp, ptr %X, align 4 |
| 30 |
ret void |
| 31 |
} |
| 32 |
|
| 33 |
declare ptr @llvm.returnaddress(i32) |
| 34 |
|