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 ptr @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
23 ;SPARC64: restore %fp, 2047, %o0
25 %0 = tail call ptr @llvm.frameaddress(i32 0)
29 define ptr @frameaddr2() nounwind readnone {
31 ;V8-LABEL: frameaddr2:
32 ;V8: ta 3 ! encoding: [0x91,0xd0,0x20,0x03]
33 ;V8: ld [%fp+56], {{.+}}
34 ;V8: ld [{{.+}}+56], {{.+}}
35 ;V8: ld [{{.+}}+56], {{.+}}
37 ;V9-LABEL: frameaddr2:
39 ;V9: ld [%fp+56], {{.+}}
40 ;V9: ld [{{.+}}+56], {{.+}}
41 ;V9: ld [{{.+}}+56], {{.+}}
43 ;SPARC64-LABEL: frameaddr2
45 ;SPARC64: ldx [%fp+2159], %[[R0:[goli][0-7]]]
46 ;SPARC64: ldx [%[[R0]]+2159], %[[R1:[goli][0-7]]]
47 ;SPARC64: ldx [%[[R1]]+2159], %[[R2:[goli][0-7]]]
49 ;SPARC64: restore %[[R2]], 2047, %o0
51 %0 = tail call ptr @llvm.frameaddress(i32 3)
55 declare ptr @llvm.frameaddress(i32) nounwind readnone
59 define ptr @retaddr() nounwind readnone {
67 ;SPARC64-LABEL: retaddr
68 ;SPARC64: mov %o7, {{.+}}
70 %0 = tail call ptr @llvm.returnaddress(i32 0)
74 define ptr @retaddr2() nounwind readnone {
78 ;V8: ld [%fp+56], {{.+}}
79 ;V8: ld [{{.+}}+56], {{.+}}
80 ;V8: ld [{{.+}}+60], {{.+}}
84 ;V9: ld [%fp+56], {{.+}}
85 ;V9: ld [{{.+}}+56], {{.+}}
86 ;V9: ld [{{.+}}+60], {{.+}}
88 ;SPARC64-LABEL: retaddr2
90 ;SPARC64: ldx [%fp+2159], %[[R0:[goli][0-7]]]
91 ;SPARC64: ldx [%[[R0]]+2159], %[[R1:[goli][0-7]]]
92 ;SPARC64: ldx [%[[R1]]+2167], {{.+}}
94 %0 = tail call ptr @llvm.returnaddress(i32 3)
98 define ptr @retaddr3() nounwind readnone {
102 ;V8: ld [%fp+60], {{.+}}
106 ;V9: ld [%fp+60], {{.+}}
108 ;SPARC64-LABEL: retaddr3
110 ;SPARC64: ldx [%fp+2167], %[[R0:[goli][0-7]]]
112 %0 = tail call ptr @llvm.returnaddress(i32 1)
116 declare ptr @llvm.returnaddress(i32) nounwind readnone