1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -amdgpu-spill-sgpr-to-vgpr=false -verify-machineinstrs -start-before=si-lower-sgpr-spills -stop-after=prologepilog -o - %s | FileCheck %s
4 # Check that we allocate 2 emergency stack slots if we're spilling
5 # SGPRs to memory and potentially have an offset larger than fits in
6 # the addressing mode of the memory instructions.
10 tracksRegLiveness: true
14 - { id: 0, type: spill-slot, size: 4, alignment: 4, stack-id: sgpr-spill }
15 - { id: 1, size: 4096, alignment: 4 }
17 isEntryFunction: false
18 scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
19 stackPtrOffsetReg: '$sgpr32'
20 frameOffsetReg: '$sgpr33'
24 liveins: $sgpr30_sgpr31, $sgpr10, $sgpr11
25 ; CHECK-LABEL: name: test
26 ; CHECK: liveins: $sgpr10, $sgpr11, $sgpr30_sgpr31
28 ; CHECK-NEXT: S_CMP_EQ_U32 0, 0, implicit-def $scc
29 ; CHECK-NEXT: $sgpr4_sgpr5 = S_MOV_B64 $exec
30 ; CHECK-NEXT: $exec = S_MOV_B64 1, implicit-def $vgpr1
31 ; CHECK-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr1, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, implicit $exec :: (store (s32) into %stack.2, addrspace 5)
32 ; CHECK-NEXT: $vgpr1 = SI_SPILL_S32_TO_VGPR $sgpr10, 0, undef $vgpr1
33 ; CHECK-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr1, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 8, 0, 0, implicit $exec :: (store (s32) into %stack.0, addrspace 5)
34 ; CHECK-NEXT: $vgpr1 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, implicit $exec :: (load (s32) from %stack.2, addrspace 5)
35 ; CHECK-NEXT: $exec = S_MOV_B64 killed $sgpr4_sgpr5, implicit killed $vgpr1
36 ; CHECK-NEXT: $sgpr4_sgpr5 = S_MOV_B64 $exec
37 ; CHECK-NEXT: $exec = S_MOV_B64 1, implicit-def $vgpr1
38 ; CHECK-NEXT: BUFFER_STORE_DWORD_OFFSET killed $vgpr1, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, implicit $exec :: (store (s32) into %stack.2, addrspace 5)
39 ; CHECK-NEXT: $vgpr1 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 8, 0, 0, implicit $exec :: (load (s32) from %stack.0, addrspace 5)
40 ; CHECK-NEXT: $sgpr10 = SI_RESTORE_S32_FROM_VGPR killed $vgpr1, 0
41 ; CHECK-NEXT: $vgpr1 = BUFFER_LOAD_DWORD_OFFSET $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 0, 0, 0, implicit $exec :: (load (s32) from %stack.2, addrspace 5)
42 ; CHECK-NEXT: $exec = S_MOV_B64 killed $sgpr4_sgpr5, implicit killed $vgpr1
43 ; CHECK-NEXT: S_SETPC_B64 $sgpr30_sgpr31, implicit $scc
44 S_CMP_EQ_U32 0, 0, implicit-def $scc
45 SI_SPILL_S32_SAVE killed $sgpr10, %stack.0, implicit $exec, implicit $sgpr0_sgpr1_sgpr2_sgpr3, implicit $sgpr32
46 renamable $sgpr10 = SI_SPILL_S32_RESTORE %stack.0, implicit $exec, implicit $sgpr0_sgpr1_sgpr2_sgpr3, implicit $sgpr32
47 S_SETPC_B64 $sgpr30_sgpr31, implicit $scc