blob: 1524f7b59b0a837654f32991d01894f0b08fb284 [file] [edit]
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 6
; RUN: llc -mtriple=sparc -verify-machineinstrs < %s | FileCheck %s --check-prefix=V8
; RUN: llc -mtriple=sparcv9 -verify-machineinstrs < %s | FileCheck %s --check-prefix=V9
;; A leaf procedure that needs a stack frame only adjusts %sp; it does not
;; execute save, so the CFA must stay %sp-based (plus the stack bias on
;; SPARC64) and no register window may be described.
define void @leaf_small_frame() nounwind uwtable {
; V8-LABEL: leaf_small_frame:
; V8: .cfi_startproc
; V8-NEXT: ! %bb.0:
; V8-NEXT: add %sp, -160, %sp
; V8-NEXT: .cfi_def_cfa_offset 160
; V8-NEXT: mov 1, %o0
; V8-NEXT: st %o0, [%sp+96]
; V8-NEXT: retl
; V8-NEXT: add %sp, 160, %sp
;
; V9-LABEL: leaf_small_frame:
; V9: .cfi_startproc
; V9-NEXT: ! %bb.0:
; V9-NEXT: add %sp, -192, %sp
; V9-NEXT: .cfi_def_cfa_offset 2239
; V9-NEXT: mov 1, %o0
; V9-NEXT: st %o0, [%sp+2175]
; V9-NEXT: retl
; V9-NEXT: add %sp, 192, %sp
%a = alloca [16 x i32]
store volatile i32 1, ptr %a
ret void
}
define void @leaf_large_frame() nounwind uwtable {
; V8-LABEL: leaf_large_frame:
; V8: .cfi_startproc
; V8-NEXT: ! %bb.0:
; V8-NEXT: sethi 16, %g1
; V8-NEXT: xor %g1, -96, %g1
; V8-NEXT: add %sp, %g1, %sp
; V8-NEXT: .cfi_def_cfa_offset 16480
; V8-NEXT: mov 1, %o0
; V8-NEXT: st %o0, [%sp+96]
; V8-NEXT: sethi 16, %g1
; V8-NEXT: or %g1, 96, %g1
; V8-NEXT: retl
; V8-NEXT: add %sp, %g1, %sp
;
; V9-LABEL: leaf_large_frame:
; V9: .cfi_startproc
; V9-NEXT: ! %bb.0:
; V9-NEXT: sethi 16, %g1
; V9-NEXT: xor %g1, -128, %g1
; V9-NEXT: add %sp, %g1, %sp
; V9-NEXT: .cfi_def_cfa_offset 18559
; V9-NEXT: mov 1, %o0
; V9-NEXT: st %o0, [%sp+2175]
; V9-NEXT: sethi 16, %g1
; V9-NEXT: or %g1, 128, %g1
; V9-NEXT: retl
; V9-NEXT: add %sp, %g1, %sp
%a = alloca [4096 x i32]
store volatile i32 1, ptr %a
ret void
}
declare void @callee()
define void @nonleaf() nounwind uwtable {
; V8-LABEL: nonleaf:
; V8: .cfi_startproc
; V8-NEXT: ! %bb.0:
; V8-NEXT: save %sp, -96, %sp
; V8-NEXT: .cfi_def_cfa_register %fp
; V8-NEXT: .cfi_window_save
; V8-NEXT: .cfi_register %o7, %i7
; V8-NEXT: call callee
; V8-NEXT: nop
; V8-NEXT: ret
; V8-NEXT: restore
;
; V9-LABEL: nonleaf:
; V9: .cfi_startproc
; V9-NEXT: ! %bb.0:
; V9-NEXT: save %sp, -176, %sp
; V9-NEXT: .cfi_def_cfa_register %fp
; V9-NEXT: .cfi_window_save
; V9-NEXT: .cfi_register %o7, %i7
; V9-NEXT: call callee
; V9-NEXT: nop
; V9-NEXT: ret
; V9-NEXT: restore
call void @callee()
ret void
}