1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 4
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx908 -run-pass=prologepilog -verify-machineinstrs -o - %s | FileCheck -check-prefix=GCN %s
# There are free scratch SGPRs available and hence use the smallest available pair for exec copy
# instead of the pair in the CSR range already given.
---
name: shift_back_exec_copy_reserved_reg
tracksRegLiveness: true
frameInfo:
maxAlignment: 4
machineFunctionInfo:
isEntryFunction: false
scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
stackPtrOffsetReg: '$sgpr32'
frameOffsetReg: '$sgpr33'
sgprForEXECCopy: '$sgpr34_sgpr35'
body: |
bb.0:
liveins: $sgpr30_sgpr31, $vgpr0
; GCN-LABEL: name: shift_back_exec_copy_reserved_reg
; GCN: liveins: $sgpr30_sgpr31, $vgpr0
; GCN-NEXT: {{ $}}
; GCN-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr30, 0, killed $vgpr0
; GCN-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr31, 1, killed $vgpr0
; GCN-NEXT: $sgpr4_sgpr5 = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
; GCN-NEXT: $vgpr1 = COPY $vgpr0
; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr4_sgpr5
; GCN-NEXT: $sgpr30 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 0
; GCN-NEXT: $sgpr31 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 1
; GCN-NEXT: S_SETPC_B64 $sgpr30_sgpr31
$vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr30, 0, killed $vgpr0
$vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr31, 1, killed $vgpr0
$sgpr34_sgpr35 = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
$vgpr1 = COPY $vgpr0
$exec = S_MOV_B64 killed $sgpr34_sgpr35
$sgpr30 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 0
$sgpr31 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 1
S_SETPC_B64 $sgpr30_sgpr31
...
# All scratch registers are made unavailable so that the CSR SGPR pair used for EXEC copy needed spills at prolog and epilog.
---
name: spill_exec_copy_reserved_reg
tracksRegLiveness: true
frameInfo:
maxAlignment: 4
machineFunctionInfo:
isEntryFunction: false
scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
stackPtrOffsetReg: '$sgpr32'
frameOffsetReg: '$sgpr33'
sgprForEXECCopy: '$sgpr34_sgpr35'
body: |
bb.0:
liveins: $sgpr4, $sgpr5, $sgpr6, $sgpr7, $sgpr8, $sgpr9, $sgpr10, $sgpr11, $sgpr12, $sgpr13, $sgpr14, $sgpr15, $sgpr16, $sgpr17, $sgpr18, $sgpr19, $sgpr20, $sgpr21, $sgpr22, $sgpr23, $sgpr24, $sgpr25, $sgpr26, $sgpr27, $sgpr30_sgpr31, $vcc, $vgpr0
; GCN-LABEL: name: spill_exec_copy_reserved_reg
; GCN: liveins: $sgpr4, $sgpr5, $sgpr6, $sgpr7, $sgpr8, $sgpr9, $sgpr10, $sgpr11, $sgpr12, $sgpr13, $sgpr14, $sgpr15, $sgpr16, $sgpr17, $sgpr18, $sgpr19, $sgpr20, $sgpr21, $sgpr22, $sgpr23, $sgpr24, $sgpr25, $sgpr26, $sgpr27, $sgpr30_sgpr31, $vcc, $vgpr0
; GCN-NEXT: {{ $}}
; GCN-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr30, 0, killed $vgpr0
; GCN-NEXT: $vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr31, 1, killed $vgpr0
; GCN-NEXT: $sgpr40_sgpr41 = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
; GCN-NEXT: $sgpr28_sgpr29 = IMPLICIT_DEF
; GCN-NEXT: $vgpr1 = COPY $vgpr0
; GCN-NEXT: S_NOP 0, implicit $sgpr28_sgpr29
; GCN-NEXT: $exec = S_MOV_B64 killed $sgpr40_sgpr41
; GCN-NEXT: $sgpr30 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 0
; GCN-NEXT: $sgpr31 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 1
; GCN-NEXT: S_SETPC_B64 $sgpr30_sgpr31, implicit $sgpr4, implicit $sgpr5, implicit $sgpr6, implicit $sgpr7, implicit $sgpr8_sgpr9_sgpr10, implicit $sgpr11, implicit $sgpr12, implicit $sgpr13, implicit $sgpr14, implicit $sgpr15, implicit $sgpr15, implicit $sgpr17, implicit $sgpr18, implicit $sgpr19, implicit $sgpr20, implicit $sgpr21, implicit $sgpr22, implicit $sgpr23, implicit $sgpr24, implicit $sgpr25, implicit $sgpr26, implicit $sgpr27, implicit $vcc
$vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr30, 0, killed $vgpr0
$vgpr0 = SI_SPILL_S32_TO_VGPR $sgpr31, 1, killed $vgpr0
$sgpr34_sgpr35 = S_OR_SAVEEXEC_B64 -1, implicit-def $exec, implicit-def dead $scc, implicit $exec
$sgpr28_sgpr29 = IMPLICIT_DEF
$vgpr1 = COPY $vgpr0
S_NOP 0, implicit $sgpr28_sgpr29
$exec = S_MOV_B64 killed $sgpr34_sgpr35
$sgpr30 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 0
$sgpr31 = SI_RESTORE_S32_FROM_VGPR $vgpr1, 1
S_SETPC_B64 $sgpr30_sgpr31, implicit $sgpr4, implicit $sgpr5, implicit $sgpr6, implicit $sgpr7, implicit $sgpr8_sgpr9_sgpr10, implicit $sgpr11, implicit $sgpr12, implicit $sgpr13, implicit $sgpr14, implicit $sgpr15, implicit $sgpr15, implicit $sgpr17, implicit $sgpr18, implicit $sgpr19, implicit $sgpr20, implicit $sgpr21, implicit $sgpr22, implicit $sgpr23, implicit $sgpr24, implicit $sgpr25, implicit $sgpr26, implicit $sgpr27, implicit $vcc
...
|