Skip to content

Commit a68c724

Browse files
authored
[AMDGPU] Run twoaddr tests with -early-live-intervals (#66775)
Sample test case: %3 = V_FMAC_F32_e32 killed %0, %1, %2, implicit $mode, implicit $exec With LiveVariables this is converted to three-address form just because there is no "killed" flag on %2. To make it do the same thing with LiveIntervals I added a later use of %2: %3 = V_FMAC_F32_e32 killed %0, %1, %2, implicit $mode, implicit $exec S_ENDPGM 0, implicit %2
1 parent 976df42 commit a68c724

File tree

5 files changed

+43
-32
lines changed

5 files changed

+43
-32
lines changed

llvm/test/CodeGen/AMDGPU/gfx10-twoaddr-fma.mir

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RUN: llc -march=amdgcn -mcpu=gfx1010 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck --check-prefixes=GFX10 %s
2+
# RUN: llc -march=amdgcn -mcpu=gfx1010 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - -early-live-intervals | FileCheck --check-prefixes=GFX10 %s
23

34
# GFX10-LABEL: name: test_fmamk_reg_imm_f16
45
# GFX10: %2:vgpr_32 = IMPLICIT_DEF
@@ -43,7 +44,7 @@ body: |
4344
...
4445

4546
# GFX10-LABEL: name: test_fmaak_f16
46-
# GFX10: %1:vgpr_32 = IMPLICIT_DEF
47+
# GFX10: %1:vgpr_32 = V_MOV_B32_e32 1078523331, implicit $exec
4748
# GFX10-NOT: V_MOV_B32
4849
# GFX10: V_FMAAK_F16 killed %0.sub0, %0.sub1, 1078523331, implicit $mode, implicit $exec
4950
---
@@ -58,10 +59,11 @@ body: |
5859
%0 = IMPLICIT_DEF
5960
%1 = V_MOV_B32_e32 1078523331, implicit $exec
6061
%2 = V_FMAC_F16_e32 killed %0.sub0, %0.sub1, %1, implicit $mode, implicit $exec
62+
S_ENDPGM 0, implicit %1
6163
...
6264

6365
# GFX10-LABEL: name: test_fmaak_inline_literal_f16
64-
# GFX10: %1:vgpr_32 = IMPLICIT_DEF
66+
# GFX10: %1:vgpr_32 = V_MOV_B32_e32 49664, implicit $exec
6567
# GFX10-NOT: V_MOV_B32
6668
# GFX10: %2:vgpr_32 = V_FMAAK_F16 16384, killed %0, 49664, implicit $mode, implicit $exec
6769

@@ -78,7 +80,5 @@ body: |
7880
7981
%1:vgpr_32 = V_MOV_B32_e32 49664, implicit $exec
8082
%2:vgpr_32 = V_FMAC_F16_e32 16384, killed %0, %1, implicit $mode, implicit $exec
81-
S_ENDPGM 0
82-
83+
S_ENDPGM 0, implicit %1
8384
...
84-

llvm/test/CodeGen/AMDGPU/twoaddr-fma-f64.mir

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RUN: llc -march=amdgcn -mcpu=gfx90a %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck -check-prefix=GCN %s
2+
# RUN: llc -march=amdgcn -mcpu=gfx90a %s -run-pass twoaddressinstruction -verify-machineinstrs -o - -early-live-intervals | FileCheck -check-prefix=GCN %s
23

34
# GCN-LABEL: name: test_fmamk_reg_imm_f64
45
# GCN: V_FMA_F64_e64 0, killed %0, 0, %2, 0, killed %1, 0, 0, implicit $mode, implicit $exec
@@ -52,7 +53,7 @@ body: |
5253
%0 = IMPLICIT_DEF
5354
%1 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
5455
%2 = V_FMAC_F64_e32 killed %0.sub0_sub1, %0.sub2_sub3, %1, implicit $mode, implicit $exec
55-
56+
S_ENDPGM 0, implicit %1
5657
...
5758

5859
# GCN-LABEL: name: test_fmaak_sgpr_src0_f64
@@ -72,7 +73,7 @@ body: |
7273
%1 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
7374
%2 = IMPLICIT_DEF
7475
%3 = V_FMAC_F64_e32 killed %0, %1, %2, implicit $mode, implicit $exec
75-
76+
S_ENDPGM 0, implicit %2
7677
...
7778

7879
# GCN-LABEL: name: test_fmaak_inlineimm_src0_f64
@@ -90,7 +91,7 @@ body: |
9091
%0 = V_MOV_B64_PSEUDO 4607182418800017408, implicit $exec
9192
%1 = IMPLICIT_DEF
9293
%2 = V_FMAC_F64_e32 4611686018427387904, %0, %1, implicit $mode, implicit $exec
93-
94+
S_ENDPGM 0, implicit %1
9495
...
9596

9697
# GCN-LABEL: name: test_fmaak_otherimm_src0_f64
@@ -186,5 +187,5 @@ body: |
186187
%1 = COPY %0
187188
%2 = V_MOV_B64_PSEUDO 123456, implicit $exec
188189
%3 = V_FMAC_F64_e32 killed %0, killed %1, %2, implicit $mode, implicit $exec
189-
190+
S_ENDPGM 0, implicit %2
190191
...

llvm/test/CodeGen/AMDGPU/twoaddr-fma.mir

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# RUN: llc -march=amdgcn -mcpu=gfx1010 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck --check-prefixes=GCN %s
2+
# RUN: llc -march=amdgcn -mcpu=gfx1010 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - -early-live-intervals | FileCheck --check-prefixes=GCN %s
23
# RUN: llc -march=amdgcn -mcpu=gfx1100 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck --check-prefixes=GCN %s
4+
# RUN: llc -march=amdgcn -mcpu=gfx1100 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - -early-live-intervals | FileCheck --check-prefixes=GCN %s
35

46
# GCN-LABEL: name: test_fmamk_reg_imm_f32
57
# GCN: %2:vgpr_32 = IMPLICIT_DEF
@@ -44,7 +46,7 @@ body: |
4446
...
4547

4648
# GCN-LABEL: name: test_fmaak_f32
47-
# GCN: %1:vgpr_32 = IMPLICIT_DEF
49+
# GCN: %1:vgpr_32 = V_MOV_B32_e32 1078523331, implicit $exec
4850
# GCN-NOT: V_MOV_B32
4951
# GCN: V_FMAAK_F32 killed %0.sub0, %0.sub1, 1078523331, implicit $mode, implicit $exec
5052
---
@@ -59,7 +61,7 @@ body: |
5961
%0 = IMPLICIT_DEF
6062
%1 = V_MOV_B32_e32 1078523331, implicit $exec
6163
%2 = V_FMAC_F32_e32 killed %0.sub0, %0.sub1, %1, implicit $mode, implicit $exec
62-
64+
S_ENDPGM 0, implicit %1
6365
...
6466

6567

@@ -82,7 +84,7 @@ body: |
8284
%1 = V_MOV_B32_e32 1078523331, implicit $exec
8385
%2 = IMPLICIT_DEF
8486
%3 = V_FMAC_F32_e32 killed %0, %1, %2, implicit $mode, implicit $exec
85-
87+
S_ENDPGM 0, implicit %2
8688
...
8789

8890
# GCN-LABEL: name: test_fmaak_inlineimm_src0_f32
@@ -102,7 +104,7 @@ body: |
102104
%0 = V_MOV_B32_e32 1078523331, implicit $exec
103105
%1 = IMPLICIT_DEF
104106
%2 = V_FMAC_F32_e32 1073741824, %0, %1, implicit $mode, implicit $exec
105-
107+
S_ENDPGM 0, implicit %1
106108
...
107109

108110
# GCN-LABEL: name: test_fmaak_otherimm_src0_f32
@@ -120,7 +122,7 @@ body: |
120122
%0 = V_MOV_B32_e32 1078523331, implicit $exec
121123
%1 = IMPLICIT_DEF
122124
%2 = V_FMAC_F32_e32 1120403456, %0, %1, implicit $mode, implicit $exec
123-
125+
S_ENDPGM 0, implicit %1
124126
...
125127

126128
# GCN-LABEL: name: test_fmaak_other_constantlike_src0_f32
@@ -204,6 +206,7 @@ body: |
204206
%1:vgpr_32 = IMPLICIT_DEF
205207
%2:vgpr_32 = IMPLICIT_DEF
206208
%3:vgpr_32 = V_FMAC_F32_e64 1, %0, 0, %1, 0, %2, 0, 0, implicit $mode, implicit $exec
209+
S_ENDPGM 0, implicit %2
207210
...
208211

209212
# GCN-LABEL: name: test_fma_src1mods
@@ -216,6 +219,7 @@ body: |
216219
%1:vgpr_32 = IMPLICIT_DEF
217220
%2:vgpr_32 = IMPLICIT_DEF
218221
%3:vgpr_32 = V_FMAC_F32_e64 0, %0, 1, %1, 0, %2, 0, 0, implicit $mode, implicit $exec
222+
S_ENDPGM 0, implicit %2
219223
...
220224

221225
# GCN-LABEL: name: test_fma_src2mods
@@ -228,4 +232,5 @@ body: |
228232
%1:vgpr_32 = IMPLICIT_DEF
229233
%2:vgpr_32 = IMPLICIT_DEF
230234
%3:vgpr_32 = V_FMAC_F32_e64 0, %0, 0, %1, 1, %2, 0, 0, implicit $mode, implicit $exec
235+
S_ENDPGM 0, implicit %2
231236
...

llvm/test/CodeGen/AMDGPU/twoaddr-mad.mir

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RUN: llc -march=amdgcn -mcpu=gfx900 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck -check-prefix=GCN %s
2+
# RUN: llc -march=amdgcn -mcpu=gfx900 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - -early-live-intervals | FileCheck -check-prefix=GCN %s
23

34
# GCN-LABEL: name: test_madmk_reg_imm_f32
45
# GCN: V_MADMK_F32 killed %0.sub0, 1078523331, killed %1, implicit $mode, implicit $exec
@@ -52,7 +53,7 @@ body: |
5253
%0 = IMPLICIT_DEF
5354
%1 = V_MOV_B32_e32 1078523331, implicit $exec
5455
%2 = V_MAC_F32_e32 killed %0.sub0, %0.sub1, %1, implicit $mode, implicit $exec
55-
56+
S_ENDPGM 0, implicit %1
5657
...
5758

5859
# GCN-LABEL: name: test_madmk_reg_imm_f16
@@ -107,6 +108,7 @@ body: |
107108
%0 = IMPLICIT_DEF
108109
%1 = V_MOV_B32_e32 1078523331, implicit $exec
109110
%2 = V_MAC_F16_e32 killed %0.sub0, %0.sub1, %1, implicit $mode, implicit $exec
111+
S_ENDPGM 0, implicit %1
110112
...
111113

112114
# Make sure constant bus restriction isn't violated if src0 is an SGPR.
@@ -129,7 +131,7 @@ body: |
129131
%1 = V_MOV_B32_e32 1078523331, implicit $exec
130132
%2 = IMPLICIT_DEF
131133
%3 = V_MAC_F32_e32 killed %0, %1, %2, implicit $mode, implicit $exec
132-
134+
S_ENDPGM 0, implicit %2
133135
...
134136

135137
# This can still fold if this is an inline immediate.
@@ -149,7 +151,7 @@ body: |
149151
%0 = V_MOV_B32_e32 1078523331, implicit $exec
150152
%1 = IMPLICIT_DEF
151153
%2 = V_MAC_F32_e32 1073741824, %0, %1, implicit $mode, implicit $exec
152-
154+
S_ENDPGM 0, implicit %1
153155
...
154156
# Non-inline immediate uses constant bus already.
155157

@@ -168,7 +170,7 @@ body: |
168170
%0 = V_MOV_B32_e32 1078523331, implicit $exec
169171
%1 = IMPLICIT_DEF
170172
%2 = V_MAC_F32_e32 1120403456, %0, %1, implicit $mode, implicit $exec
171-
173+
S_ENDPGM 0, implicit %1
172174
...
173175
# Non-inline immediate uses constant bus already.
174176

@@ -204,8 +206,7 @@ body: |
204206
205207
%26:vgpr_32 = V_MOV_B32_e32 49664, implicit $exec
206208
%28:vgpr_32 = V_MAC_F16_e32 16384, killed %3, %26, implicit $mode, implicit $exec
207-
S_ENDPGM 0
208-
209+
S_ENDPGM 0, implicit %26
209210
...
210211

211212
# GCN-LABEL: name: test_mad_src0mods
@@ -218,6 +219,7 @@ body: |
218219
%1:vgpr_32 = IMPLICIT_DEF
219220
%2:vgpr_32 = IMPLICIT_DEF
220221
%3:vgpr_32 = V_MAC_F32_e64 1, %0, 0, %1, 0, %2, 0, 0, implicit $mode, implicit $exec
222+
S_ENDPGM 0, implicit %2
221223
...
222224

223225
# GCN-LABEL: name: test_mad_src1mods
@@ -230,6 +232,7 @@ body: |
230232
%1:vgpr_32 = IMPLICIT_DEF
231233
%2:vgpr_32 = IMPLICIT_DEF
232234
%3:vgpr_32 = V_MAC_F32_e64 0, %0, 1, %1, 0, %2, 0, 0, implicit $mode, implicit $exec
235+
S_ENDPGM 0, implicit %2
233236
...
234237

235238
# GCN-LABEL: name: test_mad_src2mods
@@ -242,4 +245,5 @@ body: |
242245
%1:vgpr_32 = IMPLICIT_DEF
243246
%2:vgpr_32 = IMPLICIT_DEF
244247
%3:vgpr_32 = V_MAC_F32_e64 0, %0, 0, %1, 1, %2, 0, 0, implicit $mode, implicit $exec
248+
S_ENDPGM 0, implicit %2
245249
...

llvm/test/CodeGen/AMDGPU/twoaddr-wmma.mir

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RUN: llc -march=amdgcn -mcpu=gfx1100 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - | FileCheck -check-prefix=GCN %s
2+
# RUN: llc -march=amdgcn -mcpu=gfx1100 %s -run-pass twoaddressinstruction -verify-machineinstrs -o - -early-live-intervals | FileCheck -check-prefix=GCN %s
23

34
# GCN-LABEL: name: test_v_wmma_f32_16x16x16_f16_twoaddr_w32
45
# GCN: early-clobber %2:vreg_256 = V_WMMA_F32_16X16X16_F16_threeaddr_w32 8, killed %1, 8, killed %1, 8, %0, 0, 0, implicit $exec
@@ -15,7 +16,7 @@ body: |
1516
%0 = IMPLICIT_DEF
1617
%1 = IMPLICIT_DEF
1718
early-clobber %2:vreg_256 = V_WMMA_F32_16X16X16_F16_twoaddr_w32 8, killed %1:vreg_256, 8, killed %1:vreg_256, 8, %0:vreg_256, 0, 0, implicit $exec
18-
19+
S_ENDPGM 0, implicit %0
1920
...
2021

2122
# GCN-LABEL: name: test_v_wmma_f32_16x16x16_bf16_twoaddr_w32
@@ -33,7 +34,7 @@ body: |
3334
%0 = IMPLICIT_DEF
3435
%1 = IMPLICIT_DEF
3536
early-clobber %2:vreg_256 = V_WMMA_F32_16X16X16_BF16_twoaddr_w32 8, killed %1:vreg_256, 8, killed %1:vreg_256, 8, %0:vreg_256, 0, 0, implicit $exec
36-
37+
S_ENDPGM 0, implicit %0
3738
...
3839

3940
# GCN-LABEL: name: test_v_wmma_f16_16x16x16_f16_twoaddr_w32
@@ -51,7 +52,7 @@ body: |
5152
%0 = IMPLICIT_DEF
5253
%1 = IMPLICIT_DEF
5354
early-clobber %2:vreg_256 = V_WMMA_F16_16X16X16_F16_twoaddr_w32 8, killed %1:vreg_256, 8, killed %1:vreg_256, 8, %0:vreg_256, 0, 0, 0, 0, implicit $exec
54-
55+
S_ENDPGM 0, implicit %0
5556
...
5657

5758
# GCN-LABEL: name: test_v_wmma_bf16_16x16x16_bf16_twoaddr_w32
@@ -69,7 +70,7 @@ body: |
6970
%0 = IMPLICIT_DEF
7071
%1 = IMPLICIT_DEF
7172
early-clobber %2:vreg_256 = V_WMMA_BF16_16X16X16_BF16_twoaddr_w32 8, killed %1:vreg_256, 8, killed %1:vreg_256, 8, %0:vreg_256, 0, 0, 0, 0, implicit $exec
72-
73+
S_ENDPGM 0, implicit %0
7374
...
7475

7576
# GCN-LABEL: name: test_v_wmma_i32_16x16x16_iu8_twoaddr_w32
@@ -87,7 +88,7 @@ body: |
8788
%0 = IMPLICIT_DEF
8889
%1 = IMPLICIT_DEF
8990
early-clobber %2:vreg_256 = V_WMMA_I32_16X16X16_IU8_twoaddr_w32 8, killed %1:vreg_128, 8, killed %1:vreg_128, 8, %0:vreg_256, 0, 0, 0, implicit $exec
90-
91+
S_ENDPGM 0, implicit %0
9192
...
9293

9394
# GCN-LABEL: name: test_v_wmma_i32_16x16x16_iu4_twoaddr_w32
@@ -105,7 +106,7 @@ body: |
105106
%0 = IMPLICIT_DEF
106107
%1 = IMPLICIT_DEF
107108
early-clobber %2:vreg_256 = V_WMMA_I32_16X16X16_IU4_twoaddr_w32 8, killed %1:vreg_64, 8, killed %1:vreg_64, 8, %0:vreg_256, 0, 0, 0, implicit $exec
108-
109+
S_ENDPGM 0, implicit %0
109110
...
110111

111112
# GCN-LABEL: name: test_v_wmma_f32_16x16x16_f16_twoaddr_w64
@@ -123,7 +124,7 @@ body: |
123124
%0 = IMPLICIT_DEF
124125
%1 = IMPLICIT_DEF
125126
early-clobber %2:vreg_128 = V_WMMA_F32_16X16X16_F16_twoaddr_w64 8, killed %1:vreg_256, 8, killed %1:vreg_256, 8, %0:vreg_128, 0, 0, implicit $exec
126-
127+
S_ENDPGM 0, implicit %0
127128
...
128129

129130
# GCN-LABEL: name: test_v_wmma_f32_16x16x16_bf16_twoaddr_w64
@@ -141,7 +142,7 @@ body: |
141142
%0 = IMPLICIT_DEF
142143
%1 = IMPLICIT_DEF
143144
early-clobber %2:vreg_128 = V_WMMA_F32_16X16X16_BF16_twoaddr_w64 8, killed %1:vreg_256, 8, killed %1:vreg_256, 8, %0:vreg_128, 0, 0, implicit $exec
144-
145+
S_ENDPGM 0, implicit %0
145146
...
146147

147148
# GCN-LABEL: name: test_v_wmma_f16_16x16x16_f16_twoaddr_w64
@@ -159,7 +160,7 @@ body: |
159160
%0 = IMPLICIT_DEF
160161
%1 = IMPLICIT_DEF
161162
early-clobber %2:vreg_128 = V_WMMA_F16_16X16X16_F16_twoaddr_w64 8, killed %1:vreg_256, 8, killed %1:vreg_256, 8, %0:vreg_128, 0, 0, 0, 0, implicit $exec
162-
163+
S_ENDPGM 0, implicit %0
163164
...
164165

165166
# GCN-LABEL: name: test_v_wmma_bf16_16x16x16_bf16_twoaddr_w64
@@ -177,7 +178,7 @@ body: |
177178
%0 = IMPLICIT_DEF
178179
%1 = IMPLICIT_DEF
179180
early-clobber %2:vreg_128 = V_WMMA_BF16_16X16X16_BF16_twoaddr_w64 8, killed %1:vreg_256, 8, killed %1:vreg_256, 8, %0:vreg_128, 0, 0, 0, 0, implicit $exec
180-
181+
S_ENDPGM 0, implicit %0
181182
...
182183

183184
# GCN-LABEL: name: test_v_wmma_i32_16x16x16_iu8_twoaddr_w64
@@ -195,7 +196,7 @@ body: |
195196
%0 = IMPLICIT_DEF
196197
%1 = IMPLICIT_DEF
197198
early-clobber %2:vreg_128 = V_WMMA_I32_16X16X16_IU8_twoaddr_w64 8, killed %1:vreg_128, 8, killed %1:vreg_128, 8, %0:vreg_128, 0, 0, 0, implicit $exec
198-
199+
S_ENDPGM 0, implicit %0
199200
...
200201

201202
# GCN-LABEL: name: test_v_wmma_i32_16x16x16_iu4_twoaddr_w64
@@ -213,5 +214,5 @@ body: |
213214
%0 = IMPLICIT_DEF
214215
%1 = IMPLICIT_DEF
215216
early-clobber %2:vreg_128 = V_WMMA_I32_16X16X16_IU4_twoaddr_w64 8, killed %1:vreg_64, 8, killed %1:vreg_64, 8, %0:vreg_128, 0, 0, 0, implicit $exec
216-
217+
S_ENDPGM 0, implicit %0
217218
...

0 commit comments

Comments
 (0)