diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td index c8ae010414dc40..d7feaef8c4a97d 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPU.td +++ b/llvm/lib/Target/AMDGPU/AMDGPU.td @@ -2103,8 +2103,10 @@ def NotHasMinMaxDenormModes : Predicate<"!Subtarget->supportsMinMaxDenormModes() def HasFminFmaxLegacy : Predicate<"Subtarget->hasFminFmaxLegacy()">; -def HasSDWA : Predicate<"Subtarget->hasSDWA()">, - AssemblerPredicate<(all_of FeatureSDWA, FeatureVolcanicIslands)>; +def HasSDWA : Predicate<"Subtarget->hasSDWA()">; + +def HasSDWA8 : Predicate<"Subtarget->hasSDWA()">, + AssemblerPredicate<(all_of (not FeatureGFX9Insts), FeatureSDWA)>; def HasSDWA9 : Predicate<"Subtarget->hasSDWA()">, diff --git a/llvm/lib/Target/AMDGPU/VOP1Instructions.td b/llvm/lib/Target/AMDGPU/VOP1Instructions.td index c743eb43e3465c..f7a66a08209397 100644 --- a/llvm/lib/Target/AMDGPU/VOP1Instructions.td +++ b/llvm/lib/Target/AMDGPU/VOP1Instructions.td @@ -1268,7 +1268,7 @@ multiclass VOP1_Real_vi op> { if !cast(NAME#"_e32").Pfl.HasExtSDWA then def _sdwa_vi : - VOP_SDWA_Real (NAME#"_sdwa")>, + VOP_SDWA8_Real (NAME#"_sdwa")>, VOP1_SDWAe (NAME#"_sdwa").Pfl>; if !cast(NAME#"_e32").Pfl.HasExtSDWA9 then @@ -1474,7 +1474,7 @@ def : GCNPat < // GFX9 //===----------------------------------------------------------------------===// -let AssemblerPredicate = isGFX9Only, DecoderNamespace = "GFX9" in { +let DecoderNamespace = "GFX9" in { multiclass VOP1_Real_gfx9 op> { defm NAME : VOP1_Real_e32e64_vi ; diff --git a/llvm/lib/Target/AMDGPU/VOP2Instructions.td b/llvm/lib/Target/AMDGPU/VOP2Instructions.td index 925b60561c9d68..c0d38fa52b3446 100644 --- a/llvm/lib/Target/AMDGPU/VOP2Instructions.td +++ b/llvm/lib/Target/AMDGPU/VOP2Instructions.td @@ -766,16 +766,16 @@ defm V_SUBB_U32 : VOP2bInst <"v_subb_u32", VOP2b_I32_I1_I32_I32_I1, null_frag, " defm V_SUBBREV_U32 : VOP2bInst <"v_subbrev_u32", VOP2b_I32_I1_I32_I32_I1, null_frag, "v_subb_u32">; -let SubtargetPredicate = HasAddNoCarryInsts, isReMaterializable = 1 in { +let SubtargetPredicate = HasAddNoCarryInsts, isReMaterializable = 1 in { defm V_SUB_U32 : VOP2Inst <"v_sub_u32", VOP_I32_I32_I32_ARITH, null_frag, "v_sub_u32">; defm V_SUBREV_U32 : VOP2Inst <"v_subrev_u32", VOP_I32_I32_I32_ARITH, null_frag, "v_sub_u32">; } -let SubtargetPredicate = HasAddNoCarryInsts, isReMaterializable = 1, isAdd = 1 in { +let SubtargetPredicate = HasAddNoCarryInsts, isReMaterializable = 1, isAdd = 1 in { defm V_ADD_U32 : VOP2Inst_VOPD <"v_add_u32", VOP_I32_I32_I32_ARITH, 0x10, "v_add_nc_u32", null_frag, "v_add_u32">; } -let isAdd = 1 in { +let isAdd = 1 in { defm V_ADD_CO_U32 : VOP2bInst <"v_add_co_u32", VOP2b_I32_I1_I32_I32, null_frag, "v_add_co_u32">; defm V_ADDC_U32 : VOP2bInst <"v_addc_u32", VOP2b_I32_I1_I32_I32_I1, null_frag, "v_addc_u32">; } @@ -2290,10 +2290,10 @@ multiclass Base_VOP2_Real_e32e64_vi op> : } // End AssemblerPredicate = isGFX8GFX9, DecoderNamespace = "GFX8" -multiclass VOP2_SDWA_Real op> { +multiclass VOP2_SDWA8_Real op> { if !cast(NAME#"_e32").Pfl.HasExtSDWA then def _sdwa_vi : - VOP_SDWA_Real (NAME#"_sdwa")>, + VOP_SDWA8_Real (NAME#"_sdwa")>, VOP2_SDWAe (NAME#"_sdwa").Pfl>; } @@ -2321,7 +2321,7 @@ multiclass VOP2be_Real_e32e64_vi_only op, string OpName, string AsmName } if !cast(OpName#"_e32").Pfl.HasExtSDWA then def _sdwa_vi : - VOP_SDWA_Real (OpName#"_sdwa")>, + VOP_SDWA8_Real (OpName#"_sdwa")>, VOP2_SDWAe (OpName#"_sdwa").Pfl> { VOP2_SDWA_Pseudo ps = !cast(OpName#"_sdwa"); let AsmString = AsmName # ps.AsmOperands; @@ -2337,7 +2337,7 @@ multiclass VOP2be_Real_e32e64_vi_only op, string OpName, string AsmName } // End AssemblerPredicate = isGFX8Only, DecoderNamespace = "GFX8" -let AssemblerPredicate = isGFX9Only, DecoderNamespace = "GFX9" in { +let DecoderNamespace = "GFX9" in { multiclass VOP2be_Real_e32e64_gfx9 op, string OpName, string AsmName> { def _e32_gfx9 : @@ -2386,10 +2386,10 @@ multiclass VOP2_Real_e32e64_gfx9 op> { VOP2_DPPe(NAME#"_dpp")>; } -} // End AssemblerPredicate = isGFX9Only, DecoderNamespace = "GFX9" +} // End DecoderNamespace = "GFX9" multiclass VOP2_Real_e32e64_vi op> : - Base_VOP2_Real_e32e64_vi, VOP2_SDWA_Real, VOP2_SDWA9_Real { + Base_VOP2_Real_e32e64_vi, VOP2_SDWA8_Real, VOP2_SDWA9_Real { if !cast(NAME#"_e32").Pfl.HasExtDPP then def _dpp_vi : @@ -2401,7 +2401,7 @@ defm V_CNDMASK_B32 : VOP2_Real_e32e64_vi <0x0>; defm V_ADD_F32 : VOP2_Real_e32e64_vi <0x1>; defm V_SUB_F32 : VOP2_Real_e32e64_vi <0x2>; defm V_SUBREV_F32 : VOP2_Real_e32e64_vi <0x3>; -let AssemblerPredicate = isGCN3ExcludingGFX90A in +let OtherPredicates = [isGCN3ExcludingGFX90A] in defm V_MUL_LEGACY_F32 : VOP2_Real_e32e64_vi <0x4>; defm V_MUL_F32 : VOP2_Real_e32e64_vi <0x5>; defm V_MUL_I32_I24 : VOP2_Real_e32e64_vi <0x6>; @@ -2431,6 +2431,7 @@ defm V_ADDC_U32 : VOP2be_Real_e32e64_vi_only <0x1c, "V_ADDC_U32", " defm V_SUBB_U32 : VOP2be_Real_e32e64_vi_only <0x1d, "V_SUBB_U32", "v_subb_u32">; defm V_SUBBREV_U32 : VOP2be_Real_e32e64_vi_only <0x1e, "V_SUBBREV_U32", "v_subbrev_u32">; +let AssemblerPredicate = isGFX9Only in { defm V_ADD_CO_U32 : VOP2be_Real_e32e64_gfx9 <0x19, "V_ADD_CO_U32", "v_add_co_u32">; defm V_SUB_CO_U32 : VOP2be_Real_e32e64_gfx9 <0x1a, "V_SUB_CO_U32", "v_sub_co_u32">; defm V_SUBREV_CO_U32 : VOP2be_Real_e32e64_gfx9 <0x1b, "V_SUBREV_CO_U32", "v_subrev_co_u32">; @@ -2441,6 +2442,7 @@ defm V_SUBBREV_CO_U32 : VOP2be_Real_e32e64_gfx9 <0x1e, "V_SUBBREV_U32", "v_s defm V_ADD_U32 : VOP2_Real_e32e64_gfx9 <0x34>; defm V_SUB_U32 : VOP2_Real_e32e64_gfx9 <0x35>; defm V_SUBREV_U32 : VOP2_Real_e32e64_gfx9 <0x36>; +} // End AssemblerPredicate = isGFX9Only defm V_BFM_B32 : VOP2_Real_e64only_vi <0x293>; defm V_BCNT_U32_B32 : VOP2_Real_e64only_vi <0x28b>; @@ -2518,7 +2520,7 @@ defm V_XNOR_B32 : VOP2_Real_e32e64_vi <0x3d>; } // End SubtargetPredicate = HasDLInsts -let AssemblerPredicate = isGFX90APlus, DecoderNamespace = "GFX90A" in { +let DecoderNamespace = "GFX90A" in { multiclass VOP2_Real_e32_gfx90a op> { def _e32_gfx90a : VOP2_Real(NAME#"_e32"), SIEncodingFamily.GFX90A>, @@ -2551,7 +2553,7 @@ let SubtargetPredicate = HasFmacF64Inst in { defm V_FMAC_F64 : VOP2_Real_e32e64_gfx90a <0x4>; } // End SubtargetPredicate = HasFmacF64Inst -let SubtargetPredicate = isGFX90APlus, IsSingle = 1 in { +let IsSingle = 1 in { defm V_MUL_LEGACY_F32 : VOP2_Real_e64_gfx90a <0x2a1>; } diff --git a/llvm/lib/Target/AMDGPU/VOPCInstructions.td b/llvm/lib/Target/AMDGPU/VOPCInstructions.td index d6e08dce130ced..f4ccae1decb1df 100644 --- a/llvm/lib/Target/AMDGPU/VOPCInstructions.td +++ b/llvm/lib/Target/AMDGPU/VOPCInstructions.td @@ -2290,7 +2290,7 @@ multiclass VOPC_Real_vi op> { if !cast(NAME#"_e32").Pfl.HasExtSDWA then def _sdwa_vi : - VOP_SDWA_Real (NAME#"_sdwa")>, + VOP_SDWA8_Real (NAME#"_sdwa")>, VOPC_SDWAe (NAME#"_sdwa").Pfl>; if !cast(NAME#"_e32").Pfl.HasExtSDWA9 then diff --git a/llvm/lib/Target/AMDGPU/VOPInstructions.td b/llvm/lib/Target/AMDGPU/VOPInstructions.td index aab5dc7465d938..24fe24b1a53141 100644 --- a/llvm/lib/Target/AMDGPU/VOPInstructions.td +++ b/llvm/lib/Target/AMDGPU/VOPInstructions.td @@ -650,7 +650,7 @@ class VOP_SDWA_Pseudo pattern=[]> : let Uses = !if(ReadsModeReg, [MODE, EXEC], [EXEC]); let SubtargetPredicate = HasSDWA; - let AssemblerPredicate = HasSDWA; + //let AssemblerPredicate = HasSDWA; let AsmVariantName = !if(P.HasExtSDWA, AMDGPUAsmVariants.SDWA, AMDGPUAsmVariants.Disable); let DecoderNamespace = "GFX8"; @@ -658,7 +658,7 @@ class VOP_SDWA_Pseudo pattern=[]> : VOPProfile Pfl = P; } -class VOP_SDWA_Real : +class VOP_SDWA8_Real : InstSI , SIMCInstr { @@ -676,7 +676,7 @@ class VOP_SDWA_Real : // Copy relevant pseudo op flags let SubtargetPredicate = ps.SubtargetPredicate; - let AssemblerPredicate = ps.AssemblerPredicate; + let AssemblerPredicate = HasSDWA8; let AsmMatchConverter = ps.AsmMatchConverter; let AsmVariantName = ps.AsmVariantName; let UseNamedOperandTable = ps.UseNamedOperandTable; @@ -708,7 +708,7 @@ class Base_VOP_SDWA9_Real : let Constraints = ps.Constraints; let DisableEncoding = ps.DisableEncoding; - let SubtargetPredicate = HasSDWA9; + let SubtargetPredicate = ps.SubtargetPredicate; let AssemblerPredicate = HasSDWA9; let OtherPredicates = ps.OtherPredicates; let AsmVariantName = !if(ps.Pfl.HasExtSDWA9, AMDGPUAsmVariants.SDWA9, @@ -735,7 +735,7 @@ class VOP_SDWA9_Real : SIMCInstr ; class Base_VOP_SDWA10_Real : Base_VOP_SDWA9_Real { - let SubtargetPredicate = HasSDWA10; + let SubtargetPredicate = ps.SubtargetPredicate; let AssemblerPredicate = HasSDWA10; let DecoderNamespace = "GFX10"; } @@ -1508,7 +1508,7 @@ class VOP3_DPP16_t16_Helper op, VOP_DPP_Pseudo ps, let SchedRW = ps.SchedRW; let Uses = ps.Uses; let AssemblerPredicate = HasDPP16; - let SubtargetPredicate = HasDPP16; + let SubtargetPredicate = ps.SubtargetPredicate; let OtherPredicates = ps.OtherPredicates; }