diff --git a/llvm/lib/Target/AMDGPU/VOP1Instructions.td b/llvm/lib/Target/AMDGPU/VOP1Instructions.td --- a/llvm/lib/Target/AMDGPU/VOP1Instructions.td +++ b/llvm/lib/Target/AMDGPU/VOP1Instructions.td @@ -104,13 +104,18 @@ SDPatternOperator node = null_frag> { def _e32 : VOP1_Pseudo ; def _e64 : VOP3_Pseudo .ret>; - def _sdwa : VOP1_SDWA_Pseudo ; + + foreach _ = BoolToList.ret in + def _sdwa : VOP1_SDWA_Pseudo ; + foreach _ = BoolToList.ret in def _dpp : VOP1_DPP_Pseudo ; def : MnemonicAlias, LetDummies; def : MnemonicAlias, LetDummies; - def : MnemonicAlias, LetDummies; + + foreach _ = BoolToList.ret in + def : MnemonicAlias, LetDummies; foreach _ = BoolToList.ret in def : MnemonicAlias, LetDummies; @@ -500,6 +505,7 @@ VOP3e_gfx10<{0, 1, 1, op{6-0}}, !cast(NAME#"_e64").Pfl>; } multiclass VOP1_Real_sdwa_gfx10 op> { + foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in def _sdwa_gfx10 : VOP_SDWA10_Real(NAME#"_sdwa")>, VOP1_SDWA9Ae(NAME#"_sdwa").Pfl> { @@ -714,10 +720,12 @@ multiclass VOP1_Real_vi op> { defm NAME : VOP1_Real_e32e64_vi ; + foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA>.ret in def _sdwa_vi : VOP_SDWA_Real (NAME#"_sdwa")>, VOP1_SDWAe (NAME#"_sdwa").Pfl>; + foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in def _sdwa_gfx9 : VOP_SDWA9_Real (NAME#"_sdwa")>, VOP1_SDWA9Ae (NAME#"_sdwa").Pfl>; @@ -895,6 +903,7 @@ defm NAME : VOP1_Real_e32e64_vi ; } + foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in def _sdwa_gfx9 : VOP_SDWA9_Real (NAME#"_sdwa")>, VOP1_SDWA9Ae (NAME#"_sdwa").Pfl>; diff --git a/llvm/lib/Target/AMDGPU/VOP2Instructions.td b/llvm/lib/Target/AMDGPU/VOP2Instructions.td --- a/llvm/lib/Target/AMDGPU/VOP2Instructions.td +++ b/llvm/lib/Target/AMDGPU/VOP2Instructions.td @@ -147,7 +147,8 @@ string revOp = opName, bit GFX9Renamed = 0> { let renamedInGFX9 = GFX9Renamed in { - def _sdwa : VOP2_SDWA_Pseudo ; + foreach _ = BoolToList.ret in + def _sdwa : VOP2_SDWA_Pseudo ; } // End renamedInGFX9 = GFX9Renamed } @@ -179,9 +180,10 @@ let usesCustomInserter = !eq(P.NumSrcArgs, 2); } - def _sdwa : VOP2_SDWA_Pseudo { - let AsmMatchConverter = "cvtSdwaVOP2b"; - } + foreach _ = BoolToList.ret in + def _sdwa : VOP2_SDWA_Pseudo { + let AsmMatchConverter = "cvtSdwaVOP2b"; + } foreach _ = BoolToList.ret in def _dpp : VOP2_DPP_Pseudo ; } @@ -220,9 +222,10 @@ def _e32 : VOP2_Pseudo , Commutable_REV; - def _sdwa : VOP2_SDWA_Pseudo { - let AsmMatchConverter = "cvtSdwaVOP2b"; - } + foreach _ = BoolToList.ret in + def _sdwa : VOP2_SDWA_Pseudo { + let AsmMatchConverter = "cvtSdwaVOP2b"; + } foreach _ = BoolToList.ret in def _dpp : VOP2_DPP_Pseudo ; @@ -882,6 +885,7 @@ VOP3e_gfx10<{0, 1, 0, 0, op{5-0}}, !cast(NAME#"_e64").Pfl>; } multiclass VOP2_Real_sdwa_gfx10 op> { + foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in def _sdwa_gfx10 : VOP_SDWA10_Real(NAME#"_sdwa")>, VOP2_SDWA9Ae(NAME#"_sdwa").Pfl> { @@ -924,6 +928,7 @@ let DecoderNamespace = "SDWA10" in { multiclass VOP2_Real_sdwa_gfx10_with_name op, string opName, string asmName> { + foreach _ = BoolToList(opName#"_e32").Pfl.HasExtSDWA9>.ret in def _sdwa_gfx10 : VOP_SDWA10_Real(opName#"_sdwa")>, VOP2_SDWA9Ae(opName#"_sdwa").Pfl> { @@ -965,6 +970,7 @@ VOP3_Pseudo Ps = !cast(opName#"_e64"); let AsmString = asmName # Ps.AsmOperands; } + foreach _ = BoolToList(opName#"_e32").Pfl.HasExtSDWA9>.ret in def _sdwa_gfx10 : VOP_SDWA10_Real(opName#"_sdwa")>, VOP2_SDWA9Ae(opName#"_sdwa").Pfl> { @@ -988,6 +994,7 @@ } let WaveSizePredicate = isWave32 in { + foreach _ = BoolToList(opName#"_e32").Pfl.HasExtSDWA9>.ret in def _sdwa_w32_gfx10 : Base_VOP_SDWA10_Real(opName#"_sdwa")>, VOP2_SDWA9Ae(opName#"_sdwa").Pfl> { @@ -1011,6 +1018,7 @@ } // End WaveSizePredicate = isWave32 let WaveSizePredicate = isWave64 in { + foreach _ = BoolToList(opName#"_e32").Pfl.HasExtSDWA9>.ret in def _sdwa_w64_gfx10 : Base_VOP_SDWA10_Real(opName#"_sdwa")>, VOP2_SDWA9Ae(opName#"_sdwa").Pfl> { @@ -1286,12 +1294,14 @@ } // End AssemblerPredicates = [isGFX8GFX9], DecoderNamespace = "GFX8" multiclass VOP2_SDWA_Real op> { + foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA>.ret in def _sdwa_vi : VOP_SDWA_Real (NAME#"_sdwa")>, VOP2_SDWAe (NAME#"_sdwa").Pfl>; } multiclass VOP2_SDWA9_Real op> { + foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in def _sdwa_gfx9 : VOP_SDWA9_Real (NAME#"_sdwa")>, VOP2_SDWA9Ae (NAME#"_sdwa").Pfl>; @@ -1314,12 +1324,13 @@ let AsmString = AsmName # ps.AsmOperands; let DecoderNamespace = "GFX8"; } - def _sdwa_vi : - VOP_SDWA_Real (OpName#"_sdwa")>, - VOP2_SDWAe (OpName#"_sdwa").Pfl> { - VOP2_SDWA_Pseudo ps = !cast(OpName#"_sdwa"); - let AsmString = AsmName # ps.AsmOperands; - } + foreach _ = BoolToList(OpName#"_e32").Pfl.HasExtSDWA>.ret in + def _sdwa_vi : + VOP_SDWA_Real (OpName#"_sdwa")>, + VOP2_SDWAe (OpName#"_sdwa").Pfl> { + VOP2_SDWA_Pseudo ps = !cast(OpName#"_sdwa"); + let AsmString = AsmName # ps.AsmOperands; + } foreach _ = BoolToList(OpName#"_e32").Pfl.HasExtDPP>.ret in def _dpp_vi : VOP_DPP_Real(OpName#"_dpp"), SIEncodingFamily.VI>, @@ -1347,12 +1358,13 @@ let AsmString = AsmName # ps.AsmOperands; let DecoderNamespace = "GFX9"; } - def _sdwa_gfx9 : - VOP_SDWA9_Real (OpName#"_sdwa")>, - VOP2_SDWA9Ae (OpName#"_sdwa").Pfl> { - VOP2_SDWA_Pseudo ps = !cast(OpName#"_sdwa"); - let AsmString = AsmName # ps.AsmOperands; - } + foreach _ = BoolToList(OpName#"_e32").Pfl.HasExtSDWA9>.ret in + def _sdwa_gfx9 : + VOP_SDWA9_Real (OpName#"_sdwa")>, + VOP2_SDWA9Ae (OpName#"_sdwa").Pfl> { + VOP2_SDWA_Pseudo ps = !cast(OpName#"_sdwa"); + let AsmString = AsmName # ps.AsmOperands; + } foreach _ = BoolToList(OpName#"_e32").Pfl.HasExtDPP>.ret in def _dpp_gfx9 : VOP_DPP_Real(OpName#"_dpp"), SIEncodingFamily.GFX9>, @@ -1374,10 +1386,11 @@ VOP3e_vi <{0, 1, 0, 0, op{5-0}}, !cast(NAME#"_e64").Pfl> { let DecoderNamespace = "GFX9"; } - def _sdwa_gfx9 : - VOP_SDWA9_Real (NAME#"_sdwa")>, - VOP2_SDWA9Ae (NAME#"_sdwa").Pfl> { - } + foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in + def _sdwa_gfx9 : + VOP_SDWA9_Real (NAME#"_sdwa")>, + VOP2_SDWA9Ae (NAME#"_sdwa").Pfl> { + } foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtDPP>.ret in def _dpp_gfx9 : VOP_DPP_Real(NAME#"_dpp"), SIEncodingFamily.GFX9>, diff --git a/llvm/lib/Target/AMDGPU/VOPCInstructions.td b/llvm/lib/Target/AMDGPU/VOPCInstructions.td --- a/llvm/lib/Target/AMDGPU/VOPCInstructions.td +++ b/llvm/lib/Target/AMDGPU/VOPCInstructions.td @@ -225,6 +225,7 @@ let isCommutable = 1; } + foreach _ = BoolToList.ret in def _sdwa : VOPC_SDWA_Pseudo { let Defs = !if(DefExec, [VCC, EXEC], [VCC]); let SchedRW = P.Schedule; @@ -261,6 +262,7 @@ let SubtargetPredicate = HasNoSdstCMPX; } + foreach _ = BoolToList.ret in def _nosdst_sdwa : VOPC_SDWA_Pseudo { let Defs = [EXEC]; let SchedRW = P_NoSDst.Schedule; @@ -670,6 +672,7 @@ let SchedRW = p.Schedule; } + foreach _ = BoolToList.ret in def _sdwa : VOPC_SDWA_Pseudo { let Defs = !if(DefExec, !if(DefVcc, [VCC, EXEC], [EXEC]), !if(DefVcc, [VCC], [])); @@ -699,6 +702,7 @@ let SubtargetPredicate = HasNoSdstCMPX; } + foreach _ = BoolToList.ret in def _nosdst_sdwa : VOPC_SDWA_Pseudo { let Defs = [EXEC]; let SchedRW = P_NoSDst.Schedule; @@ -882,6 +886,7 @@ } } // End DecoderNamespace = "GFX10" + foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in def _sdwa_gfx10 : VOP_SDWA10_Real(NAME#"_sdwa")>, VOPC_SDWA9e(NAME#"_sdwa").Pfl>; @@ -907,6 +912,7 @@ } } // End DecoderNamespace = "GFX10" + foreach _ = BoolToList(NAME#"_nosdst_e32").Pfl.HasExtSDWA9>.ret in def _sdwa_gfx10 : VOP_SDWA10_Real(NAME#"_nosdst_sdwa")>, VOPC_SDWA9e(NAME#"_nosdst_sdwa").Pfl> { @@ -1227,10 +1233,12 @@ } } + foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA>.ret in def _sdwa_vi : VOP_SDWA_Real (NAME#"_sdwa")>, VOPC_SDWAe (NAME#"_sdwa").Pfl>; + foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in def _sdwa_gfx9 : VOP_SDWA9_Real (NAME#"_sdwa")>, VOPC_SDWA9e (NAME#"_sdwa").Pfl>;