Skip to content

Commit 549fdda

Browse files
authored
[AMDGPU] Refactor int_amdgcn_mov_dpp8 patterns. NFC. (#92764)
I still don't see why we need to select to different Real instructions on different targets, but at least this is less verbose.
1 parent c648663 commit 549fdda

File tree

1 file changed

+7
-33
lines changed

1 file changed

+7
-33
lines changed

llvm/lib/Target/AMDGPU/VOP1Instructions.td

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,38 +1431,12 @@ defm V_CVT_F32_BF8 : VOP1_Real_NoDstSel_SDWA_gfx9<0x55>;
14311431
defm V_CVT_PK_F32_FP8 : VOP1_Real_NoDstSel_SDWA_gfx9<0x56>;
14321432
defm V_CVT_PK_F32_BF8 : VOP1_Real_NoDstSel_SDWA_gfx9<0x57>;
14331433

1434-
//===----------------------------------------------------------------------===//
1435-
// GFX10
1436-
//===----------------------------------------------------------------------===//
1437-
1438-
let OtherPredicates = [isGFX10Only] in {
1439-
def : GCNPat <
1434+
class MovDPP8Pattern<Predicate Pred, Instruction Inst> : GCNPat <
14401435
(i32 (int_amdgcn_mov_dpp8 i32:$src, timm:$dpp8)),
1441-
(V_MOV_B32_dpp8_gfx10 VGPR_32:$src, VGPR_32:$src,
1442-
(as_i32timm $dpp8), (i32 DPP8Mode.FI_0))
1443-
>;
1444-
} // End OtherPredicates = [isGFX10Only]
1445-
1446-
//===----------------------------------------------------------------------===//
1447-
// GFX11
1448-
//===----------------------------------------------------------------------===//
1449-
1450-
let OtherPredicates = [isGFX11Only] in {
1451-
def : GCNPat <
1452-
(i32 (int_amdgcn_mov_dpp8 i32:$src, timm:$dpp8)),
1453-
(V_MOV_B32_dpp8_gfx11 VGPR_32:$src, VGPR_32:$src,
1454-
(as_i32timm $dpp8), (i32 DPP8Mode.FI_0))
1455-
>;
1456-
} // End OtherPredicates = [isGFX11Only]
1457-
1458-
//===----------------------------------------------------------------------===//
1459-
// GFX12
1460-
//===----------------------------------------------------------------------===//
1436+
(Inst VGPR_32:$src, VGPR_32:$src, (as_i32timm $dpp8), (i32 DPP8Mode.FI_0))> {
1437+
let OtherPredicates = [Pred];
1438+
}
14611439

1462-
let OtherPredicates = [isGFX12Only] in {
1463-
def : GCNPat <
1464-
(i32 (int_amdgcn_mov_dpp8 i32:$src, timm:$dpp8)),
1465-
(V_MOV_B32_dpp8_gfx12 VGPR_32:$src, VGPR_32:$src,
1466-
(as_i32timm $dpp8), (i32 DPP8Mode.FI_0))
1467-
>;
1468-
} // End OtherPredicates = [isGFX12Only]
1440+
def : MovDPP8Pattern<isGFX10Only, V_MOV_B32_dpp8_gfx10>;
1441+
def : MovDPP8Pattern<isGFX11Only, V_MOV_B32_dpp8_gfx11>;
1442+
def : MovDPP8Pattern<isGFX12Only, V_MOV_B32_dpp8_gfx12>;

0 commit comments

Comments
 (0)