Skip to content

Commit edebbb4

Browse files
authored
[AMDGPU/VOP3P][NFC] - Simplify wmma instruction defs (llvm#70622)
Instead of checking for the `_w32` or `_w64` suffix, we can use the suffix in the definitions directly.
1 parent a316f14 commit edebbb4

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

llvm/lib/Target/AMDGPU/VOP3PInstructions.td

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -871,29 +871,16 @@ multiclass WMMAInst<string Suffix, string Instr, VOPProfile P, SDPatternOperator
871871
defvar WMMAConstraints3Addr = "@earlyclobber $vdst";
872872

873873
defvar WMMAProfile = VOPProfileWMMA<P, Suffix, _Src01RC64, Type.hasClamp, Type.hasOpsel>;
874-
if !eq(Suffix, "_w32") then {
875-
let Mnemonic = Instr, mayRaiseFPException = 0, ReadsModeReg = 0 in {
876-
let Constraints = WMMAConstraints2Addr, isConvertibleToThreeAddress = 1 in {
877-
def _twoaddr_w32 : VOP3P_Pseudo<Instr # Suffix, WMMAProfile>;
878-
}
879-
let Constraints = WMMAConstraints3Addr, SchedRW = [Write32Bit, Write32Bit] in {
880-
def _threeaddr_w32 : VOP3P_Pseudo<Instr # Suffix, WMMAProfile>;
881-
}
874+
let Mnemonic = Instr, mayRaiseFPException = 0, ReadsModeReg = 0 in {
875+
let Constraints = WMMAConstraints2Addr, isConvertibleToThreeAddress = 1 in {
876+
def _twoaddr # Suffix : VOP3P_Pseudo<Instr # Suffix, WMMAProfile>;
882877
}
883-
def : WMMAOpcodeMapping<!cast<Instruction>(NAME # _twoaddr_w32),
884-
!cast<Instruction>(NAME # _threeaddr_w32)>;
885-
} else if !eq(Suffix, "_w64") then {
886-
let Mnemonic = Instr, mayRaiseFPException = 0, ReadsModeReg = 0 in {
887-
let Constraints = WMMAConstraints2Addr, isConvertibleToThreeAddress = 1 in {
888-
def _twoaddr_w64 : VOP3P_Pseudo<Instr # Suffix, WMMAProfile>;
889-
}
890-
let Constraints = WMMAConstraints3Addr, SchedRW = [Write32Bit, Write32Bit] in {
891-
def _threeaddr_w64 : VOP3P_Pseudo<Instr # Suffix, WMMAProfile>;
892-
}
878+
let Constraints = WMMAConstraints3Addr, SchedRW = [Write32Bit, Write32Bit] in {
879+
def _threeaddr # Suffix : VOP3P_Pseudo<Instr # Suffix, WMMAProfile>;
893880
}
894-
def : WMMAOpcodeMapping<!cast<Instruction>(NAME # _twoaddr_w64),
895-
!cast<Instruction>(NAME # _threeaddr_w64)>;
896881
}
882+
def : WMMAOpcodeMapping<!cast<Instruction>(NAME # _twoaddr # Suffix),
883+
!cast<Instruction>(NAME # _threeaddr # Suffix)>;
897884

898885
if !eq(Type, WMMAOpSel) then {
899886
def : WMMAOpSelPat<!cast<Instruction>(NAME # _twoaddr # Suffix), node, P>;

0 commit comments

Comments
 (0)