convert-rr-to-ri-instrs-kill-flag.mir
4.99 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# RUN: llc -mtriple=powerpc64le--linux-gnu -stop-after ppc-pre-emit-peephole %s -o - -verify-machineinstrs | FileCheck %s
---
# LI + XFORM -> DFORM, no killed/dead flag fixup.
name: testKillPassUpLI1
#CHECK : name : testKillPassUpLI1
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3, $f1, $x5
$x3 = LI8 100
STFSX killed $f1, $x3, $x5
; CHECK: STFS killed $f1, 100, $x5
STD killed $x3, killed $x5, 100
; CHECK: STD killed $x3, killed $x5, 100
BLR8 implicit $lr8, implicit $rm
...
---
# LI + XFORM -> DFORM, fixup killed/dead flag for $x3, find no use, set def as
# dead(LI8 is deleted).
name : testKillPassUpLI2
# CHECK: name: testKillPassUpLI2
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3, $f1, $x5
$x3 = LI8 100
; CHECK-NOT: LI8
STFSX killed $f1, killed $x3, killed $x5
; CHECK: STFS killed $f1, 100, killed $x5
BLR8 implicit $lr8, implicit $rm
...
---
# LI + XFORM -> DFORM, fixup killed/dead flag for $x3, find last use, set last
# use as killed.
name: testKillPassUpLI3
# CHECK: name: testKillPassUpLI3
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3, $f1, $x5
$x3 = LI8 100
STD $x3, $x5, 100
; CHECK: STD killed $x3, $x5, 100
STFSX killed $f1, killed $x3, $x5
; CHECK: STFS killed $f1, 100, $x5
STD killed $x5, $x5, 100
; CHECK: STD killed $x5, $x5, 100
BLR8 implicit $lr8, implicit $rm
...
---
# LI + OP -> LI, fixup killed/dead flag for $x3, find last use, set last use as
# killed.
name: testKillPassUpLI4
# CHECK: name: testKillPassUpLI4
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3, $x5
$x3 = LI8 100
STD $x3, $x5, 100
; CHECK: STD killed $x3, killed $x5, 100
$x5 = ADDI8 killed $x3, 200
; CHECK: $x5 = LI8 300
STD $x5, $x5, 100
BLR8 implicit $lr8, implicit $rm
...
---
# ADD + XFORM -> DFORM, fixup killed/dead flag for $x3, find no use, set def as dead
# (ADDI8 is deleted).
name: testKillPassUpADD1
# CHECK: name: testKillPassUpADD1
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3, $f1, $x5
$x3 = ADDI8 killed $x5, 100
; CHECK-NOT: ADDI8
STFSX killed $f1, $zero8, killed $x3
; CHECK: STFS killed $f1, 100, killed $x5
BLR8 implicit $lr8, implicit $rm
...
---
# ADD + XFORM -> DFORM, fixup killed/dead flag for $x3, find last use, set last
# use as killed.
name: testKillPassUpADD2
# CHECK: name: testKillPassUpADD2
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3, $f1, $x5
$x3 = ADDI8 $x5, 100
STD $x3, $x5, 100
; CHECK: STD killed $x3, $x5, 100
STFSX killed $f1, $zero8, killed $x3
; CHECK: STFS killed $f1, 100, $x5
STD killed $x5, $x5, 100
; CHECK: STD killed $x5, $x5, 100
BLR8 implicit $lr8, implicit $rm
...
---
# ADD + XFORM -> DFORM, fixup killed/dead flag for register $x5, DFORM
# instruction uses $x5 and no other kill uses, set it as killed in
# DFORM instruction.
name: testKillPassDownADD1
# CHECK: name: testKillPassDownADD1
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3, $f1, $x5
$x3 = ADDI8 killed $x5, 100
; CHECK: $x3 = ADDI8 $x5, 100
STFSX killed $f1, $zero8, $x3
; CHECK: STFS killed $f1, 100, killed $x5
STD killed $x3, $x3, 100
; CHECK: STD killed $x3, $x3, 100
BLR8 implicit $lr8, implicit $rm
...
---
# ADD + XFORM -> DFORM, fixup killed/dead flag for register $x5, DFORM
# instruction uses $x5 and there is one kill use, set $x5 as killed in
# DFORM instruction and clear the other kill use killed flag.
name: testKillPassDownADD2
# CHECK: name: testKillPassDownADD2
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3, $f1, $x5
$x3 = ADDI8 $x5, 100
STD killed $x5, $x5, 100
; CHECK: STD $x5, $x5, 100
STFSX killed $f1, $zero8, killed $x3
; CHECK: STFS killed $f1, 100, killed $x5
BLR8 implicit $lr8, implicit $rm
...
---
# ADD + XFORM -> DFORM, fixup killed/dead flag for register $x3, DFORM
# instruction defines $x3, do nothing for killed/dead flag.
name: testKillPassDownADD3
# CHECK: name: testKillPassDownADD3
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3, $x5
$x3 = ADDI8 $x5, 100
$x3 = LDX $zero8, killed $x3
; CHECK: $x3 = LD 100, $x5
STD killed $x5, $x5, 100
; CHECK: STD killed $x5, $x5, 100
STD killed $x3, $x3, 200
; CHECK: STD killed $x3, $x3, 200
BLR8 implicit $lr8, implicit $rm
...
---
# ADD + XFORM -> DFORM, fixup killed/dead flag for both register $x5 and $x3,
# DFORM instruction uses $x5 and there is one kill use, set $x5 as killed in
# DFORM instruction and clear the other kill use killed flag. Find last use for
# $x3, set last use as killed.
name: testKillPassDownADD4
# CHECK: name: testKillPassDownADD4
tracksRegLiveness: true
body: |
bb.0.entry:
liveins: $x3, $f1, $x5
$x3 = ADDI8 $x5, 100
STD killed $x5, $x5, 100
; CHECK: STD $x5, $x5, 100
STD $x3, $x3, 200
; CHECK: STD killed $x3, $x3, 200
STFSX killed $f1, $zero8, killed $x3
; CHECK: STFS killed $f1, 100, killed $x5
BLR8 implicit $lr8, implicit $rm
...