1 ;RUN: llc -march=sparc -show-mc-encoding < %s | FileCheck %s -check-prefix=V8
2 ;RUN: llc -march=sparc -mattr=v9 < %s | FileCheck %s -check-prefix=V9
3 ;RUN: llc -march=sparc -show-mc-encoding -regalloc=basic < %s | FileCheck %s -check-prefix=V8
4 ;RUN: llc -march=sparc -regalloc=basic -mattr=v9 < %s | FileCheck %s -check-prefix=V9
5 ;RUN: llc -march=sparcv9 < %s | FileCheck %s -check-prefix=SPARC64
8 define i8* @frameaddr() nounwind readnone {
11 ;V8: save %sp, -96, %sp
13 ;V8: restore %g0, %fp, %o0
16 ;V9: save %sp, -96, %sp
18 ;V9: restore %g0, %fp, %o0
20 ;SPARC64-LABEL: frameaddr
21 ;SPARC64: save %sp, -128, %sp
22 ;SPARC64: add %fp, 2047, %i0
24 ;SPARC64-NOT: restore %g0, %g0, %g0
27 %0 = tail call i8* @llvm.frameaddress(i32 0)
31 define i8* @frameaddr2() nounwind readnone {
33 ;V8-LABEL: frameaddr2:
34 ;V8: ta 3 ! encoding: [0x91,0xd0,0x20,0x03]
35 ;V8: ld [%fp+56], {{.+}}
36 ;V8: ld [{{.+}}+56], {{.+}}
37 ;V8: ld [{{.+}}+56], {{.+}}
39 ;V9-LABEL: frameaddr2:
41 ;V9: ld [%fp+56], {{.+}}
42 ;V9: ld [{{.+}}+56], {{.+}}
43 ;V9: ld [{{.+}}+56], {{.+}}
45 ;SPARC64-LABEL: frameaddr2
47 ;SPARC64: ldx [%fp+2159], %[[R0:[goli][0-7]]]
48 ;SPARC64: ldx [%[[R0]]+2159], %[[R1:[goli][0-7]]]
49 ;SPARC64: ldx [%[[R1]]+2159], %[[R2:[goli][0-7]]]
50 ;SPARC64: add %[[R2]], 2047, {{.+}}
52 %0 = tail call i8* @llvm.frameaddress(i32 3)
56 declare i8* @llvm.frameaddress(i32) nounwind readnone
60 define i8* @retaddr() nounwind readnone {
68 ;SPARC64-LABEL: retaddr
69 ;SPARC64: mov %o7, {{.+}}
71 %0 = tail call i8* @llvm.returnaddress(i32 0)
75 define i8* @retaddr2() nounwind readnone {
79 ;V8: ld [%fp+56], {{.+}}
80 ;V8: ld [{{.+}}+56], {{.+}}
81 ;V8: ld [{{.+}}+60], {{.+}}
85 ;V9: ld [%fp+56], {{.+}}
86 ;V9: ld [{{.+}}+56], {{.+}}
87 ;V9: ld [{{.+}}+60], {{.+}}
89 ;SPARC64-LABEL: retaddr2
91 ;SPARC64: ldx [%fp+2159], %[[R0:[goli][0-7]]]
92 ;SPARC64: ldx [%[[R0]]+2159], %[[R1:[goli][0-7]]]
93 ;SPARC64: ldx [%[[R1]]+2167], {{.+}}
95 %0 = tail call i8* @llvm.returnaddress(i32 3)
99 define i8* @retaddr3() nounwind readnone {
103 ;V8: ld [%fp+60], {{.+}}
107 ;V9: ld [%fp+60], {{.+}}
109 ;SPARC64-LABEL: retaddr3
111 ;SPARC64: ldx [%fp+2167], %[[R0:[goli][0-7]]]
113 %0 = tail call i8* @llvm.returnaddress(i32 1)
117 declare i8* @llvm.returnaddress(i32) nounwind readnone