mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
[AMDGPU] Supress unused sdwa insts generation
Do not generate non-existing sdwa instructions. It reduces the number of generated instructions by 185. Differential Revision: https://reviews.llvm.org/D69010 llvm-svn: 375016
This commit is contained in:
parent
f765621f2a
commit
4c652f1374
@ -104,13 +104,18 @@ multiclass VOP1Inst <string opName, VOPProfile P,
|
||||
SDPatternOperator node = null_frag> {
|
||||
def _e32 : VOP1_Pseudo <opName, P>;
|
||||
def _e64 : VOP3_Pseudo <opName, P, getVOP1Pat64<node, P>.ret>;
|
||||
def _sdwa : VOP1_SDWA_Pseudo <opName, P>;
|
||||
|
||||
foreach _ = BoolToList<P.HasExtSDWA>.ret in
|
||||
def _sdwa : VOP1_SDWA_Pseudo <opName, P>;
|
||||
|
||||
foreach _ = BoolToList<P.HasExtDPP>.ret in
|
||||
def _dpp : VOP1_DPP_Pseudo <opName, P>;
|
||||
|
||||
def : MnemonicAlias<opName#"_e32", opName>, LetDummies;
|
||||
def : MnemonicAlias<opName#"_e64", opName>, LetDummies;
|
||||
def : MnemonicAlias<opName#"_sdwa", opName>, LetDummies;
|
||||
|
||||
foreach _ = BoolToList<P.HasExtSDWA>.ret in
|
||||
def : MnemonicAlias<opName#"_sdwa", opName>, LetDummies;
|
||||
|
||||
foreach _ = BoolToList<P.HasExtDPP>.ret in
|
||||
def : MnemonicAlias<opName#"_dpp", opName>, LetDummies;
|
||||
@ -500,6 +505,7 @@ let AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10" in {
|
||||
VOP3e_gfx10<{0, 1, 1, op{6-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
|
||||
}
|
||||
multiclass VOP1_Real_sdwa_gfx10<bits<9> op> {
|
||||
foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_gfx10 :
|
||||
VOP_SDWA10_Real<!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
|
||||
VOP1_SDWA9Ae<op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl> {
|
||||
@ -714,10 +720,12 @@ multiclass VOP1_Real_e32e64_vi <bits<10> op> {
|
||||
multiclass VOP1_Real_vi <bits<10> op> {
|
||||
defm NAME : VOP1_Real_e32e64_vi <op>;
|
||||
|
||||
foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA>.ret in
|
||||
def _sdwa_vi :
|
||||
VOP_SDWA_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
|
||||
VOP1_SDWAe <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
|
||||
|
||||
foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_gfx9 :
|
||||
VOP_SDWA9_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
|
||||
VOP1_SDWA9Ae <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
|
||||
@ -895,6 +903,7 @@ multiclass VOP1_Real_gfx9 <bits<10> op> {
|
||||
defm NAME : VOP1_Real_e32e64_vi <op>;
|
||||
}
|
||||
|
||||
foreach _ = BoolToList<!cast<VOP1_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_gfx9 :
|
||||
VOP_SDWA9_Real <!cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa")>,
|
||||
VOP1_SDWA9Ae <op{7-0}, !cast<VOP1_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
|
||||
|
@ -147,7 +147,8 @@ multiclass VOP2Inst_sdwa<string opName,
|
||||
string revOp = opName,
|
||||
bit GFX9Renamed = 0> {
|
||||
let renamedInGFX9 = GFX9Renamed in {
|
||||
def _sdwa : VOP2_SDWA_Pseudo <opName, P>;
|
||||
foreach _ = BoolToList<P.HasExtSDWA>.ret in
|
||||
def _sdwa : VOP2_SDWA_Pseudo <opName, P>;
|
||||
} // End renamedInGFX9 = GFX9Renamed
|
||||
}
|
||||
|
||||
@ -179,9 +180,10 @@ multiclass VOP2bInst <string opName,
|
||||
let usesCustomInserter = !eq(P.NumSrcArgs, 2);
|
||||
}
|
||||
|
||||
def _sdwa : VOP2_SDWA_Pseudo <opName, P> {
|
||||
let AsmMatchConverter = "cvtSdwaVOP2b";
|
||||
}
|
||||
foreach _ = BoolToList<P.HasExtSDWA>.ret in
|
||||
def _sdwa : VOP2_SDWA_Pseudo <opName, P> {
|
||||
let AsmMatchConverter = "cvtSdwaVOP2b";
|
||||
}
|
||||
foreach _ = BoolToList<P.HasExtDPP>.ret in
|
||||
def _dpp : VOP2_DPP_Pseudo <opName, P>;
|
||||
}
|
||||
@ -220,9 +222,10 @@ multiclass VOP2eInst <string opName,
|
||||
def _e32 : VOP2_Pseudo <opName, P>,
|
||||
Commutable_REV<revOp#"_e32", !eq(revOp, opName)>;
|
||||
|
||||
def _sdwa : VOP2_SDWA_Pseudo <opName, P> {
|
||||
let AsmMatchConverter = "cvtSdwaVOP2b";
|
||||
}
|
||||
foreach _ = BoolToList<P.HasExtSDWA>.ret in
|
||||
def _sdwa : VOP2_SDWA_Pseudo <opName, P> {
|
||||
let AsmMatchConverter = "cvtSdwaVOP2b";
|
||||
}
|
||||
|
||||
foreach _ = BoolToList<P.HasExtDPP>.ret in
|
||||
def _dpp : VOP2_DPP_Pseudo <opName, P>;
|
||||
@ -882,6 +885,7 @@ let AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10" in {
|
||||
VOP3e_gfx10<{0, 1, 0, 0, op{5-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl>;
|
||||
}
|
||||
multiclass VOP2_Real_sdwa_gfx10<bits<6> op> {
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_gfx10 :
|
||||
VOP_SDWA10_Real<!cast<VOP2_SDWA_Pseudo>(NAME#"_sdwa")>,
|
||||
VOP2_SDWA9Ae<op{5-0}, !cast<VOP2_SDWA_Pseudo>(NAME#"_sdwa").Pfl> {
|
||||
@ -924,6 +928,7 @@ let AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10" in {
|
||||
let DecoderNamespace = "SDWA10" in {
|
||||
multiclass VOP2_Real_sdwa_gfx10_with_name<bits<6> op, string opName,
|
||||
string asmName> {
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(opName#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_gfx10 :
|
||||
VOP_SDWA10_Real<!cast<VOP2_SDWA_Pseudo>(opName#"_sdwa")>,
|
||||
VOP2_SDWA9Ae<op{5-0}, !cast<VOP2_SDWA_Pseudo>(opName#"_sdwa").Pfl> {
|
||||
@ -965,6 +970,7 @@ let AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10" in {
|
||||
VOP3_Pseudo Ps = !cast<VOP3_Pseudo>(opName#"_e64");
|
||||
let AsmString = asmName # Ps.AsmOperands;
|
||||
}
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(opName#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_gfx10 :
|
||||
VOP_SDWA10_Real<!cast<VOP2_SDWA_Pseudo>(opName#"_sdwa")>,
|
||||
VOP2_SDWA9Ae<op{5-0}, !cast<VOP2_SDWA_Pseudo>(opName#"_sdwa").Pfl> {
|
||||
@ -988,6 +994,7 @@ let AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10" in {
|
||||
}
|
||||
|
||||
let WaveSizePredicate = isWave32 in {
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(opName#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_w32_gfx10 :
|
||||
Base_VOP_SDWA10_Real<!cast<VOP2_SDWA_Pseudo>(opName#"_sdwa")>,
|
||||
VOP2_SDWA9Ae<op{5-0}, !cast<VOP2_SDWA_Pseudo>(opName#"_sdwa").Pfl> {
|
||||
@ -1011,6 +1018,7 @@ let AssemblerPredicate = isGFX10Plus, DecoderNamespace = "GFX10" in {
|
||||
} // End WaveSizePredicate = isWave32
|
||||
|
||||
let WaveSizePredicate = isWave64 in {
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(opName#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_w64_gfx10 :
|
||||
Base_VOP_SDWA10_Real<!cast<VOP2_SDWA_Pseudo>(opName#"_sdwa")>,
|
||||
VOP2_SDWA9Ae<op{5-0}, !cast<VOP2_SDWA_Pseudo>(opName#"_sdwa").Pfl> {
|
||||
@ -1286,12 +1294,14 @@ multiclass Base_VOP2_Real_e32e64_vi <bits<6> op> :
|
||||
} // End AssemblerPredicates = [isGFX8GFX9], DecoderNamespace = "GFX8"
|
||||
|
||||
multiclass VOP2_SDWA_Real <bits<6> op> {
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA>.ret in
|
||||
def _sdwa_vi :
|
||||
VOP_SDWA_Real <!cast<VOP2_SDWA_Pseudo>(NAME#"_sdwa")>,
|
||||
VOP2_SDWAe <op{5-0}, !cast<VOP2_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
|
||||
}
|
||||
|
||||
multiclass VOP2_SDWA9_Real <bits<6> op> {
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_gfx9 :
|
||||
VOP_SDWA9_Real <!cast<VOP2_SDWA_Pseudo>(NAME#"_sdwa")>,
|
||||
VOP2_SDWA9Ae <op{5-0}, !cast<VOP2_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
|
||||
@ -1314,12 +1324,13 @@ multiclass VOP2be_Real_e32e64_vi_only <bits<6> op, string OpName, string AsmName
|
||||
let AsmString = AsmName # ps.AsmOperands;
|
||||
let DecoderNamespace = "GFX8";
|
||||
}
|
||||
def _sdwa_vi :
|
||||
VOP_SDWA_Real <!cast<VOP2_SDWA_Pseudo>(OpName#"_sdwa")>,
|
||||
VOP2_SDWAe <op{5-0}, !cast<VOP2_SDWA_Pseudo>(OpName#"_sdwa").Pfl> {
|
||||
VOP2_SDWA_Pseudo ps = !cast<VOP2_SDWA_Pseudo>(OpName#"_sdwa");
|
||||
let AsmString = AsmName # ps.AsmOperands;
|
||||
}
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(OpName#"_e32").Pfl.HasExtSDWA>.ret in
|
||||
def _sdwa_vi :
|
||||
VOP_SDWA_Real <!cast<VOP2_SDWA_Pseudo>(OpName#"_sdwa")>,
|
||||
VOP2_SDWAe <op{5-0}, !cast<VOP2_SDWA_Pseudo>(OpName#"_sdwa").Pfl> {
|
||||
VOP2_SDWA_Pseudo ps = !cast<VOP2_SDWA_Pseudo>(OpName#"_sdwa");
|
||||
let AsmString = AsmName # ps.AsmOperands;
|
||||
}
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(OpName#"_e32").Pfl.HasExtDPP>.ret in
|
||||
def _dpp_vi :
|
||||
VOP_DPP_Real<!cast<VOP2_DPP_Pseudo>(OpName#"_dpp"), SIEncodingFamily.VI>,
|
||||
@ -1347,12 +1358,13 @@ multiclass VOP2be_Real_e32e64_gfx9 <bits<6> op, string OpName, string AsmName> {
|
||||
let AsmString = AsmName # ps.AsmOperands;
|
||||
let DecoderNamespace = "GFX9";
|
||||
}
|
||||
def _sdwa_gfx9 :
|
||||
VOP_SDWA9_Real <!cast<VOP2_SDWA_Pseudo>(OpName#"_sdwa")>,
|
||||
VOP2_SDWA9Ae <op{5-0}, !cast<VOP2_SDWA_Pseudo>(OpName#"_sdwa").Pfl> {
|
||||
VOP2_SDWA_Pseudo ps = !cast<VOP2_SDWA_Pseudo>(OpName#"_sdwa");
|
||||
let AsmString = AsmName # ps.AsmOperands;
|
||||
}
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(OpName#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_gfx9 :
|
||||
VOP_SDWA9_Real <!cast<VOP2_SDWA_Pseudo>(OpName#"_sdwa")>,
|
||||
VOP2_SDWA9Ae <op{5-0}, !cast<VOP2_SDWA_Pseudo>(OpName#"_sdwa").Pfl> {
|
||||
VOP2_SDWA_Pseudo ps = !cast<VOP2_SDWA_Pseudo>(OpName#"_sdwa");
|
||||
let AsmString = AsmName # ps.AsmOperands;
|
||||
}
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(OpName#"_e32").Pfl.HasExtDPP>.ret in
|
||||
def _dpp_gfx9 :
|
||||
VOP_DPP_Real<!cast<VOP2_DPP_Pseudo>(OpName#"_dpp"), SIEncodingFamily.GFX9>,
|
||||
@ -1374,10 +1386,11 @@ multiclass VOP2_Real_e32e64_gfx9 <bits<6> op> {
|
||||
VOP3e_vi <{0, 1, 0, 0, op{5-0}}, !cast<VOP3_Pseudo>(NAME#"_e64").Pfl> {
|
||||
let DecoderNamespace = "GFX9";
|
||||
}
|
||||
def _sdwa_gfx9 :
|
||||
VOP_SDWA9_Real <!cast<VOP2_SDWA_Pseudo>(NAME#"_sdwa")>,
|
||||
VOP2_SDWA9Ae <op{5-0}, !cast<VOP2_SDWA_Pseudo>(NAME#"_sdwa").Pfl> {
|
||||
}
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_gfx9 :
|
||||
VOP_SDWA9_Real <!cast<VOP2_SDWA_Pseudo>(NAME#"_sdwa")>,
|
||||
VOP2_SDWA9Ae <op{5-0}, !cast<VOP2_SDWA_Pseudo>(NAME#"_sdwa").Pfl> {
|
||||
}
|
||||
foreach _ = BoolToList<!cast<VOP2_Pseudo>(NAME#"_e32").Pfl.HasExtDPP>.ret in
|
||||
def _dpp_gfx9 :
|
||||
VOP_DPP_Real<!cast<VOP2_DPP_Pseudo>(NAME#"_dpp"), SIEncodingFamily.GFX9>,
|
||||
|
@ -225,6 +225,7 @@ multiclass VOPC_Pseudos <string opName,
|
||||
let isCommutable = 1;
|
||||
}
|
||||
|
||||
foreach _ = BoolToList<P.HasExtSDWA>.ret in
|
||||
def _sdwa : VOPC_SDWA_Pseudo <opName, P> {
|
||||
let Defs = !if(DefExec, [VCC, EXEC], [VCC]);
|
||||
let SchedRW = P.Schedule;
|
||||
@ -261,6 +262,7 @@ multiclass VOPCX_Pseudos <string opName,
|
||||
let SubtargetPredicate = HasNoSdstCMPX;
|
||||
}
|
||||
|
||||
foreach _ = BoolToList<P_NoSDst.HasExtSDWA>.ret in
|
||||
def _nosdst_sdwa : VOPC_SDWA_Pseudo <opName#"_nosdst", P_NoSDst> {
|
||||
let Defs = [EXEC];
|
||||
let SchedRW = P_NoSDst.Schedule;
|
||||
@ -670,6 +672,7 @@ multiclass VOPC_Class_Pseudos <string opName, VOPC_Profile p, bit DefExec,
|
||||
let SchedRW = p.Schedule;
|
||||
}
|
||||
|
||||
foreach _ = BoolToList<p.HasExtSDWA>.ret in
|
||||
def _sdwa : VOPC_SDWA_Pseudo <opName, p> {
|
||||
let Defs = !if(DefExec, !if(DefVcc, [VCC, EXEC], [EXEC]),
|
||||
!if(DefVcc, [VCC], []));
|
||||
@ -699,6 +702,7 @@ multiclass VOPCX_Class_Pseudos <string opName,
|
||||
let SubtargetPredicate = HasNoSdstCMPX;
|
||||
}
|
||||
|
||||
foreach _ = BoolToList<P_NoSDst.HasExtSDWA>.ret in
|
||||
def _nosdst_sdwa : VOPC_SDWA_Pseudo <opName#"_nosdst", P_NoSDst> {
|
||||
let Defs = [EXEC];
|
||||
let SchedRW = P_NoSDst.Schedule;
|
||||
@ -882,6 +886,7 @@ let AssemblerPredicate = isGFX10Plus in {
|
||||
}
|
||||
} // End DecoderNamespace = "GFX10"
|
||||
|
||||
foreach _ = BoolToList<!cast<VOPC_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_gfx10 :
|
||||
VOP_SDWA10_Real<!cast<VOPC_SDWA_Pseudo>(NAME#"_sdwa")>,
|
||||
VOPC_SDWA9e<op{7-0}, !cast<VOPC_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
|
||||
@ -907,6 +912,7 @@ let AssemblerPredicate = isGFX10Plus in {
|
||||
}
|
||||
} // End DecoderNamespace = "GFX10"
|
||||
|
||||
foreach _ = BoolToList<!cast<VOPC_Pseudo>(NAME#"_nosdst_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_gfx10 :
|
||||
VOP_SDWA10_Real<!cast<VOPC_SDWA_Pseudo>(NAME#"_nosdst_sdwa")>,
|
||||
VOPC_SDWA9e<op{7-0}, !cast<VOPC_SDWA_Pseudo>(NAME#"_nosdst_sdwa").Pfl> {
|
||||
@ -1227,10 +1233,12 @@ multiclass VOPC_Real_vi <bits<10> op> {
|
||||
}
|
||||
}
|
||||
|
||||
foreach _ = BoolToList<!cast<VOPC_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA>.ret in
|
||||
def _sdwa_vi :
|
||||
VOP_SDWA_Real <!cast<VOPC_SDWA_Pseudo>(NAME#"_sdwa")>,
|
||||
VOPC_SDWAe <op{7-0}, !cast<VOPC_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
|
||||
|
||||
foreach _ = BoolToList<!cast<VOPC_Pseudo>(NAME#"_e32").Pfl.HasExtSDWA9>.ret in
|
||||
def _sdwa_gfx9 :
|
||||
VOP_SDWA9_Real <!cast<VOPC_SDWA_Pseudo>(NAME#"_sdwa")>,
|
||||
VOPC_SDWA9e <op{7-0}, !cast<VOPC_SDWA_Pseudo>(NAME#"_sdwa").Pfl>;
|
||||
|
Loading…
Reference in New Issue
Block a user