1f4a2713aSLionel Sambuc;RUN: llc -march=sparc < %s | FileCheck %s -check-prefix=V8 2f4a2713aSLionel Sambuc;RUN: llc -march=sparc -mattr=v9 < %s | FileCheck %s -check-prefix=V9 3f4a2713aSLionel Sambuc;RUN: llc -march=sparc -regalloc=basic < %s | FileCheck %s -check-prefix=V8 4f4a2713aSLionel Sambuc;RUN: llc -march=sparc -regalloc=basic -mattr=v9 < %s | FileCheck %s -check-prefix=V9 5*0a6a1f1dSLionel Sambuc;RUN: llc -march=sparcv9 < %s | FileCheck %s -check-prefix=SPARC64 6f4a2713aSLionel Sambuc 7f4a2713aSLionel Sambuc 8f4a2713aSLionel Sambucdefine i8* @frameaddr() nounwind readnone { 9f4a2713aSLionel Sambucentry: 10f4a2713aSLionel Sambuc;V8-LABEL: frameaddr: 11f4a2713aSLionel Sambuc;V8: save %sp, -96, %sp 12*0a6a1f1dSLionel Sambuc;V8: ret 13f4a2713aSLionel Sambuc;V8: restore %g0, %fp, %o0 14f4a2713aSLionel Sambuc 15f4a2713aSLionel Sambuc;V9-LABEL: frameaddr: 16f4a2713aSLionel Sambuc;V9: save %sp, -96, %sp 17*0a6a1f1dSLionel Sambuc;V9: ret 18f4a2713aSLionel Sambuc;V9: restore %g0, %fp, %o0 19*0a6a1f1dSLionel Sambuc 20*0a6a1f1dSLionel Sambuc;SPARC64-LABEL: frameaddr 21*0a6a1f1dSLionel Sambuc;SPARC64: save %sp, -128, %sp 22*0a6a1f1dSLionel Sambuc;SPARC64: add %fp, 2047, %i0 23*0a6a1f1dSLionel Sambuc;SPARC64: ret 24*0a6a1f1dSLionel Sambuc;SPARC64-NOT: restore %g0, %g0, %g0 25*0a6a1f1dSLionel Sambuc;SPARC64: restore 26*0a6a1f1dSLionel Sambuc 27f4a2713aSLionel Sambuc %0 = tail call i8* @llvm.frameaddress(i32 0) 28f4a2713aSLionel Sambuc ret i8* %0 29f4a2713aSLionel Sambuc} 30f4a2713aSLionel Sambuc 31f4a2713aSLionel Sambucdefine i8* @frameaddr2() nounwind readnone { 32f4a2713aSLionel Sambucentry: 33f4a2713aSLionel Sambuc;V8-LABEL: frameaddr2: 34f4a2713aSLionel Sambuc;V8: ta 3 35f4a2713aSLionel Sambuc;V8: ld [%fp+56], {{.+}} 36f4a2713aSLionel Sambuc;V8: ld [{{.+}}+56], {{.+}} 37f4a2713aSLionel Sambuc;V8: ld [{{.+}}+56], {{.+}} 38f4a2713aSLionel Sambuc 39f4a2713aSLionel Sambuc;V9-LABEL: frameaddr2: 40f4a2713aSLionel Sambuc;V9: flushw 41f4a2713aSLionel Sambuc;V9: ld [%fp+56], {{.+}} 42f4a2713aSLionel Sambuc;V9: ld [{{.+}}+56], {{.+}} 43f4a2713aSLionel Sambuc;V9: ld [{{.+}}+56], {{.+}} 44*0a6a1f1dSLionel Sambuc 45*0a6a1f1dSLionel Sambuc;SPARC64-LABEL: frameaddr2 46*0a6a1f1dSLionel Sambuc;SPARC64: flushw 47*0a6a1f1dSLionel Sambuc;SPARC64: ldx [%fp+2159], %[[R0:[goli][0-7]]] 48*0a6a1f1dSLionel Sambuc;SPARC64: ldx [%[[R0]]+2159], %[[R1:[goli][0-7]]] 49*0a6a1f1dSLionel Sambuc;SPARC64: ldx [%[[R1]]+2159], %[[R2:[goli][0-7]]] 50*0a6a1f1dSLionel Sambuc;SPARC64: add %[[R2]], 2047, {{.+}} 51*0a6a1f1dSLionel Sambuc 52f4a2713aSLionel Sambuc %0 = tail call i8* @llvm.frameaddress(i32 3) 53f4a2713aSLionel Sambuc ret i8* %0 54f4a2713aSLionel Sambuc} 55f4a2713aSLionel Sambuc 56f4a2713aSLionel Sambucdeclare i8* @llvm.frameaddress(i32) nounwind readnone 57f4a2713aSLionel Sambuc 58f4a2713aSLionel Sambuc 59f4a2713aSLionel Sambuc 60f4a2713aSLionel Sambucdefine i8* @retaddr() nounwind readnone { 61f4a2713aSLionel Sambucentry: 62f4a2713aSLionel Sambuc;V8-LABEL: retaddr: 63*0a6a1f1dSLionel Sambuc;V8: mov %o7, {{.+}} 64f4a2713aSLionel Sambuc 65f4a2713aSLionel Sambuc;V9-LABEL: retaddr: 66*0a6a1f1dSLionel Sambuc;V9: mov %o7, {{.+}} 67*0a6a1f1dSLionel Sambuc 68*0a6a1f1dSLionel Sambuc;SPARC64-LABEL: retaddr 69*0a6a1f1dSLionel Sambuc;SPARC64: mov %o7, {{.+}} 70f4a2713aSLionel Sambuc 71f4a2713aSLionel Sambuc %0 = tail call i8* @llvm.returnaddress(i32 0) 72f4a2713aSLionel Sambuc ret i8* %0 73f4a2713aSLionel Sambuc} 74f4a2713aSLionel Sambuc 75f4a2713aSLionel Sambucdefine i8* @retaddr2() nounwind readnone { 76f4a2713aSLionel Sambucentry: 77f4a2713aSLionel Sambuc;V8-LABEL: retaddr2: 78f4a2713aSLionel Sambuc;V8: ta 3 79f4a2713aSLionel Sambuc;V8: ld [%fp+56], {{.+}} 80f4a2713aSLionel Sambuc;V8: ld [{{.+}}+56], {{.+}} 81f4a2713aSLionel Sambuc;V8: ld [{{.+}}+60], {{.+}} 82f4a2713aSLionel Sambuc 83f4a2713aSLionel Sambuc;V9-LABEL: retaddr2: 84f4a2713aSLionel Sambuc;V9: flushw 85f4a2713aSLionel Sambuc;V9: ld [%fp+56], {{.+}} 86f4a2713aSLionel Sambuc;V9: ld [{{.+}}+56], {{.+}} 87f4a2713aSLionel Sambuc;V9: ld [{{.+}}+60], {{.+}} 88f4a2713aSLionel Sambuc 89*0a6a1f1dSLionel Sambuc;SPARC64-LABEL: retaddr2 90*0a6a1f1dSLionel Sambuc;SPARC64: flushw 91*0a6a1f1dSLionel Sambuc;SPARC64: ldx [%fp+2159], %[[R0:[goli][0-7]]] 92*0a6a1f1dSLionel Sambuc;SPARC64: ldx [%[[R0]]+2159], %[[R1:[goli][0-7]]] 93*0a6a1f1dSLionel Sambuc;SPARC64: ldx [%[[R1]]+2167], {{.+}} 94f4a2713aSLionel Sambuc 95f4a2713aSLionel Sambuc %0 = tail call i8* @llvm.returnaddress(i32 3) 96f4a2713aSLionel Sambuc ret i8* %0 97f4a2713aSLionel Sambuc} 98f4a2713aSLionel Sambuc 99f4a2713aSLionel Sambucdeclare i8* @llvm.returnaddress(i32) nounwind readnone 100