diff --git a/llvm/lib/Target/AMDGPU/SMInstructions.td b/llvm/lib/Target/AMDGPU/SMInstructions.td --- a/llvm/lib/Target/AMDGPU/SMInstructions.td +++ b/llvm/lib/Target/AMDGPU/SMInstructions.td @@ -102,21 +102,19 @@ (ins SReg_32:$soffset, smem_offset_mod:$offset), "$soffset$offset">; -class SM_Probe_Pseudo +class SM_Probe_Pseudo : SM_Pseudo { + !con((ins i8imm:$sdata, baseClass:$sbase), offsets.Ins), + " $sdata, $sbase, " # offsets.Asm> { let mayLoad = 0; let mayStore = 0; let has_glc = 0; let LGKM_CNT = 0; let ScalarStore = 0; let hasSideEffects = 1; - let has_offset = hasOffset; - let has_soffset = hasSOffset; - let PseudoInstr = opName # variant; + let has_offset = offsets.HasOffset; + let has_soffset = offsets.HasSOffset; + let PseudoInstr = opName # offsets.Variant; } class SM_Load_Pseudo - : SM_Pseudo { + RegisterClass srcClass, OffsetMode offsets> + : SM_Pseudo { RegisterClass BaseClass = baseClass; RegisterClass SrcClass = srcClass; let mayLoad = 0; let mayStore = 1; let has_glc = 1; let has_dlc = 1; + let has_offset = offsets.HasOffset; + let has_soffset = offsets.HasSOffset; let ScalarStore = 1; + let PseudoInstr = opName # offsets.Variant; } -class SM_Discard_Pseudo - : SM_Pseudo { +class SM_Discard_Pseudo + : SM_Pseudo { let mayLoad = 0; let mayStore = 0; let has_glc = 0; let has_sdst = 0; let ScalarStore = 0; let hasSideEffects = 1; - let has_offset = hasOffset; - let has_soffset = hasSOffset; - let PseudoInstr = opName # variant; + let has_offset = offsets.HasOffset; + let has_soffset = offsets.HasSOffset; + let PseudoInstr = opName # offsets.Variant; } multiclass SM_Pseudo_Loads { - def _IMM : SM_Store_Pseudo { - let has_offset = 1; - let PseudoInstr = opName # "_IMM"; - } - - def _SGPR : SM_Store_Pseudo { - let has_soffset = 1; - let PseudoInstr = opName # "_SGPR"; - } - - def _SGPR_IMM : SM_Store_Pseudo { - let has_offset = 1; - let has_soffset = 1; - let PseudoInstr = opName # "_SGPR_IMM"; - } + def _IMM : SM_Store_Pseudo ; + def _SGPR : SM_Store_Pseudo ; + def _SGPR_IMM : SM_Store_Pseudo ; } multiclass SM_Pseudo_Discards { - def _IMM : SM_Discard_Pseudo ; - def _SGPR : SM_Discard_Pseudo ; - def _SGPR_IMM : SM_Discard_Pseudo ; + def _IMM : SM_Discard_Pseudo ; + def _SGPR : SM_Discard_Pseudo ; + def _SGPR_IMM : SM_Discard_Pseudo ; } class SM_Time_Pseudo : SM_Pseudo< @@ -225,12 +205,9 @@ } multiclass SM_Pseudo_Probe { - def _IMM : SM_Probe_Pseudo ; - def _SGPR : SM_Probe_Pseudo ; - def _SGPR_IMM : SM_Probe_Pseudo ; + def _IMM : SM_Probe_Pseudo ; + def _SGPR : SM_Probe_Pseudo ; + def _SGPR_IMM : SM_Probe_Pseudo ; } class SM_WaveId_Pseudo : SM_Pseudo< @@ -605,23 +582,21 @@ let Inst{12-6} = !if(ps.has_sdst, sdata{6-0}, ?); } -class SMEM_Real_Store_vi op, string ps, dag offsets> - : SMEM_Real_Store_Base_vi (ps)> { - RegisterClass SrcClass = !cast(ps).SrcClass; - RegisterClass BaseClass = !cast(ps).BaseClass; +class SMEM_Real_Store_vi op, string ps, OffsetMode offsets> + : SMEM_Real_Store_Base_vi (ps # offsets.Variant)> { + RegisterClass SrcClass = !cast(ps # offsets.Variant).SrcClass; + RegisterClass BaseClass = !cast(ps # offsets.Variant).BaseClass; let InOperandList = !con((ins SrcClass:$sdata, BaseClass:$sbase), - offsets, (ins CPol:$cpol)); + offsets.Ins, (ins CPol:$cpol)); } multiclass SM_Real_Stores_vi op, string ps> { - def _IMM_vi : SMEM_Real_Store_vi ; - def _SGPR_vi : SMEM_Real_Store_vi ; - def _SGPR_alt_gfx9 : SMEM_Real_Store_vi , + def _IMM_vi : SMEM_Real_Store_vi ; + def _SGPR_vi : SMEM_Real_Store_vi ; + def _SGPR_alt_gfx9 : SMEM_Real_Store_vi , SMEM_Real_SGPR_alt_gfx9; let IsGFX9SpecificEncoding = true in - def _SGPR_IMM_gfx9 : SMEM_Real_Store_vi < - op, ps#"_SGPR_IMM", (ins SReg_32:$soffset, smem_offset_mod:$offset)>; + def _SGPR_IMM_gfx9 : SMEM_Real_Store_vi ; } multiclass SM_Real_Probe_vi op, string ps> {