Skip to content

Commit 682267d

Browse files
committed
Test necessity of removing kill flag.
Signed-off-by: John Lu <[email protected]>
1 parent 91a4367 commit 682267d

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# RUN: llc -mtriple=amdgcn -verify-machineinstrs=1 -start-before=postrapseudos -stop-after=postrapseudos -O0 -o - %s | FileCheck -check-prefix=GCN %s
2+
3+
# This testcase shows the necessity of removing the killed flag from the $sgpr source when
4+
# creating a V_WRITELANE_B32. The SI_SPILL_S32_TO_VGPR will be converted in postrapseudos from:
5+
#
6+
# $X = SI_SPILL_S32_TO_VGPR killed $sgpr0, 6, $X, implicit-def $sgpr0_sgpr1
7+
#
8+
# to:
9+
#
10+
# $X = V_WRITELANE_B32 $sgpr0, 6, $X(tied-def 0)
11+
#
12+
# The killed flag must be removed since $sgpr0 is no longer an implicit-def and
13+
# will be subsequently used in the S_MOV_B64.
14+
15+
# GCN-LABEL: name: non_uniform_loop
16+
---
17+
name: non_uniform_loop
18+
tracksRegLiveness: true
19+
machineFunctionInfo:
20+
wwmReservedRegs:
21+
- '$vgpr63'
22+
body: |
23+
bb.0:
24+
successors: %bb.1(0x80000000)
25+
liveins: $vgpr0
26+
27+
S_BRANCH %bb.1
28+
29+
bb.1:
30+
successors: %bb.2(0x40000000), %bb.3(0x40000000)
31+
32+
$sgpr0 = SI_RESTORE_S32_FROM_VGPR $vgpr63, 2, implicit-def $sgpr0_sgpr1
33+
$vgpr63 = SI_SPILL_S32_TO_VGPR killed $sgpr0, 6, $vgpr63, implicit-def $sgpr0_sgpr1
34+
$exec = S_MOV_B64_term killed renamable $sgpr0_sgpr1
35+
S_CBRANCH_EXECZ %bb.3, implicit $exec
36+
S_BRANCH %bb.2
37+
38+
bb.2:
39+
successors: %bb.3(0x80000000)
40+
41+
S_BRANCH %bb.3
42+
43+
bb.3:
44+
successors: %bb.4(0x40000000), %bb.1(0x40000000)
45+
46+
$exec = S_ANDN2_B64_term $exec, killed undef renamable $sgpr0_sgpr1, implicit-def dead $scc
47+
S_CBRANCH_EXECNZ %bb.1, implicit $exec
48+
S_BRANCH %bb.4
49+
50+
bb.4:
51+
successors: %bb.5(0x80000000)
52+
53+
$exec = S_OR_B64_term $exec, killed undef renamable $sgpr0_sgpr1, implicit-def dead $scc
54+
55+
bb.5:
56+
S_ENDPGM 0
57+
...

0 commit comments

Comments
 (0)