Files
clang-p2996/llvm/test/CodeGen/AMDGPU/frame-index.mir
Christudasan Devadasan 5692a7e84e [AMDGPU] Callee must always spill writelane VGPRs
Since the writelane instruction used for SGPR spills can
modify inactive lanes, the callee must preserve the VGPR
this instruction modifies even if it was marked Caller-saved.

Reviewed By: arsenm, nhaehnle

Differential Revision: https://reviews.llvm.org/D124192
2022-12-17 11:11:42 +05:30

214 lines
10 KiB
YAML

# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=kaveri -verify-machineinstrs -run-pass=prologepilog -o - %s | FileCheck -check-prefix=GCN %s
---
name: func_add_constant_to_fi_divergent_i32
tracksRegLiveness: true
stack:
- { id: 0, type: default, offset: 0, size: 8, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: 0, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
machineFunctionInfo:
stackPtrOffsetReg: '$sgpr32'
body: |
bb.0:
liveins: $vgpr31, $sgpr30_sgpr31
; GCN-LABEL: name: func_add_constant_to_fi_divergent_i32
; GCN: liveins: $vgpr31, $sgpr30_sgpr31
; GCN-NEXT: {{ $}}
; GCN-NEXT: renamable $vgpr0 = V_AND_B32_e32 1023, killed $vgpr31, implicit $exec
; GCN-NEXT: renamable $vgpr0 = V_LSHLREV_B32_e32 2, killed $vgpr0, implicit $exec
; GCN-NEXT: $vgpr1 = V_LSHRREV_B32_e64 6, $sgpr32, implicit $exec
; GCN-NEXT: renamable $vgpr0 = V_ADD_CO_U32_e32 killed $vgpr1, killed $vgpr0, implicit-def dead $vcc, implicit $exec
; GCN-NEXT: renamable $vgpr0, dead renamable $vcc = nuw V_ADD_CO_U32_e64 4, killed $vgpr0, 0, implicit $exec
; GCN-NEXT: $m0 = S_MOV_B32 -1
; GCN-NEXT: DS_WRITE_B32 undef renamable $vgpr0, killed renamable $vgpr0, 0, 0, implicit $m0, implicit $exec
; GCN-NEXT: S_SETPC_B64_return killed renamable $sgpr30_sgpr31
renamable $vgpr0 = V_AND_B32_e32 1023, killed $vgpr31, implicit $exec
renamable $vgpr0 = V_LSHLREV_B32_e32 2, killed $vgpr0, implicit $exec
renamable $vgpr0 = V_ADD_CO_U32_e32 %stack.0, killed $vgpr0, implicit-def dead $vcc, implicit $exec
renamable $vgpr0, dead renamable $vcc = nuw V_ADD_CO_U32_e64 4, killed $vgpr0, 0, implicit $exec
$m0 = S_MOV_B32 -1
DS_WRITE_B32 undef renamable $vgpr0, killed renamable $vgpr0, 0, 0, implicit $m0, implicit $exec
S_SETPC_B64_return killed renamable $sgpr30_sgpr31
...
---
name: func_add_constant_to_fi_uniform_i32
tracksRegLiveness: true
stack:
- { id: 0, type: default, offset: 0, size: 8, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: 0, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
machineFunctionInfo:
stackPtrOffsetReg: '$sgpr32'
body: |
bb.0:
liveins: $sgpr30_sgpr31
; GCN-LABEL: name: func_add_constant_to_fi_uniform_i32
; GCN: liveins: $sgpr30_sgpr31
; GCN-NEXT: {{ $}}
; GCN-NEXT: $vcc_hi = S_LSHR_B32 6, $sgpr32, implicit-def dead $scc
; GCN-NEXT: renamable $sgpr4 = nuw S_ADD_I32 killed $vcc_hi, 4, implicit-def dead $scc
; GCN-NEXT: renamable $vgpr0 = COPY killed renamable $sgpr4, implicit $exec
; GCN-NEXT: $m0 = S_MOV_B32 -1
; GCN-NEXT: DS_WRITE_B32 undef renamable $vgpr0, killed renamable $vgpr0, 0, 0, implicit $m0, implicit $exec
; GCN-NEXT: S_SETPC_B64_return killed renamable $sgpr30_sgpr31
renamable $sgpr4 = nuw S_ADD_I32 %stack.0, 4, implicit-def dead $scc
renamable $vgpr0 = COPY killed renamable $sgpr4, implicit $exec
$m0 = S_MOV_B32 -1
DS_WRITE_B32 undef renamable $vgpr0, killed renamable $vgpr0, 0, 0, implicit $m0, implicit $exec
S_SETPC_B64_return killed renamable $sgpr30_sgpr31
...
---
name: func_add_constant_to_fi_uniform_SCC_clobber_i32
tracksRegLiveness: true
stack:
- { id: 0, type: default, offset: 0, size: 8, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: 0, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
- { id: 1, type: default, offset: 0, size: 32, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: 512, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
machineFunctionInfo:
stackPtrOffsetReg: '$sgpr32'
body: |
bb.0:
liveins: $sgpr30_sgpr31
; GCN-LABEL: name: func_add_constant_to_fi_uniform_SCC_clobber_i32
; GCN: liveins: $sgpr30_sgpr31
; GCN-NEXT: {{ $}}
; GCN-NEXT: $vcc_lo = S_LSHR_B32 6, $sgpr32, implicit-def dead $scc
; GCN-NEXT: renamable $sgpr4 = nuw S_ADD_U32 killed $vcc_lo, 4, implicit-def $scc
; GCN-NEXT: renamable $sgpr5 = S_ADDC_U32 $sgpr4, 1234567, implicit-def $scc, implicit $scc
; GCN-NEXT: $vcc_hi = S_LSHR_B32 $sgpr32, 6, implicit-def $scc
; GCN-NEXT: $vcc_hi = S_ADD_I32 killed $vcc_hi, 8, implicit-def $scc
; GCN-NEXT: renamable $sgpr6 = S_MUL_I32 killed $vcc_hi, $sgpr5
; GCN-NEXT: renamable $vgpr0 = COPY killed renamable $sgpr6, implicit $exec
; GCN-NEXT: $m0 = S_MOV_B32 -1
; GCN-NEXT: DS_WRITE_B32 undef renamable $vgpr0, killed renamable $vgpr0, 0, 0, implicit $m0, implicit $exec
; GCN-NEXT: S_SETPC_B64_return killed renamable $sgpr30_sgpr31
renamable $sgpr4 = nuw S_ADD_U32 %stack.0, 4, implicit-def $scc
renamable $sgpr5 = S_ADDC_U32 $sgpr4, 1234567, implicit-def $scc, implicit $scc
renamable $sgpr6 = S_MUL_I32 %stack.1, $sgpr5
renamable $vgpr0 = COPY killed renamable $sgpr6, implicit $exec
$m0 = S_MOV_B32 -1
DS_WRITE_B32 undef renamable $vgpr0, killed renamable $vgpr0, 0, 0, implicit $m0, implicit $exec
S_SETPC_B64_return killed renamable $sgpr30_sgpr31
...
---
name: func_other_fi_user_non_inline_imm_offset_i32
tracksRegLiveness: true
stack:
- { id: 0, type: default, offset: 0, size: 512, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: 0, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
- { id: 1, type: default, offset: 0, size: 32, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: 512, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
machineFunctionInfo:
scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
stackPtrOffsetReg: '$sgpr32'
body: |
bb.0:
liveins: $sgpr30_sgpr31
; GCN-LABEL: name: func_other_fi_user_non_inline_imm_offset_i32
; GCN: liveins: $sgpr30_sgpr31
; GCN-NEXT: {{ $}}
; GCN-NEXT: renamable $vgpr0 = V_MOV_B32_e32 7, implicit $exec
; GCN-NEXT: BUFFER_STORE_DWORD_OFFSET killed renamable $vgpr0, $sgpr0_sgpr1_sgpr2_sgpr3, $sgpr32, 260, 0, 0, implicit $exec
; GCN-NEXT: $vcc_hi = S_LSHR_B32 $sgpr32, 6, implicit-def $scc
; GCN-NEXT: $vcc_hi = S_ADD_I32 killed $vcc_hi, 512, implicit-def $scc
; GCN-NEXT: renamable $sgpr4 = S_MUL_I32 killed $vcc_hi, 9
; GCN-NEXT: renamable $vgpr0 = COPY killed renamable $sgpr4, implicit $exec
; GCN-NEXT: $m0 = S_MOV_B32 -1
; GCN-NEXT: DS_WRITE_B32 undef renamable $vgpr0, killed renamable $vgpr0, 0, 0, implicit $m0, implicit $exec
; GCN-NEXT: S_SETPC_B64_return killed renamable $sgpr30_sgpr31
renamable $vgpr0 = V_MOV_B32_e32 7, implicit $exec
BUFFER_STORE_DWORD_OFFEN killed renamable $vgpr0, %stack.0, $sgpr0_sgpr1_sgpr2_sgpr3, 0, 260, 0, 0, implicit $exec
renamable $sgpr4 = S_MUL_I32 %stack.1, 9
renamable $vgpr0 = COPY killed renamable $sgpr4, implicit $exec
$m0 = S_MOV_B32 -1
DS_WRITE_B32 undef renamable $vgpr0, killed renamable $vgpr0, 0, 0, implicit $m0, implicit $exec
S_SETPC_B64_return killed renamable $sgpr30_sgpr31
...
---
name: func_add_constant_to_fi_uniform_live_SCC_i32
tracksRegLiveness: true
stack:
- { id: 0, type: default, offset: 0, size: 8, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: 0, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
machineFunctionInfo:
stackPtrOffsetReg: '$sgpr32'
body: |
bb.0:
liveins: $sgpr30_sgpr31, $sgpr10
; GCN-LABEL: name: func_add_constant_to_fi_uniform_live_SCC_i32
; GCN: liveins: $sgpr10, $sgpr30_sgpr31
; GCN-NEXT: {{ $}}
; GCN-NEXT: renamable $sgpr4 = nuw S_ADD_U32 $sgpr10, 4, implicit-def $scc
; GCN-NEXT: $vgpr1 = V_LSHRREV_B32_e64 6, $sgpr32, implicit $exec
; GCN-NEXT: $vcc_hi = V_READFIRSTLANE_B32 $vgpr1, implicit $exec
; GCN-NEXT: renamable $sgpr5 = S_MUL_I32 killed $vcc_hi, $sgpr4
; GCN-NEXT: renamable $sgpr6 = S_ADDC_U32 $sgpr5, 1234567, implicit-def dead $scc, implicit $scc
; GCN-NEXT: renamable $vgpr0 = COPY killed renamable $sgpr6, implicit $exec
; GCN-NEXT: $m0 = S_MOV_B32 -1
; GCN-NEXT: DS_WRITE_B32 undef renamable $vgpr0, killed renamable $vgpr0, 0, 0, implicit $m0, implicit $exec
; GCN-NEXT: S_SETPC_B64_return killed renamable $sgpr30_sgpr31
renamable $sgpr4 = nuw S_ADD_U32 $sgpr10, 4, implicit-def $scc
renamable $sgpr5 = S_MUL_I32 %stack.0, $sgpr4
renamable $sgpr6 = S_ADDC_U32 $sgpr5, 1234567, implicit-def dead $scc, implicit $scc
renamable $vgpr0 = COPY killed renamable $sgpr6, implicit $exec
$m0 = S_MOV_B32 -1
DS_WRITE_B32 undef renamable $vgpr0, killed renamable $vgpr0, 0, 0, implicit $m0, implicit $exec
S_SETPC_B64_return killed renamable $sgpr30_sgpr31
...
---
name: func_frame_idx_at_the_end_of_bb
tracksRegLiveness: true
stack:
- { id: 0, type: default, offset: 0, size: 8, alignment: 4,
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
local-offset: 0, debug-info-variable: '', debug-info-expression: '',
debug-info-location: '' }
machineFunctionInfo:
stackPtrOffsetReg: '$sgpr32'
body: |
bb.0:
liveins: $vgpr31
; GCN-LABEL: name: func_frame_idx_at_the_end_of_bb
; GCN: liveins: $vgpr31
; GCN-NEXT: {{ $}}
; GCN-NEXT: renamable $vgpr0 = V_AND_B32_e32 1023, killed $vgpr31, implicit $exec
; GCN-NEXT: renamable $vgpr0 = V_LSHLREV_B32_e32 2, killed $vgpr0, implicit $exec
; GCN-NEXT: $vgpr1 = V_LSHRREV_B32_e64 6, $sgpr32, implicit $exec
; GCN-NEXT: renamable $vgpr0 = V_ADD_CO_U32_e32 killed $vgpr1, killed $vgpr0, implicit-def dead $vcc, implicit $exec
renamable $vgpr0 = V_AND_B32_e32 1023, killed $vgpr31, implicit $exec
renamable $vgpr0 = V_LSHLREV_B32_e32 2, killed $vgpr0, implicit $exec
renamable $vgpr0 = V_ADD_CO_U32_e32 %stack.0, killed $vgpr0, implicit-def dead $vcc, implicit $exec
...