diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td index 775dca90b8a04..35c83f4f89583 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPU.td +++ b/llvm/lib/Target/AMDGPU/AMDGPU.td @@ -18,10 +18,6 @@ def p4 : PtrValueType; def p5 : PtrValueType; def p6 : PtrValueType; -class BoolToList { - list ret = !if(Value, [1], []); -} - //===------------------------------------------------------------===// // Subtarget Features (device properties) //===------------------------------------------------------------===// diff --git a/llvm/lib/Target/AMDGPU/BUFInstructions.td b/llvm/lib/Target/AMDGPU/BUFInstructions.td index 37747c5f39261..aacdffad32392 100644 --- a/llvm/lib/Target/AMDGPU/BUFInstructions.td +++ b/llvm/lib/Target/AMDGPU/BUFInstructions.td @@ -2697,11 +2697,11 @@ multiclass MUBUF_Real_vi_gfx90a op, MUBUF_Pseudo ps, bit isTFE = 0> { def _vi : MUBUF_Real_vi; if !not(isTFE) then { - foreach _ = BoolToList.ret in + if !not(ps.FPAtomic) then def _gfx90a : MUBUF_Real_gfx90a; } - foreach _ = BoolToList.ret in { + if ps.FPAtomic then { def _gfx90a : MUBUF_Real_gfx90a { let SubtargetPredicate = isGFX90AOnly; let AssemblerPredicate = isGFX90AOnly; diff --git a/llvm/lib/Target/AMDGPU/VOP1Instructions.td b/llvm/lib/Target/AMDGPU/VOP1Instructions.td index e6f9034829951..72ed1cc95a112 100644 --- a/llvm/lib/Target/AMDGPU/VOP1Instructions.td +++ b/llvm/lib/Target/AMDGPU/VOP1Instructions.td @@ -124,24 +124,24 @@ multiclass VOP1Inst ; } - foreach _ = BoolToList.ret in + if P.HasExtSDWA then def _sdwa : VOP1_SDWA_Pseudo ; - foreach _ = BoolToList.ret in + if P.HasExtDPP then def _dpp : VOP1_DPP_Pseudo ; let SubtargetPredicate = isGFX11Plus in { - foreach _ = BoolToList.ret in + if P.HasExtVOP3DPP then def _e64_dpp : VOP3_DPP_Pseudo ; } // End SubtargetPredicate = isGFX11Plus def : MnemonicAlias, LetDummies; def : MnemonicAlias, LetDummies; - foreach _ = BoolToList.ret in + if P.HasExtSDWA then def : MnemonicAlias, LetDummies; - foreach _ = BoolToList.ret in + if P.HasExtDPP then def : MnemonicAlias, LetDummies; } @@ -844,7 +844,7 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { 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 + if !cast(NAME#"_e32").Pfl.HasExtSDWA9 then def _sdwa_gfx10 : VOP_SDWA10_Real(NAME#"_sdwa")>, VOP1_SDWA9Ae(NAME#"_sdwa").Pfl> { @@ -852,13 +852,13 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { } } multiclass VOP1_Real_dpp_gfx10 op> { - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExt32BitDPP>.ret in + if !cast(NAME#"_e32").Pfl.HasExt32BitDPP then def _dpp_gfx10 : VOP1_DPP16(NAME#"_dpp"), SIEncodingFamily.GFX10> { let DecoderNamespace = "SDWA10"; } } multiclass VOP1_Real_dpp8_gfx10 op> { - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExt32BitDPP>.ret in + if !cast(NAME#"_e32").Pfl.HasExt32BitDPP then def _dpp8_gfx10 : VOP1_DPP8(NAME#"_e32")> { let DecoderNamespace = "DPP8"; } @@ -1064,17 +1064,17 @@ multiclass VOP1_Real_e32e64_vi op> { multiclass VOP1_Real_vi op> { defm NAME : VOP1_Real_e32e64_vi ; - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA>.ret in + if !cast(NAME#"_e32").Pfl.HasExtSDWA then def _sdwa_vi : VOP_SDWA_Real (NAME#"_sdwa")>, VOP1_SDWAe (NAME#"_sdwa").Pfl>; - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in + if !cast(NAME#"_e32").Pfl.HasExtSDWA9 then def _sdwa_gfx9 : VOP_SDWA9_Real (NAME#"_sdwa")>, VOP1_SDWA9Ae (NAME#"_sdwa").Pfl>; - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtDPP>.ret in + if !cast(NAME#"_e32").Pfl.HasExtDPP then def _dpp_vi : VOP_DPP_Real(NAME#"_dpp"), SIEncodingFamily.VI>, VOP1_DPPe(NAME#"_dpp")>; @@ -1238,12 +1238,12 @@ multiclass VOP1_Real_gfx9 op> { defm NAME : VOP1_Real_e32e64_vi ; } - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in + if !cast(NAME#"_e32").Pfl.HasExtSDWA9 then def _sdwa_gfx9 : VOP_SDWA9_Real (NAME#"_sdwa")>, VOP1_SDWA9Ae (NAME#"_sdwa").Pfl>; - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtDPP>.ret in + if !cast(NAME#"_e32").Pfl.HasExtDPP then def _dpp_gfx9 : VOP_DPP_Real(NAME#"_dpp"), SIEncodingFamily.GFX9>, VOP1_DPPe(NAME#"_dpp")>; @@ -1255,14 +1255,14 @@ multiclass VOP1_Real_NoDstSel_SDWA_gfx9 op> { defm NAME : VOP1_Real_e32e64_vi ; } - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in + if !cast(NAME#"_e32").Pfl.HasExtSDWA9 then def _sdwa_gfx9 : VOP_SDWA9_Real (NAME#"_sdwa")>, VOP1_SDWA9Ae (NAME#"_sdwa").Pfl> { let Inst{42-40} = 6; } - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtDPP>.ret in + if !cast(NAME#"_e32").Pfl.HasExtDPP then def _dpp_gfx9 : VOP_DPP_Real(NAME#"_dpp"), SIEncodingFamily.GFX9>, VOP1_DPPe(NAME#"_dpp")>; diff --git a/llvm/lib/Target/AMDGPU/VOP2Instructions.td b/llvm/lib/Target/AMDGPU/VOP2Instructions.td index d8d7682645032..446e7d01c1d81 100644 --- a/llvm/lib/Target/AMDGPU/VOP2Instructions.td +++ b/llvm/lib/Target/AMDGPU/VOP2Instructions.td @@ -157,7 +157,7 @@ multiclass VOP2Inst_e64; let SubtargetPredicate = isGFX11Plus in { - foreach _ = BoolToList.ret in + if P.HasExtVOP3DPP then def _e64_dpp : VOP3_DPP_Pseudo ; } // End SubtargetPredicate = isGFX11Plus } // End renamedInGFX9 = GFX9Renamed @@ -167,7 +167,7 @@ multiclass VOP2Inst_sdwa { let renamedInGFX9 = GFX9Renamed in { - foreach _ = BoolToList.ret in + if P.HasExtSDWA then def _sdwa : VOP2_SDWA_Pseudo ; } // End renamedInGFX9 = GFX9Renamed } @@ -181,7 +181,7 @@ multiclass VOP2Inst, VOP2Inst_sdwa { let renamedInGFX9 = GFX9Renamed in { - foreach _ = BoolToList.ret in + if P.HasExtDPP then def _dpp : VOP2_DPP_Pseudo ; } } @@ -227,7 +227,7 @@ multiclass VOP2Inst_VOPD, VOP2Inst_sdwa { let renamedInGFX9 = GFX9Renamed in { - foreach _ = BoolToList.ret in + if P.HasExtDPP then def _dpp : VOP2_DPP_Pseudo ; } } @@ -246,11 +246,11 @@ multiclass VOP2bInst .ret in + if P.HasExtSDWA then def _sdwa : VOP2_SDWA_Pseudo { let AsmMatchConverter = "cvtSdwaVOP2b"; } - foreach _ = BoolToList.ret in + if P.HasExtDPP then def _dpp : VOP2_DPP_Pseudo ; } // End Uses = !if(useSGPRInput, [VCC, EXEC], [EXEC]), Defs = [VCC] @@ -258,7 +258,7 @@ multiclass VOP2bInst ; let SubtargetPredicate = isGFX11Plus in { - foreach _ = BoolToList.ret in + if P.HasExtVOP3DPP then def _e64_dpp : VOP3_DPP_Pseudo ; } // End SubtargetPredicate = isGFX11Plus } @@ -297,12 +297,12 @@ multiclass Commutable_REV, VOPD_Component; - foreach _ = BoolToList.ret in + if P.HasExtSDWA then def _sdwa : VOP2_SDWA_Pseudo { let AsmMatchConverter = "cvtSdwaVOP2e"; } - foreach _ = BoolToList.ret in + if P.HasExtDPP then def _dpp : VOP2_DPP_Pseudo ; } @@ -312,7 +312,7 @@ multiclass } let SubtargetPredicate = isGFX11Plus in { - foreach _ = BoolToList.ret in + if P.HasExtVOP3DPP then def _e64_dpp : VOP3_DPP_Pseudo ; } // End SubtargetPredicate = isGFX11Plus } @@ -1265,13 +1265,13 @@ let AssemblerPredicate = isGFX11Only, DecoderNamespace = "GFX11" in { VOP3e_gfx11<{0, 1, 0, 0, op{5-0}}, !cast(NAME#"_e64").Pfl>; } multiclass VOP2_Real_dpp_gfx11 op> { - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtDPP>.ret in + if !cast(NAME#"_e32").Pfl.HasExtDPP then def _dpp_gfx11 : VOP2_DPP16(NAME#"_dpp"), SIEncodingFamily.GFX11> { let DecoderNamespace = "DPPGFX11"; } } multiclass VOP2_Real_dpp8_gfx11 op> { - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtDPP>.ret in + if !cast(NAME#"_e32").Pfl.HasExtDPP then def _dpp8_gfx11 : VOP2_DPP8(NAME#"_e32")> { let DecoderNamespace = "DPP8GFX11"; } @@ -1301,7 +1301,7 @@ let AssemblerPredicate = isGFX11Only, DecoderNamespace = "GFX11" in { multiclass VOP2_Real_dpp_with_name_gfx11 op, string opName, string asmName> { defvar ps = !cast(opName#"_e32"); - foreach _ = BoolToList.ret in + if ps.Pfl.HasExtDPP then def _dpp_gfx11 : VOP2_DPP16(opName#"_dpp"), SIEncodingFamily.GFX11> { let AsmString = asmName # ps.Pfl.AsmDPP16; @@ -1311,7 +1311,7 @@ let AssemblerPredicate = isGFX11Only, DecoderNamespace = "GFX11" in { multiclass VOP2_Real_dpp8_with_name_gfx11 op, string opName, string asmName> { defvar ps = !cast(opName#"_e32"); - foreach _ = BoolToList.ret in + if ps.Pfl.HasExtDPP then def _dpp8_gfx11 : VOP2_DPP8 { let AsmString = asmName # ps.Pfl.AsmDPP8; let DecoderNamespace = "DPP8GFX11"; @@ -1328,14 +1328,14 @@ let AssemblerPredicate = isGFX11Only, DecoderNamespace = "GFX11" in { } } multiclass VOP2be_Real_dpp_gfx11 op, string opName, string asmName> { - foreach _ = BoolToList(opName#"_e32").Pfl.HasExtDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExtDPP then def _dpp_gfx11 : VOP2_DPP16(opName#"_dpp"), SIEncodingFamily.GFX11, asmName> { string AsmDPP = !cast(opName#"_e32").Pfl.AsmDPP16; let AsmString = asmName # !subst(", vcc", "", AsmDPP); let DecoderNamespace = "DPPGFX11"; } - foreach _ = BoolToList(opName#"_e32").Pfl.HasExtDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExtDPP then def _dpp_w32_gfx11 : Base_VOP2_DPP16(opName#"_dpp"), asmName> { string AsmDPP = !cast(opName#"_e32").Pfl.AsmDPP16; @@ -1343,7 +1343,7 @@ let AssemblerPredicate = isGFX11Only, DecoderNamespace = "GFX11" in { let isAsmParserOnly = 1; let WaveSizePredicate = isWave32; } - foreach _ = BoolToList(opName#"_e32").Pfl.HasExtDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExtDPP then def _dpp_w64_gfx11 : Base_VOP2_DPP16(opName#"_dpp"), asmName> { string AsmDPP = !cast(opName#"_e32").Pfl.AsmDPP16; @@ -1353,14 +1353,14 @@ let AssemblerPredicate = isGFX11Only, DecoderNamespace = "GFX11" in { } } multiclass VOP2be_Real_dpp8_gfx11 op, string opName, string asmName> { - foreach _ = BoolToList(opName#"_e32").Pfl.HasExtDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExtDPP then def _dpp8_gfx11 : VOP2_DPP8(opName#"_e32")> { string AsmDPP8 = !cast(opName#"_e32").Pfl.AsmDPP8; let AsmString = asmName # !subst(", vcc", "", AsmDPP8); let DecoderNamespace = "DPP8GFX11"; } - foreach _ = BoolToList(opName#"_e32").Pfl.HasExtDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExtDPP then def _dpp8_w32_gfx11 : VOP2_DPP8(opName#"_e32")> { string AsmDPP8 = !cast(opName#"_e32").Pfl.AsmDPP8; @@ -1368,7 +1368,7 @@ let AssemblerPredicate = isGFX11Only, DecoderNamespace = "GFX11" in { let isAsmParserOnly = 1; let WaveSizePredicate = isWave32; } - foreach _ = BoolToList(opName#"_e32").Pfl.HasExtDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExtDPP then def _dpp8_w64_gfx11 : VOP2_DPP8(opName#"_e32")> { string AsmDPP8 = !cast(opName#"_e32").Pfl.AsmDPP8; @@ -1532,7 +1532,7 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { 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 + if !cast(NAME#"_e32").Pfl.HasExtSDWA9 then def _sdwa_gfx10 : VOP_SDWA10_Real(NAME#"_sdwa")>, VOP2_SDWA9Ae(NAME#"_sdwa").Pfl> { @@ -1540,13 +1540,13 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { } } multiclass VOP2_Real_dpp_gfx10 op> { - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExt32BitDPP>.ret in + if !cast(NAME#"_e32").Pfl.HasExt32BitDPP then def _dpp_gfx10 : VOP2_DPP16(NAME#"_dpp"), SIEncodingFamily.GFX10> { let DecoderNamespace = "SDWA10"; } } multiclass VOP2_Real_dpp8_gfx10 op> { - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExt32BitDPP>.ret in + if !cast(NAME#"_e32").Pfl.HasExt32BitDPP then def _dpp8_gfx10 : VOP2_DPP8(NAME#"_e32")> { let DecoderNamespace = "DPP8"; } @@ -1575,7 +1575,7 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { let DecoderNamespace = "SDWA10" in { multiclass VOP2_Real_sdwa_gfx10_with_name op, string opName, string asmName> { - foreach _ = BoolToList(opName#"_e32").Pfl.HasExtSDWA9>.ret in + if !cast(opName#"_e32").Pfl.HasExtSDWA9 then def _sdwa_gfx10 : VOP_SDWA10_Real(opName#"_sdwa")>, VOP2_SDWA9Ae(opName#"_sdwa").Pfl> { @@ -1585,7 +1585,7 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { } multiclass VOP2_Real_dpp_gfx10_with_name op, string opName, string asmName> { - foreach _ = BoolToList(opName#"_e32").Pfl.HasExt32BitDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExt32BitDPP then def _dpp_gfx10 : VOP2_DPP16(opName#"_dpp"), SIEncodingFamily.GFX10> { VOP2_Pseudo ps = !cast(opName#"_e32"); let AsmString = asmName # ps.Pfl.AsmDPP16; @@ -1593,7 +1593,7 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { } multiclass VOP2_Real_dpp8_gfx10_with_name op, string opName, string asmName> { - foreach _ = BoolToList(opName#"_e32").Pfl.HasExt32BitDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExt32BitDPP then def _dpp8_gfx10 : VOP2_DPP8(opName#"_e32")> { VOP2_Pseudo ps = !cast(opName#"_e32"); let AsmString = asmName # ps.Pfl.AsmDPP8; @@ -1621,7 +1621,7 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { } } multiclass VOP2be_Real_sdwa_gfx10 op, string opName, string asmName> { - foreach _ = BoolToList(opName#"_e32").Pfl.HasExtSDWA9>.ret in + if !cast(opName#"_e32").Pfl.HasExtSDWA9 then def _sdwa_gfx10 : VOP_SDWA10_Real(opName#"_sdwa")>, VOP2_SDWA9Ae(opName#"_sdwa").Pfl> { @@ -1629,7 +1629,7 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { let AsmString = asmName # !subst(", vcc", "", Ps.AsmOperands); let DecoderNamespace = "SDWA10"; } - foreach _ = BoolToList(opName#"_e32").Pfl.HasExtSDWA9>.ret in + if !cast(opName#"_e32").Pfl.HasExtSDWA9 then def _sdwa_w32_gfx10 : Base_VOP_SDWA10_Real(opName#"_sdwa")>, VOP2_SDWA9Ae(opName#"_sdwa").Pfl> { @@ -1639,7 +1639,7 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { let DecoderNamespace = "SDWA10"; let WaveSizePredicate = isWave32; } - foreach _ = BoolToList(opName#"_e32").Pfl.HasExtSDWA9>.ret in + if !cast(opName#"_e32").Pfl.HasExtSDWA9 then def _sdwa_w64_gfx10 : Base_VOP_SDWA10_Real(opName#"_sdwa")>, VOP2_SDWA9Ae(opName#"_sdwa").Pfl> { @@ -1651,14 +1651,14 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { } } multiclass VOP2be_Real_dpp_gfx10 op, string opName, string asmName> { - foreach _ = BoolToList(opName#"_e32").Pfl.HasExt32BitDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExt32BitDPP then def _dpp_gfx10 : VOP2_DPP16(opName#"_dpp"), SIEncodingFamily.GFX10, asmName> { string AsmDPP = !cast(opName#"_e32").Pfl.AsmDPP16; let AsmString = asmName # !subst(", vcc", "", AsmDPP); let DecoderNamespace = "SDWA10"; } - foreach _ = BoolToList(opName#"_e32").Pfl.HasExt32BitDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExt32BitDPP then def _dpp_w32_gfx10 : Base_VOP2_DPP16(opName#"_dpp"), asmName> { string AsmDPP = !cast(opName#"_e32").Pfl.AsmDPP16; @@ -1666,7 +1666,7 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { let isAsmParserOnly = 1; let WaveSizePredicate = isWave32; } - foreach _ = BoolToList(opName#"_e32").Pfl.HasExt32BitDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExt32BitDPP then def _dpp_w64_gfx10 : Base_VOP2_DPP16(opName#"_dpp"), asmName> { string AsmDPP = !cast(opName#"_e32").Pfl.AsmDPP16; @@ -1676,14 +1676,14 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { } } multiclass VOP2be_Real_dpp8_gfx10 op, string opName, string asmName> { - foreach _ = BoolToList(opName#"_e32").Pfl.HasExt32BitDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExt32BitDPP then def _dpp8_gfx10 : VOP2_DPP8(opName#"_e32")> { string AsmDPP8 = !cast(opName#"_e32").Pfl.AsmDPP8; let AsmString = asmName # !subst(", vcc", "", AsmDPP8); let DecoderNamespace = "DPP8"; } - foreach _ = BoolToList(opName#"_e32").Pfl.HasExt32BitDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExt32BitDPP then def _dpp8_w32_gfx10 : VOP2_DPP8(opName#"_e32")> { string AsmDPP8 = !cast(opName#"_e32").Pfl.AsmDPP8; @@ -1691,7 +1691,7 @@ let AssemblerPredicate = isGFX10Only, DecoderNamespace = "GFX10" in { let isAsmParserOnly = 1; let WaveSizePredicate = isWave32; } - foreach _ = BoolToList(opName#"_e32").Pfl.HasExt32BitDPP>.ret in + if !cast(opName#"_e32").Pfl.HasExt32BitDPP then def _dpp8_w64_gfx10 : VOP2_DPP8(opName#"_e32")> { string AsmDPP8 = !cast(opName#"_e32").Pfl.AsmDPP8; @@ -2013,14 +2013,14 @@ multiclass Base_VOP2_Real_e32e64_vi op> : } // End AssemblerPredicate = isGFX8GFX9, DecoderNamespace = "GFX8" multiclass VOP2_SDWA_Real op> { - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA>.ret in + if !cast(NAME#"_e32").Pfl.HasExtSDWA then 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 + if !cast(NAME#"_e32").Pfl.HasExtSDWA9 then def _sdwa_gfx9 : VOP_SDWA9_Real (NAME#"_sdwa")>, VOP2_SDWA9Ae (NAME#"_sdwa").Pfl>; @@ -2043,14 +2043,14 @@ multiclass VOP2be_Real_e32e64_vi_only op, string OpName, string AsmName let AsmString = AsmName # ps.AsmOperands; let DecoderNamespace = "GFX8"; } - foreach _ = BoolToList(OpName#"_e32").Pfl.HasExtSDWA>.ret in + if !cast(OpName#"_e32").Pfl.HasExtSDWA then 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 + if !cast(OpName#"_e32").Pfl.HasExtDPP then def _dpp_vi : VOP_DPP_Real(OpName#"_dpp"), SIEncodingFamily.VI>, VOP2_DPPe(OpName#"_dpp")> { @@ -2077,14 +2077,14 @@ multiclass VOP2be_Real_e32e64_gfx9 op, string OpName, string AsmName> { let AsmString = AsmName # ps.AsmOperands; let DecoderNamespace = "GFX9"; } - foreach _ = BoolToList(OpName#"_e32").Pfl.HasExtSDWA9>.ret in + if !cast(OpName#"_e32").Pfl.HasExtSDWA9 then 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 + if !cast(OpName#"_e32").Pfl.HasExtDPP then def _dpp_gfx9 : VOP_DPP_Real(OpName#"_dpp"), SIEncodingFamily.GFX9>, VOP2_DPPe(OpName#"_dpp")> { @@ -2105,12 +2105,12 @@ multiclass VOP2_Real_e32e64_gfx9 op> { VOP3e_vi <{0, 1, 0, 0, op{5-0}}, !cast(NAME#"_e64").Pfl> { let DecoderNamespace = "GFX9"; } - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in + if !cast(NAME#"_e32").Pfl.HasExtSDWA9 then def _sdwa_gfx9 : VOP_SDWA9_Real (NAME#"_sdwa")>, VOP2_SDWA9Ae (NAME#"_sdwa").Pfl> { } - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtDPP>.ret in + if !cast(NAME#"_e32").Pfl.HasExtDPP then def _dpp_gfx9 : VOP_DPP_Real(NAME#"_dpp"), SIEncodingFamily.GFX9>, VOP2_DPPe(NAME#"_dpp")> { @@ -2123,7 +2123,7 @@ multiclass VOP2_Real_e32e64_gfx9 op> { multiclass VOP2_Real_e32e64_vi op> : Base_VOP2_Real_e32e64_vi, VOP2_SDWA_Real, VOP2_SDWA9_Real { - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtDPP>.ret in + if !cast(NAME#"_e32").Pfl.HasExtDPP then def _dpp_vi : VOP_DPP_Real(NAME#"_dpp"), SIEncodingFamily.VI>, VOP2_DPPe(NAME#"_dpp")>; @@ -2270,7 +2270,7 @@ let AssemblerPredicate = isGFX90APlus, DecoderNamespace = "GFX90A" in { multiclass VOP2_Real_e32e64_gfx90a op> : Base_VOP2_Real_e32e64_gfx90a { - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtDPP>.ret in + if !cast(NAME#"_e32").Pfl.HasExtDPP then def _dpp_gfx90a : VOP_DPP_Real(NAME#"_dpp"), SIEncodingFamily.GFX90A>, VOP2_DPPe(NAME#"_dpp")> { diff --git a/llvm/lib/Target/AMDGPU/VOP3PInstructions.td b/llvm/lib/Target/AMDGPU/VOP3PInstructions.td index 8f8c4489454db..422d02e237621 100644 --- a/llvm/lib/Target/AMDGPU/VOP3PInstructions.td +++ b/llvm/lib/Target/AMDGPU/VOP3PInstructions.td @@ -607,7 +607,7 @@ multiclass MAIInst; } - foreach _ = BoolToList.ret in { + if NoDstOverlap then { let Constraints = !if(NoDstOverlap, "$vdst = $src2", ""), isConvertibleToThreeAddress = NoDstOverlap, Mnemonic = OpName in { @@ -1015,7 +1015,7 @@ multiclass VOP3P_Real_MFMA_gfx940_aliases { let Predicates = [isGFX940Plus] in { - foreach _ = BoolToList.ret in { + if !ne(NameFrom, NameTo) then { def : InstAlias (Op # "_gfx940_acd") Pfl_ACD.DstRC:$vdst, Pfl_ACD.Src0RC64:$src0, Pfl_ACD.Src1RC64:$src1, Pfl_ACD.Src2RC64:$src2, @@ -1043,7 +1043,7 @@ multiclass VOP3P_Real_MFMA_gfx940 op, string Name = !cast(N defm : VOP3P_Real_MFMA_gfx940_aliases; - foreach _ = BoolToList.ret in + if !ne(!subst("_1k", "", PS_ACD.Mnemonic), PS_ACD.Mnemonic) then defm : VOP3P_Real_MFMA_gfx940_aliases; } diff --git a/llvm/lib/Target/AMDGPU/VOPCInstructions.td b/llvm/lib/Target/AMDGPU/VOPCInstructions.td index 6f054f3deaea6..9e11775fa9f08 100644 --- a/llvm/lib/Target/AMDGPU/VOPCInstructions.td +++ b/llvm/lib/Target/AMDGPU/VOPCInstructions.td @@ -299,7 +299,7 @@ multiclass VOPC_Pseudos .ret in + if P.HasExtSDWA then def _sdwa : VOPC_SDWA_Pseudo { let Defs = !if(DefExec, [EXEC], []); let SchedRW = P.Schedule; @@ -360,7 +360,7 @@ multiclass VOPCX_Pseudos .ret in + if P_NoSDst.HasExtSDWA then def _nosdst_sdwa : VOPC_SDWA_Pseudo { let Defs = [EXEC]; let SchedRW = P_NoSDst.Schedule; @@ -854,7 +854,7 @@ multiclass VOPC_Class_Pseudos .ret in + if p.HasExtSDWA then def _sdwa : VOPC_SDWA_Pseudo { let Defs = !if(DefExec, !if(DefVcc, [VCC, EXEC], [EXEC]), !if(DefVcc, [VCC], [])); @@ -902,7 +902,7 @@ multiclass VOPCX_Class_Pseudos .ret in + if P_NoSDst.HasExtSDWA then def _nosdst_sdwa : VOPC_SDWA_Pseudo { let Defs = [EXEC]; let SchedRW = P_NoSDst.Schedule; @@ -1320,7 +1320,7 @@ let AssemblerPredicate = isGFX11Only in { defm : VOPCInstAliases; - foreach _ = BoolToList.ret in { + if ps32.Pfl.HasExtDPP then { defvar psDPP = !cast(NAME #"_e32" #"_dpp"); defvar AsmDPP = ps32.Pfl.AsmDPP16; let DecoderNamespace = "DPPGFX11" in { @@ -1352,7 +1352,7 @@ let AssemblerPredicate = isGFX11Only in { } } } - foreach _ = BoolToList.ret in { + if ps64.Pfl.HasExtVOP3DPP then { defvar psDPP = !cast(NAME #"_e64" #"_dpp"); defvar AsmDPP = ps64.Pfl.AsmVOP3DPP16; let DecoderNamespace = "DPPGFX11" in { @@ -1419,7 +1419,7 @@ let AssemblerPredicate = isGFX11Only in { defm : VOPCInstAliases; - foreach _ = BoolToList.ret in { + if ps32.Pfl.HasExtDPP then { defvar psDPP = !cast(OpName #"_e32" #"_dpp"); defvar AsmDPP = ps32.Pfl.AsmDPP16; let DecoderNamespace = "DPPGFX11" in { @@ -1456,7 +1456,7 @@ let AssemblerPredicate = isGFX11Only in { } } - foreach _ = BoolToList.ret in { + if ps64.Pfl.HasExtVOP3DPP then { defvar psDPP = !cast(OpName #"_e64" #"_dpp"); defvar AsmDPP = ps64.Pfl.AsmVOP3DPP16; let DecoderNamespace = "DPPGFX11" in { @@ -1518,7 +1518,7 @@ let AssemblerPredicate = isGFX11Only in { defm : VOPCXInstAliases; - foreach _ = BoolToList.ret in { + if ps32.Pfl.HasExtDPP then { defvar psDPP = !cast(NAME #"_nosdst_e32" #"_dpp"); defvar AsmDPP = ps32.Pfl.AsmDPP16; let DecoderNamespace = "DPPGFX11" in { @@ -1535,7 +1535,7 @@ let AssemblerPredicate = isGFX11Only in { } } - foreach _ = BoolToList.ret in { + if ps64.Pfl.HasExtVOP3DPP then { defvar psDPP = !cast(NAME #"_nosdst_e64" #"_dpp"); defvar AsmDPP = ps64.Pfl.AsmVOP3DPP16; let DecoderNamespace = "DPPGFX11" in { @@ -1584,7 +1584,7 @@ let AssemblerPredicate = isGFX11Only in { defm : VOPCXInstAliases; - foreach _ = BoolToList.ret in { + if ps32.Pfl.HasExtDPP then { defvar psDPP = !cast(OpName#"_nosdst_e32"#"_dpp"); let DecoderNamespace = "DPPGFX11" in { def _e32_dpp_gfx11 : VOPC_DPP16_SIMC; } } - foreach _ = BoolToList.ret in { + if ps64.Pfl.HasExtVOP3DPP then { defvar psDPP = !cast(OpName#"_nosdst_e64"#"_dpp"); defvar AsmDPP = ps64.Pfl.AsmVOP3DPP16; let DecoderNamespace = "DPPGFX11" in { @@ -1821,7 +1821,7 @@ let AssemblerPredicate = isGFX10Only in { } } // End DecoderNamespace = "GFX10" - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in + if !cast(NAME#"_e32").Pfl.HasExtSDWA9 then def _sdwa_gfx10 : VOP_SDWA10_Real(NAME#"_sdwa")>, VOPC_SDWA9e(NAME#"_sdwa").Pfl>; @@ -1847,7 +1847,7 @@ let AssemblerPredicate = isGFX10Only in { } } // End DecoderNamespace = "GFX10" - foreach _ = BoolToList(NAME#"_nosdst_e32").Pfl.HasExtSDWA9>.ret in + if !cast(NAME#"_nosdst_e32").Pfl.HasExtSDWA9 then def _sdwa_gfx10 : VOP_SDWA10_Real(NAME#"_nosdst_sdwa")>, VOPC_SDWA9e(NAME#"_nosdst_sdwa").Pfl> { @@ -2174,12 +2174,12 @@ multiclass VOPC_Real_vi op> { } } - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA>.ret in + if !cast(NAME#"_e32").Pfl.HasExtSDWA then def _sdwa_vi : VOP_SDWA_Real (NAME#"_sdwa")>, VOPC_SDWAe (NAME#"_sdwa").Pfl>; - foreach _ = BoolToList(NAME#"_e32").Pfl.HasExtSDWA9>.ret in + if !cast(NAME#"_e32").Pfl.HasExtSDWA9 then def _sdwa_gfx9 : VOP_SDWA9_Real (NAME#"_sdwa")>, VOPC_SDWA9e (NAME#"_sdwa").Pfl>; diff --git a/llvm/lib/Target/AMDGPU/VOPInstructions.td b/llvm/lib/Target/AMDGPU/VOPInstructions.td index d5c662ac05745..c5e1d4f62d076 100644 --- a/llvm/lib/Target/AMDGPU/VOPInstructions.td +++ b/llvm/lib/Target/AMDGPU/VOPInstructions.td @@ -1268,7 +1268,7 @@ class VOP3InstBase { def _e64 : VOP3InstBase; let SubtargetPredicate = isGFX11Plus in { - foreach _ = BoolToList.ret in + if P.HasExtVOP3DPP then def _e64_dpp : VOP3_DPP_Pseudo ; } // end SubtargetPredicate = isGFX11Plus } @@ -1329,11 +1329,11 @@ let AssemblerPredicate = isGFX11Only, bit isSingle = 0> { defvar ps = !cast(opName#"_e64"); let IsSingle = !or(isSingle, ps.Pfl.IsSingle) in { - foreach _ = BoolToList.ret in + if ps.Pfl.HasOpSel then def _e64_gfx11 : VOP3_Real, VOP3OpSel_gfx11; - foreach _ = BoolToList.ret in + if !not(ps.Pfl.HasOpSel) then def _e64_gfx11 : VOP3_Real, VOP3e_gfx11; @@ -1353,11 +1353,11 @@ let AssemblerPredicate = isGFX11Only, defvar ps = !cast(opName#"_e64"); let AsmString = asmName # ps.AsmOperands, IsSingle = !or(isSingle, ps.Pfl.IsSingle) in { - foreach _ = BoolToList.ret in + if ps.Pfl.HasOpSel then def _e64_gfx11 : VOP3_Real, VOP3OpSel_gfx11; - foreach _ = BoolToList.ret in + if !not(ps.Pfl.HasOpSel) then def _e64_gfx11 : VOP3_Real, VOP3e_gfx11;